Re: Improving the git remote command
- From
Keller, Jacob E <jacob.e.keller@intel.com>
- Date
- Aug 27, 2014, 21:22 UTC
- Message-ID
- <1409174560.2715.15.camel@jekeller-desk1.amr.corp.intel.com>
- In-Reply-To
- <xmqqegw1d61r.fsf@gitster.dls.corp.google.com>
On Wed, 2014-08-27 at 13:35 -0700, Junio C Hamano wrote:
Show 43 quoted lines
> David Aguilar <davvid@gmail.com> writes: > > > We have some internal scripts at Disney Animation that rely on "git remote" > > output so I would vote for #3 personally as well. > > I take it that you mean you would vote _against_ #3 which will break > the expectation. > > > I know that "git config" is porcelain, and I can get remote.(.*).url, > > but that's not obvious and I highly doubt that anyone does that. > > Perhaps that is something worth fixing. > > > What if we said that "git remote list --porcelain" == "git remote" > > and then just leave "git remote" output as-is so that we don't have to > > have a flag day when we break people's scripts? > > I suspect that it is not likely a workable solution. The commands > being Porcelain by definition means that people aimed to make their > output consumable by humans, and the current "git remote", which may > be what your script happens to use, is not by design the best > representation of the information for all the script writers to > want to call _good_. > > If we were to do "git remote list", I'd imagine it would be far more > useful to have --format="<format specifiers>" option so that you can > do something like > > git remote list --format="%(name) %(url) (%(direction))" > > Then scripts can explicitly ask for what they want and have less > chance of getting broken (I say "less" because what %(specifier) > stands for could be changed either to fix mistakes or by mistake). > > >> > Having said that, my preference is > >> > > >> > 0. Do nothing, but document the "default to listing" better if > >> > needed. > >> > > >> > and then 2. above, and then 1. > >> > >> Yeah, I'd agree with that. > >
Personally, I have always disliked that "git remote" only shows remote names, which is almost entirely useless to me as a human. Obviously it is easiest way to actually get the remote names out.
I would much prefer changing the output so that git remote shows all the output.. But yes, this does potentially break expected output from a git command that might be used by scripts.
I end up typing git remote and forgetting the -v a lot of the time, so I have to re-run the command. It has also confused many new people I've had to teach git.
Regards, Jake