Skip to content

Commit

Permalink
Fix: ("git diff") Don't run if no merge-base ref
Browse files Browse the repository at this point in the history
Fixes #151.  Thanks to Aaron Zeng (@bcc32) for reporting.
  • Loading branch information
alphapapa committed Aug 19, 2023
1 parent b09bef6 commit 50ebda9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions magit-todos.el
Original file line number Diff line number Diff line change
Expand Up @@ -1375,11 +1375,12 @@ When SYNC is non-nil, match items are returned."
:command (progn
;; Silence byte-compiler warnings about these vars we don't use in this scanner.
(ignore search-regexp-elisp search-regexp-pcre extra-args directory depth)
(list "git" "--no-pager" "diff" "--no-color" "-U0"
(-> "git merge-base HEAD "
(concat magit-todos-branch-list-merge-base-ref)
shell-command-to-string
string-trim)))
(let ((merge-base-ref (-> "git merge-base HEAD "
(concat magit-todos-branch-list-merge-base-ref)
shell-command-to-string
string-trim)))
(unless (string-empty-p merge-base-ref)
(list "git" "--no-pager" "diff" "--no-color" "-U0" merge-base-ref))))
:callback 'magit-todos--git-diff-callback)

(magit-todos-defscanner "find|grep"
Expand Down

0 comments on commit 50ebda9

Please sign in to comment.