Skip to content

Commit

Permalink
Make empty magit-log-remove-graph-args never remove --graph
Browse files Browse the repository at this point in the history
This fix treats an empty list (or nil) `magit-log-remove-graph-args'
as "never-match" so to never remove `--graph' in log commands.

Before this fix:

  ;; Never remove `--graph'.  Ugly.
  (setq magit-log-remove-graph-args (list "something that will never match"))

  ;; Remove `--graph' everywhere.  Confusing nil->"true".
  (setq magit-log-remove-graph-args nil)

Now:

  ;; Never remove `--graph'.
  (setq magit-log-remove-graph-args nil)

  ;; Remove `--graph' everywhere.  Empty string regex matches everything.
  (setq magit-log-remove-graph-args (list ""))
  • Loading branch information
Gravemind authored and tarsius committed Feb 16, 2020
1 parent ab2b355 commit aca89fd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lisp/magit-log.el
Original file line number Diff line number Diff line change
Expand Up @@ -938,9 +938,10 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
(unless (magit-file-tracked-p (car files))
(setq args (cons "--full-history" args)))
(setq args (remove "--follow" args)))
(when (--any-p (string-match-p
(concat "^" (regexp-opt magit-log-remove-graph-args)) it)
args)
(when (and (car magit-log-remove-graph-args)
(--any-p (string-match-p
(concat "^" (regexp-opt magit-log-remove-graph-args)) it)
args))
(setq args (remove "--graph" args)))
(unless (member "--graph" args)
(setq args (remove "--color" args)))
Expand Down

0 comments on commit aca89fd

Please sign in to comment.