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

additional commit arguments throw error

Open tduehr opened this issue 5 years ago • 3 comments

As git-fixup is a wrapper of another utility, extra arguments should be passed to git-commit. Currently, I have to wrap them in quotes: git fixup "HEAD -a".

tduehr avatar Feb 27 '19 17:02 tduehr

Hi @tduehr

My intentions for this script was never to be 1-to-1 with git-commit and passing unknown flags to commit would limit what flags can be used by git-fixup without breaking in surprising ways when either command changes.

I think it would be fine to accept extra commit arguments with the shell convention of --my-opt -- --commit-opt but that's perhaps no better than what your currently doing for your use case. Maybe you want an alias for commit that uses fixup for suggestions? The completion function should be possible to plug into any commit (but I have not actually tried this)

that it splits the quoted argument sounds like a bug even if it happen to be useful in this instance.

keis avatar Feb 28 '19 09:02 keis

I'd be good with --. Given your intentions and my request, it's the best route. Typing git fixup HEAD -- -a means I can use autocomplete for the ref and I don't have to balance quotes.

It's not doing anything with the quoted arguments. The shell is passing them as a single argument and the script building a git-commit command from it:

git commit --fixup HEAD -a

You could also write my command like:

git fixup HEAD\ -a

I may actually start doing that until -- gets added.

tduehr avatar Feb 28 '19 16:02 tduehr

I hope I don't sound completely dismissive but -- is not likely to get added until you add it. I, personally, don't have a need for it but it's a reasonable enough feature that would be happy to support it.

In general a single argument is expected to remain a single argument but shell is notoriously error prone with this if you forget to slap "" around your $vars. Some say it's a feature I guess

keis avatar Feb 28 '19 16:02 keis