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

Re: git show and the --quiet option

From
Junio C Hamano <gitster@pobox.com>
Date
May 28, 2011, 19:17 UTC
Message-ID
<7vhb8eprcb.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110528172611.GB28708@centaur.lab.cmartin.tk>
Carlos Martín Nieto <cmn@elego.de> writes:
Show 10 quoted lines
>> 1c40c36b ("log: convert to parse-options").  Was this intentional?
>
> Very much so.
>> ...
> The long answer is that the log family (and git-format-patch, which
> is where this started) never actually accepted --quiet, so it would
> get passed down to the diff machinery. This (for complicated reasons
> I'm not sure I comletely understand, but that have to do with the
> internal handling of 'quiet' as 'quick') caused every second commit
> not to show.

Yes, "git format-patch" that gives empty patch for every other commit would have been incorrect, but "--quiet" to squelch patch output, especially in the context of "show" whose default is to show patch, is something people would naturally expect, even though admittedly it was doing so by accident.

How does this patch look?

It does not fix "git show master~10 master^..master", but instead of just hijacking and ignoring the --quiet option like your patch did, it actually flips the option the user wanted to affect from the command line.

 builtin/log.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin/log.c b/builtin/log.c
index 27849dc..224b167 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -107,6 +107,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
 			     PARSE_OPT_KEEP_DASHDASH);
 
 	argc = setup_revisions(argc, argv, rev, opt);
+	if (quiet)
+		rev->diffopt.output_format |= DIFF_FORMAT_NO_OUTPUT;
 
 	/* Any arguments at this point are not recognized */
 	if (argc > 1)
Previous: Carlos Martín NietoNext: Carlos Martín Nieto
Message 5 of 10 in “git show and the --quiet option”
  1. Gustaf HendebyMay 28, 2011
  2. Carlos Martín NietoMay 28, 2011
  3. Gustaf HendebyMay 28, 2011
  4. Carlos Martín NietoMay 29, 2011
  5. Junio C HamanoMay 28, 2011
  6. Carlos Martín NietoMay 30, 2011
  7. Drew NorthupJun 2, 2011
  8. Carlos Martín NietoJun 5, 2011
  9. Junio C HamanoMay 28, 2011
  10. Junio C HamanoMay 28, 2011

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.