git-together icon indicating copy to clipboard operation
git-together copied to clipboard

Make git command a config option

Open sentientmonkey opened this issue 7 years ago • 3 comments

I've been trying to get magit (for emacs) and fugitive (for vim) to work well with git-together. One of the problems for both is that if they are launched and don't rely on aliases, then even if you change the "git binary" for those apps, it can't find the original git binary when using pass through commands. git-together assumes that git is in the current $PATH, so that breaks down when plugins are not using the default user's shell to exec commands. See #31 and #22 for examples.

One approach to fixing that could be to make the git binary configurable from here: https://github.com/kejadlen/git-together/blob/90e01b568c2fb926f349500047f74642f18ba8b1/src/lib.rs#L82

If this is set in the git-together config, this also could allow forwarding to other git proxy commands (like hub). I don't know when I'll have time to work on this, but opening the issue up for discussion.

sentientmonkey avatar Sep 10 '18 21:09 sentientmonkey

Example config:

[git-together]
	git-command = /usr/local/bin/git

or

[git-together]
	git-command = hub

This could also default back to relying on the shell's PATH and 'git' as the default option for older installs.

sentientmonkey avatar Sep 10 '18 22:09 sentientmonkey

I've been spiking this in a branch: https://github.com/sentientmonkey/git-together/tree/configure-git-exec

It does proxy out to the command now, but both intellij and magit bomb out trying to commit. I think the next step is to debug and see how they are interacting with git commit

sentientmonkey avatar Oct 11 '18 00:10 sentientmonkey

I think based on #31 one approach could be parsing out all of the git flags before the subcommand and then preserving them to forward down into the git command execution.

$ man git
 git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [--super-prefix=<path>]
           <command> [<args>]

If that was handled, then our subcommand would be easier to recognize and the commit would work properly.

sentientmonkey avatar Oct 16 '18 22:10 sentientmonkey