Re: [RFC] add test cases for the --repo option to git push
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:46:18
On Fri, 27 Feb 2009, Jay Soffian wrote:
So I still don't get why Linus introduced the option. I'm looking at bcc785f:builtin-push.c and AFAICT, the following are exactly equivalent: $ git push [options]... <repo> $ git push [options]... --repo=<repo>
Yes. But now do [alias] push-all=push all and then try to add those options AFTERWARDS!
--repo can be placed anywhere on the command line, but other than that, it's identical in effect to specifying the repo as the first non-dashed argument. Or am I completely blind?
It's the "placed anywhere on the command line" that is the important part. Try git push-all --tags and it didn't use to work without "--repo=all". Of course, I think it works now, because I think "git push" uses "parse_options" these days, so now "--tags" actually works even after the repository definition. So _these_ days, you can just do git push all --tags but that was not true historically. Back then, if you wanted to use an alias (which mean that the repo was named _before_ the arguments), you needed to do git push --repo=all --tags because putting "--tags" after the repository name wouldn't work. So _today_, we could remove the use of "--repo". But today, we have another reason to do "--repo" - compatibility. Linus