git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Trevor Saunders <tbsaunde@tbsaunde.org>
Cc: Stefan Beller <sbeller@google.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] bisect: print abbrev sha1 for first bad commit
Date: Sun, 10 May 2015 21:10:09 -0400	[thread overview]
Message-ID: <20150511011009.GA21830@peff.net> (raw)
In-Reply-To: <20150510231110.GA25157@tsaunders-iceball.corp.tor1.mozilla.com>

On Sun, May 10, 2015 at 07:12:45PM -0400, Trevor Saunders wrote:

> > Yeah, I have always found bisect's output somewhat silly. It prints the
> > "--raw" diff output, which is not incredibly useful. And then to top it
> > off, it does not feed the "--recursive" switch to the diff, so you don't
> > even get to see the real list of changed files.
> 
>  So, fun fact it doesn't actually always print the raw diffoutput if
>  there is no diff, for example a merge where both sides only touched
>  different files as in test 40 in t6030.

Ah, that makes sense. It's basically just feeding the commit to
"diff-tree" (except doing it internally rather than running it as a
separate program). And the defaults there do not show anything for merge
commits. It could do the equivalent of "--cc" (i.e., set the
dense_combined_merges flag in the "struct rev_info").

> > (Actually, it looks like all this is generated in bisect.c:show_diff_tree,
> > so it would have to be written in C; but it should be pretty easy to
> > tweak the display options).
> 
> yeah, that seems pretty straight forward, but I'm not really sure what
> to do about this case where no diff is printed, I guess I should figure
> out what bits need to be set for the commit to be shown anyway.

I'd argue for simply never showing the diff (dropping the "opt.diff = 1"
line from bisect.c:show_diff_tree), but that is mostly my personal
opinion. If we are going to show a diff, perhaps "--recursive
--name-status" would be the most friendly, with "--cc" for the merge
commits.

Translated into C, something like (this is completely untested):

diff --git a/bisect.c b/bisect.c
index 10f5e57..62786cf 100644
--- a/bisect.c
+++ b/bisect.c
@@ -876,6 +876,8 @@ static void show_diff_tree(const char *prefix, struct commit *commit)
 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
 	opt.abbrev = 0;
 	opt.diff = 1;
+	opt.combine_merges = 1;
+	opt.dense_combined_merges = 1;
 
 	/* This is what "--pretty" does */
 	opt.verbose_header = 1;
@@ -884,7 +886,8 @@ static void show_diff_tree(const char *prefix, struct commit *commit)
 
 	/* diff-tree init */
 	if (!opt.diffopt.output_format)
-		opt.diffopt.output_format = DIFF_FORMAT_RAW;
+		opt.diffopt.output_format = DIFF_FORMAT_NAME_STATUS;
+	DIFF_OPT_SET(&opt.diffopt, RECURSIVE);
 
 	log_tree_commit(&opt, commit);
 }

  reply	other threads:[~2015-05-11  1:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 23:46 [PATCH] bisect: print abbrev sha1 for first bad commit Trevor Saunders
2015-05-09  0:29 ` Stefan Beller
2015-05-09  2:03   ` Trevor Saunders
2015-05-09  4:07     ` Jeff King
2015-05-10 23:12       ` Trevor Saunders
2015-05-11  1:10         ` Jeff King [this message]
2015-05-11  4:33           ` Junio C Hamano
2015-05-11  7:38             ` Christian Couder
2015-05-11 16:54               ` Junio C Hamano
2015-05-11 18:17                 ` Trevor Saunders
2015-05-11 18:28                   ` Stefan Beller
2015-05-12  9:21                 ` Christian Couder
2015-05-12 17:11                   ` Junio C Hamano
2015-05-12 20:43                     ` Christian Couder
2015-05-12 20:58                       ` Stefan Beller
2015-05-12 23:40                         ` Trevor Saunders
2015-05-13 13:24                           ` Christian Couder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150511011009.GA21830@peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=sbeller@google.com \
    --cc=tbsaunde@tbsaunde.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).