0

I want to add a custom log option via (in init.el after some require magit package introduction):

(defun magit-log-my-stuff (&optional args files)
  (interactive (magit-log-arguments))
  "Show log for all my relevant stuff."
  (magit-log-setup-buffer
   (list "--branches" "--remotes={myremote/foo/[ao]*,otherremote/bar/x*}")
   args files))

(transient-append-suffix 'magit-log "l"
  '("m" "mystuff" magit-log-my-stuff))

Everything works as expected if I add a single glob pattern like "--remotes=myremote/foo/[ao]*", but not with the "or" {...,...} glob pattern. On the command line, I get the expected if I use

git log --branches --remotes={myremote/foo/[ao]*,otherremote/bar/x*}

So it seems that somehow emacs/magit provides slightly different arguments to git log. How can I provide such a more complex glob pattern in magit?

2
  • What does the magit process log show as the executed command?
    – phils
    Commented May 3, 2023 at 9:50
  • I have tried to figure that out, but the magit process log (via $) does not show any git log command, only some other git commands. Seems this is done differently somehow. I also enabled magit-toggle-git-debug, but nothing is shown. If "HEAD" is present in the list of branches (as is the case for some options like local branches in magit-log.el), then I get "git … rev-parse --short HEAD\~ \newline fatal: Needed a single revision".
    – mscfd
    Commented May 4, 2023 at 12:39

1 Answer 1

0

The answer is rather simple, just provide several --remotes options:

(defun magit-log-my-stuff (&optional args files)
  (interactive (magit-log-arguments))
  "Show log for all my relevant stuff."
  (magit-log-setup-buffer
   (list "--branches" "--remotes=myremote/foo/[ao]*" "--remotes=otherremote/bar/x*")
   args files))

In fact, on the command line the shell (bash) resolves the glob pattern argument

--remotes={myremote/foo/[ao]*,otherremote/bar/x*}

as

'--remotes=myremote/foo/[ao]*' '--remotes=otherremote/bar/x*'

which is what is passed on to git log.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.