3

I would like to manually edit the Git command run by a Magit popup. Is there a way to do this?

For example, in magit-log-popup, I want to add --date default to the git log command that Magit is going to run. The --date option is not one of the options supported by the log popup.

UPDATE: Feature request: https://github.com/magit/magit/issues/2700.

  • 1
    Log a feature request for manual editing of the final command as a generic option? It would be nice to have it as an option everywhere. I would suggest that : could be bound in pop-ups to set an option that gets picked up by the eventual "execute the command" code (which then provides the interactive prompt). – phils Jun 14 '16 at 22:53
  • @phils: Good idea; done: github.com/magit/magit/issues/2700 ! – ntc2 Jun 14 '16 at 23:26
2

I likely won't be adding this feature to the current implementation in magit-popup.el but I will consider adding it to the planned successor transient. See the open issue #2700 on Github for more information.

3

You can simply add your own option to the popup

(magit-define-popup-option 'magit-log-popup
  ?D "Date" "--date=" #'read-from-minibuffer)

Now when the popup is open and you press =D you can enter the date option that you would like.

You can learn more on the magit wiki

  • 1
    Thanks, but there is a one-off way to do this, by directly editing the Git command that Magit is going to use? E.g. now I would also like to add --pickaxe-regex, but I don't want to add another magit-define-popup-option for every new option. – ntc2 Jun 14 '16 at 21:50
  • 1
    I'm not in front of my computer but what if you make an option that has an empty 4th argument so instead of "--date=" you had "". Then when you prompted you enter anything you want – Jules Jun 15 '16 at 3:29
  • Interesting idea, but I think quoting cretes a problem here: it seems that Magit quotes the argument to the option, so e.g. --date default becomes "--date default". – ntc2 Jun 15 '16 at 19:15
  • @ntc2 So having (magit-define-popup-option 'magit-log-popup ?G "General" "" #'read-from-minibuffer) and then typing "--date=default" in the prompt would not work? – Jules Jun 15 '16 at 19:18
  • 1
    Adding this feature to Magit, as suggested by phils, seems like a good way to go. – ntc2 Jun 15 '16 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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