git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: I think git show is broken

From
Jeff King <peff@peff.net>
Date
Aug 28, 2012, 22:45 UTC
Message-ID
<20120828224550.GA21940@sigill.intra.peff.net>
In-Reply-To
<7v4nnmzlsl.fsf@alter.siamese.dyndns.org>
On Tue, Aug 28, 2012 at 03:36:26PM -0700, Junio C Hamano wrote:
Show 16 quoted lines
> > As a result, the flag would have no effect in "git log -p
> > --quiet" or "git show --quiet".  Fix it by setting the
> > format flag before the call to setup_revisions.
> 
> This also means that
> 
> 	git show --name-status --quiet
> 
> will start erroring out, if I am not recalling what diff_setup_done()
> does.  Which pretty much means "--quiet" given to the "log" family
> is truly a synonym to "-s", as the error condition that triggers is
> exactly the same for this:
> 
> 	git show --name-status -s
> 
> which is fine, I think.

Yes, I noticed that. I think it is fine for "--quiet" to be a true synonym for "-s" here.

Though I am puzzled why we would error out on "--name-status -s" but not "--patch -s". What is the difference between "--name-status" and "--patch" here? Shouldn't "-s" override all formatting options?

And one final thing I noticed that is probably not worth the trouble to fix: the position of "-s" is independent of its effect. Normally options which override each other would be position dependent, so:

  git log --relative-date --date=local
and
  git log --date=local --relative-date

would both throw away the first option and let the latter take effect. But doing:

  git log --patch -s
and
  git log -s --patch

will always have "-s" take over. I don't think it's a huge deal, and fixing it would be a pain. We'd have to take NO_OUTPUT out of the bit-field and make it a special option, and fix any callers who try to be clever about recognizing NO_OUTPUT as a specifically-given option. And then for "--quiet", we'd have to handle it at its proper spot on the command-line, which would mean converting log's parse-options invocation to be step-wise. Probably not worth it for a minor bit of consistency that nobody has actually complained about.

-Peff
Previous: Junio C Hamano
Message 5 of 5 in “I think git show is broken”
  1. Matthew CaronAug 28, 2012
  2. Matthew CaronAug 28, 2012
  3. Jeff KingAug 28, 2012
  4. Junio C HamanoAug 28, 2012
  5. Jeff KingAug 28, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.