git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] diff-tree: do not show the sha1 of the given head with --quiet
@ 2015-07-22  9:29 Sebastian Schuberth
  2015-07-22 11:42 ` Johannes Schindelin
  2015-07-22 20:32 ` [PATCH] " Junio C Hamano
  0 siblings, 2 replies; 14+ messages in thread
From: Sebastian Schuberth @ 2015-07-22  9:29 UTC (permalink / raw)
  To: git

"--quite" is documented to "Disable all output of the program". Yet
calling diff-tree with a single commit like

$ git diff-tree --quiet c925fe2

was logging

c925fe23684455735c3bb1903803643a24a58d8f

to the console despite "--quite" being given. This is inconsistent with
both the docs and the behavior if more than a single commit is passed to
diff-tree. Moreover, the output of that single line seems to be documented
nowhere except in a comment for a test. Fix this inconsistency by making
diff-tree really output nothing if "--quiet" is given and fix the test
accordingly.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 log-tree.c            | 3 ++-
 t/t4035-diff-quiet.sh | 3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index 01beb11..3c98234 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -741,7 +741,8 @@ int log_tree_diff_flush(struct rev_info *opt)
 	}
 
 	if (opt->loginfo && !opt->no_commit_id) {
-		show_log(opt);
+		if (!DIFF_OPT_TST(&opt->diffopt, QUICK))
+			show_log(opt);
 		if ((opt->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) &&
 		    opt->verbose_header &&
 		    opt->commit_format != CMIT_FMT_ONELINE &&
diff --git a/t/t4035-diff-quiet.sh b/t/t4035-diff-quiet.sh
index 461f4bb..9a8225f 100755
--- a/t/t4035-diff-quiet.sh
+++ b/t/t4035-diff-quiet.sh
@@ -40,11 +40,10 @@ test_expect_success 'git diff-tree HEAD^ HEAD -- b' '
 	test_expect_code 1 git diff-tree --quiet HEAD^ HEAD -- b >cnt &&
 	test_line_count = 0 cnt
 '
-# this diff outputs one line: sha1 of the given head
 test_expect_success 'echo HEAD | git diff-tree --stdin' '
 	echo $(git rev-parse HEAD) |
 	test_expect_code 1 git diff-tree --quiet --stdin >cnt &&
-	test_line_count = 1 cnt
+	test_line_count = 0 cnt
 '
 test_expect_success 'git diff-tree HEAD HEAD' '
 	test_expect_code 0 git diff-tree --quiet HEAD HEAD >cnt &&

---
https://github.com/git/git/pull/163

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-07-24  6:56 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-22  9:29 [PATCH] diff-tree: do not show the sha1 of the given head with --quiet Sebastian Schuberth
2015-07-22 11:42 ` Johannes Schindelin
2015-07-22 11:56   ` [PATCH v2] " Sebastian Schuberth
2015-07-22 20:32 ` [PATCH] " Junio C Hamano
2015-07-23  7:06   ` Sebastian Schuberth
2015-07-23 16:38     ` Junio C Hamano
2015-07-23 17:06       ` Junio C Hamano
2015-07-23 20:13         ` Sebastian Schuberth
2015-07-23 18:08     ` Jeff King
2015-07-23 19:39       ` Junio C Hamano
2015-07-23 20:19         ` Sebastian Schuberth
2015-07-23 20:43           ` Junio C Hamano
2015-07-23 20:02       ` Sebastian Schuberth
2015-07-24  6:56         ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).