kejadlen/git-together

Git-wide options and IntelliJ integration don't work

sgravrock opened this issue · 3 comments

git-together assumes that the first argument is the subcommand, e.g. git commit [more args]. But options that apply to git as a whole rather than to a particular subcommand have to be specified before the subcommand. IntelliJ's git integration passes one such option: git -c core.quotepath=false commit --only -F <temp dir>/git-commit-msg-.txt -- <files to commit>. Because git-together assumes that the first argument is the subcommand, it doesn't apply signoffs when the above command is run.

I'm not sure what the best way to fix this is. The easy thing to do would be to search for commit-triggering subcommands anywhere in the argument list, but that could lead to false positives. The most correct thing to do would be to emulate Git's argument parsing. But that's a lot of extra complexity and would be likely to break if more git-wide options are added in the future.

Just step into this discussion. A PR #32 I put here is to let the people not alias the git with git-together. Instead just put the git-together in search path, git can treat git together as an extra command supported by git.

Then, this won't interfere with any tooling built on top of the git functionality, and also simplified a lot of assumptions in the git-together.

However, in this case, people has to run either git together command from shell, and IDE cannot benefit from the git-together authorship rotation features.

ipsi commented

I wanted this as well, so I added a fix for it in #43 - it should now work with IntelliJ (it did in my testing), and will only break if (a) Git adds a new global flag with arguments, and (b) IntelliJ uses it.