Skip to content

Commit

Permalink
Using glob option passes args to -g/--glob instead of --type-add,
Browse files Browse the repository at this point in the history
which means exclude glob patterns work properly
  • Loading branch information
jokem59 committed Oct 13, 2023
1 parent 415b693 commit 9455f66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions deadgrep.el
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,7 @@ to obtain ripgrep results."
((eq (car-safe deadgrep--file-type) 'type)
(push (format "--type=%s" (cdr deadgrep--file-type)) args))
((eq (car-safe deadgrep--file-type) 'glob)
(push (format "--type-add=custom:%s" (cdr deadgrep--file-type)) args)
(push "--type=custom" args))
(push (format "--glob=%s" (cdr deadgrep--file-type)) args))
(t
(error "Unknown file-type: %S" deadgrep--file-type)))

Expand Down
2 changes: 1 addition & 1 deletion test/deadgrep-unit-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ edit mode."
(let ((deadgrep--file-type '(glob . "*.el")))
(should
(equal (deadgrep--arguments "foo" 'words 'ignore '(3 . 2))
'("--no-config" "--color=ansi" "--line-number" "--no-heading" "--no-column" "--with-filename" "--fixed-strings" "--word-regexp" "--ignore-case" "--type-add=custom:*.el" "--type=custom" "--before-context=3" "--after-context=2" "--" "foo" ".")))))
'("--no-config" "--color=ansi" "--line-number" "--no-heading" "--no-column" "--with-filename" "--fixed-strings" "--word-regexp" "--ignore-case" "--glob=custom:*.el" "--before-context=3" "--after-context=2" "--" "foo" ".")))))

(ert-deftest deadgrep--arguments-error-cases ()
(should-error
Expand Down

0 comments on commit 9455f66

Please sign in to comment.