All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bisect: print abbrev sha1 for first bad commit
@ 2015-05-08 23:46 Trevor Saunders
  2015-05-09  0:29 ` Stefan Beller
  0 siblings, 1 reply; 17+ messages in thread
From: Trevor Saunders @ 2015-05-08 23:46 UTC (permalink / raw)
  To: git; +Cc: Trevor Saunders

When bisect finds the first bad commit it prints the full commit hash
followed by " is the first bad commit".  That's not terribly readable,
and its rather silly especially considering the next line contains the
full hash again.  So change bisect to print the unique abbrev hash and
then "is the first bad commit".


---
 bisect.c                    |  3 ++-
 t/t6030-bisect-porcelain.sh | 28 +++++++++++++++++-----------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/bisect.c b/bisect.c
index 10f5e57..7cdb805 100644
--- a/bisect.c
+++ b/bisect.c
@@ -942,7 +942,8 @@ int bisect_next_all(const char *prefix, int no_checkout)
 
 	if (!hashcmp(bisect_rev, current_bad_oid->hash)) {
 		exit_if_skipped_commits(tried, current_bad_oid);
-		printf("%s is the first bad commit\n", bisect_rev_hex);
+		printf("%s is the first bad commit\n",
+			find_unique_abbrev(bisect_rev, DEFAULT_ABBREV));
 		show_diff_tree(prefix, revs.commits->item);
 		/* This means the bisection process succeeded. */
 		exit(10);
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 06b4868..14232ed 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -26,6 +26,12 @@ add_line_into_file()
     git commit --quiet -m "$MSG" $_file
 }
 
+short()
+{
+	return git rev-parse --short $1
+}
+
+
 HASH1=
 HASH2=
 HASH3=
@@ -189,7 +195,7 @@ test_expect_success 'bisect skip: successful result' '
 	git bisect start $HASH4 $HASH1 &&
 	git bisect skip &&
 	git bisect bad > my_bisect_log.txt &&
-	grep "$HASH2 is the first bad commit" my_bisect_log.txt
+	grep "$(short $HASH2) is the first bad commit" my_bisect_log.txt
 '
 
 # $HASH1 is good, $HASH4 is bad, we skip $HASH3 and $HASH2
@@ -254,7 +260,7 @@ test_expect_success \
      git bisect good $HASH1 &&
      git bisect bad $HASH4 &&
      git bisect run ./test_script.sh > my_bisect_log.txt &&
-     grep "$HASH3 is the first bad commit" my_bisect_log.txt &&
+     grep "$(short $HASH3) is the first bad commit" my_bisect_log.txt &&
      git bisect reset'
 
 # We want to automatically find the commit that
@@ -267,7 +273,7 @@ test_expect_success \
      chmod +x test_script.sh &&
      git bisect start $HASH4 $HASH1 &&
      git bisect run ./test_script.sh > my_bisect_log.txt &&
-     grep "$HASH4 is the first bad commit" my_bisect_log.txt &&
+     grep "$(short $HASH4) is the first bad commit" my_bisect_log.txt &&
      git bisect reset'
 
 # $HASH1 is good, $HASH5 is bad, we skip $HASH3
@@ -280,14 +286,14 @@ test_expect_success 'bisect skip: add line and then a new test' '
 	git bisect start $HASH5 $HASH1 &&
 	git bisect skip &&
 	git bisect good > my_bisect_log.txt &&
-	grep "$HASH5 is the first bad commit" my_bisect_log.txt &&
+	grep "$(short $HASH5) is the first bad commit" my_bisect_log.txt &&
 	git bisect log > log_to_replay.txt &&
 	git bisect reset
 '
 
 test_expect_success 'bisect skip and bisect replay' '
 	git bisect replay log_to_replay.txt > my_bisect_log.txt &&
-	grep "$HASH5 is the first bad commit" my_bisect_log.txt &&
+		grep "$(short $HASH5) is the first bad commit" my_bisect_log.txt &&
 	git bisect reset
 '
 
@@ -328,7 +334,7 @@ test_expect_success 'bisect run & skip: find first bad' '
 	chmod +x test_script.sh &&
 	git bisect start $HASH7 $HASH1 &&
 	git bisect run ./test_script.sh > my_bisect_log.txt &&
-	grep "$HASH6 is the first bad commit" my_bisect_log.txt
+	grep "$(short $HASH6) is the first bad commit" my_bisect_log.txt
 '
 
 test_expect_success 'bisect skip only one range' '
@@ -378,7 +384,7 @@ test_expect_success 'bisect does not create a "bisect" branch' '
 	rev_hash6=$(git rev-parse --verify HEAD) &&
 	test "$rev_hash6" = "$HASH6" &&
 	git bisect good > my_bisect_log.txt &&
-	grep "$HASH7 is the first bad commit" my_bisect_log.txt &&
+	grep "$(short $HASH7) is the first bad commit" my_bisect_log.txt &&
 	git bisect reset &&
 	rev_hash6=$(git rev-parse --verify bisect) &&
 	test "$rev_hash6" = "$HASH6" &&
@@ -527,7 +533,7 @@ test_expect_success 'restricting bisection on one dir' '
 	para1=$(git rev-parse --verify HEAD) &&
 	test "$para1" = "$PARA_HASH1" &&
 	git bisect bad > my_bisect_log.txt &&
-	grep "$PARA_HASH1 is the first bad commit" my_bisect_log.txt
+	grep "$(short $PARA_HASH1) is the first bad commit" my_bisect_log.txt
 '
 
 test_expect_success 'restricting bisection on one dir and a file' '
@@ -545,7 +551,7 @@ test_expect_success 'restricting bisection on one dir and a file' '
 	para1=$(git rev-parse --verify HEAD) &&
 	test "$para1" = "$PARA_HASH1" &&
 	git bisect good > my_bisect_log.txt &&
-	grep "$PARA_HASH4 is the first bad commit" my_bisect_log.txt
+	grep "$(short $PARA_HASH4) is the first bad commit" my_bisect_log.txt
 '
 
 test_expect_success 'skipping away from skipped commit' '
@@ -576,7 +582,7 @@ test_expect_success 'test bisection on bare repo - --no-checkout specified' '
 			"test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
 			>../nocheckout.log
 	) &&
-	grep "$HASH3 is the first bad commit" nocheckout.log
+		grep "$(short $HASH3) is the first bad commit" nocheckout.log
 '
 
 
@@ -591,7 +597,7 @@ test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '
 			"test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
 			>../defaulted.log
 	) &&
-	grep "$HASH3 is the first bad commit" defaulted.log
+		grep "$(short $HASH3) is the first bad commit" defaulted.log
 '
 
 #
-- 
2.4.0

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  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
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Beller @ 2015-05-09  0:29 UTC (permalink / raw)
  To: Trevor Saunders; +Cc: git

On Fri, May 8, 2015 at 4:46 PM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> its rather silly especially considering the next line contains the
> full hash again.

Maybe we can omit it altogether then?

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-09  0:29 ` Stefan Beller
@ 2015-05-09  2:03   ` Trevor Saunders
  2015-05-09  4:07     ` Jeff King
  0 siblings, 1 reply; 17+ messages in thread
From: Trevor Saunders @ 2015-05-09  2:03 UTC (permalink / raw)
  To: Stefan Beller; +Cc: git

On Fri, May 08, 2015 at 05:29:42PM -0700, Stefan Beller wrote:
> On Fri, May 8, 2015 at 4:46 PM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> > its rather silly especially considering the next line contains the
> > full hash again.
> 
> Maybe we can omit it altogether then?

SO we'd print something like

the first bad commit is
Commit abcdefabcdefabcdefabcdefabcdefabcdefabcd
Author foo@ba.com

blah blah blah

? That seems reasonable to me.  If we're going that far does it also
make sense to drop printingthe lines about which trees have changed and
just print the commit message / author / hash?

Trev

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-09  2:03   ` Trevor Saunders
@ 2015-05-09  4:07     ` Jeff King
  2015-05-10 23:12       ` Trevor Saunders
  0 siblings, 1 reply; 17+ messages in thread
From: Jeff King @ 2015-05-09  4:07 UTC (permalink / raw)
  To: Trevor Saunders; +Cc: Stefan Beller, git

On Fri, May 08, 2015 at 10:03:41PM -0400, Trevor Saunders wrote:

> On Fri, May 08, 2015 at 05:29:42PM -0700, Stefan Beller wrote:
> > On Fri, May 8, 2015 at 4:46 PM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> > > its rather silly especially considering the next line contains the
> > > full hash again.
> > 
> > Maybe we can omit it altogether then?
> 
> SO we'd print something like
> 
> the first bad commit is
> Commit abcdefabcdefabcdefabcdefabcdefabcdefabcd
> Author foo@ba.com
> 
> blah blah blah
> 
> ? That seems reasonable to me.  If we're going that far does it also
> make sense to drop printingthe lines about which trees have changed and
> just print the commit message / author / hash?

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.

I suspect the most minimal we could go is:

  git log --format='The first bad commit is %h %s' $bad

and then let the user inspect further from there using the hash. But I
think it would also be reasonable to just do a straight "git log -1
$bad" with no with no diff.

(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).

-Peff

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-09  4:07     ` Jeff King
@ 2015-05-10 23:12       ` Trevor Saunders
  2015-05-11  1:10         ` Jeff King
  0 siblings, 1 reply; 17+ messages in thread
From: Trevor Saunders @ 2015-05-10 23:12 UTC (permalink / raw)
  To: Jeff King; +Cc: Stefan Beller, git

On Sat, May 09, 2015 at 12:07:04AM -0400, Jeff King wrote:
> On Fri, May 08, 2015 at 10:03:41PM -0400, Trevor Saunders wrote:
> 
> > On Fri, May 08, 2015 at 05:29:42PM -0700, Stefan Beller wrote:
> > > On Fri, May 8, 2015 at 4:46 PM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> > > > its rather silly especially considering the next line contains the
> > > > full hash again.
> > > 
> > > Maybe we can omit it altogether then?
> > 
> > SO we'd print something like
> > 
> > the first bad commit is
> > Commit abcdefabcdefabcdefabcdefabcdefabcdefabcd
> > Author foo@ba.com
> > 
> > blah blah blah
> > 
> > ? That seems reasonable to me.  If we're going that far does it also
> > make sense to drop printingthe lines about which trees have changed and
> > just print the commit message / author / hash?
> 
> 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.

> (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.

Trev

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-10 23:12       ` Trevor Saunders
@ 2015-05-11  1:10         ` Jeff King
  2015-05-11  4:33           ` Junio C Hamano
  0 siblings, 1 reply; 17+ messages in thread
From: Jeff King @ 2015-05-11  1:10 UTC (permalink / raw)
  To: Trevor Saunders; +Cc: Stefan Beller, git

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);
 }

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-11  1:10         ` Jeff King
@ 2015-05-11  4:33           ` Junio C Hamano
  2015-05-11  7:38             ` Christian Couder
  0 siblings, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2015-05-11  4:33 UTC (permalink / raw)
  To: Jeff King; +Cc: Trevor Saunders, Stefan Beller, git

Jeff King <peff@peff.net> writes:

> 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.

Yeah, I think that is sensible. It may even be OK to just give a
"log --oneline".  

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-11  4:33           ` Junio C Hamano
@ 2015-05-11  7:38             ` Christian Couder
  2015-05-11 16:54               ` Junio C Hamano
  0 siblings, 1 reply; 17+ messages in thread
From: Christian Couder @ 2015-05-11  7:38 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, Trevor Saunders, Stefan Beller, git

On Mon, May 11, 2015 at 6:33 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Jeff King <peff@peff.net> writes:
>
>> 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.
>
> Yeah, I think that is sensible. It may even be OK to just give a
> "log --oneline".

Or maybe we could let the user configure the diff options or even the
command used when the first bad commit is found?

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-11  7:38             ` Christian Couder
@ 2015-05-11 16:54               ` Junio C Hamano
  2015-05-11 18:17                 ` Trevor Saunders
  2015-05-12  9:21                 ` Christian Couder
  0 siblings, 2 replies; 17+ messages in thread
From: Junio C Hamano @ 2015-05-11 16:54 UTC (permalink / raw)
  To: Christian Couder; +Cc: Jeff King, Trevor Saunders, Stefan Beller, git

Christian Couder <christian.couder@gmail.com> writes:

> On Mon, May 11, 2015 at 6:33 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Jeff King <peff@peff.net> writes:
>>
>>> 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.
>>
>> Yeah, I think that is sensible. It may even be OK to just give a
>> "log --oneline".
>
> Or maybe we could let the user configure the diff options or even the
> command used when the first bad commit is found?

That is a separate discussion.  I do not mind but I doubt many
people would use it (I was tempted to say "doubt anybody would", but
then was reminded how many people use Git, and toned it down), as
long as we have a good default.  And I thought that this discussion
was about coming up with a good-enough default.

To be bluntly honest, I think the current one is sufficient as a
good-enough default.  The first thing I would do after seeing that
message is to either "git checkout <commit-object-name>" or "git
show <commit-object-name>", and the current full 40-hex output gives
me an easier mouse-double-click target than the proposed abbreviated
one, so in that sense the original proposal may even be a usability
regression.

It is tempting to say that the output can be eliminated by always
checking out the first-bad-commit (i.e. only when the last answer
that led to the first-bad decision was "good", do a "git checkout"
of that bad commit), but in a project where a branch switching is
not instantaneous, that might be problematic (unless the first step
the user would have done is to check it out anyway, of course).

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  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
  1 sibling, 1 reply; 17+ messages in thread
From: Trevor Saunders @ 2015-05-11 18:17 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Christian Couder, Jeff King, Stefan Beller, git

On Mon, May 11, 2015 at 09:54:15AM -0700, Junio C Hamano wrote:
> Christian Couder <christian.couder@gmail.com> writes:
> 
> > On Mon, May 11, 2015 at 6:33 AM, Junio C Hamano <gitster@pobox.com> wrote:
> >> Jeff King <peff@peff.net> writes:
> >>
> >>> 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.
> >>
> >> Yeah, I think that is sensible. It may even be OK to just give a
> >> "log --oneline".
> >
> > Or maybe we could let the user configure the diff options or even the
> > command used when the first bad commit is found?
> 
> That is a separate discussion.  I do not mind but I doubt many
> people would use it (I was tempted to say "doubt anybody would", but
> then was reminded how many people use Git, and toned it down), as
> long as we have a good default.  And I thought that this discussion
> was about coming up with a good-enough default.

agreed

> To be bluntly honest, I think the current one is sufficient as a
> good-enough default.  The first thing I would do after seeing that
> message is to either "git checkout <commit-object-name>" or "git
> show <commit-object-name>", and the current full 40-hex output gives
> me an easier mouse-double-click target than the proposed abbreviated
> one, so in that sense the original proposal may even be a usability
> regression.

I think printing the full 40 chars once is reasonable, but twice in 2
lines seems a bit excessive.  I was thinking of changing the format to
be

the first bad commit is
$(git log -1 <bad sha1>)

> It is tempting to say that the output can be eliminated by always
> checking out the first-bad-commit (i.e. only when the last answer
> that led to the first-bad decision was "good", do a "git checkout"
> of that bad commit), but in a project where a branch switching is
> not instantaneous, that might be problematic (unless the first step
> the user would have done is to check it out anyway, of course).

Well,  if you just finished bisecting you are probably on a commit close
to the first bad one so it probably will be fast.  However I don't
really like that idea because what I generally want to do is read the
patch so having the hash printed so I can copy it and run git show -p
$hash or something is nice.  Though I guess if the first bad commit is
checked out you can just skip the copy paste and use HEAD.

Trev

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-11 18:17                 ` Trevor Saunders
@ 2015-05-11 18:28                   ` Stefan Beller
  0 siblings, 0 replies; 17+ messages in thread
From: Stefan Beller @ 2015-05-11 18:28 UTC (permalink / raw)
  To: Trevor Saunders; +Cc: Junio C Hamano, Christian Couder, Jeff King, git

On Mon, May 11, 2015 at 11:17 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> On Mon, May 11, 2015 at 09:54:15AM -0700, Junio C Hamano wrote:
>> Christian Couder <christian.couder@gmail.com> writes:
>>
>> > On Mon, May 11, 2015 at 6:33 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> >> Jeff King <peff@peff.net> writes:
>> >>
>> >>> 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.
>> >>
>> >> Yeah, I think that is sensible. It may even be OK to just give a
>> >> "log --oneline".
>> >
>> > Or maybe we could let the user configure the diff options or even the
>> > command used when the first bad commit is found?
>>
>> That is a separate discussion.  I do not mind but I doubt many
>> people would use it (I was tempted to say "doubt anybody would", but
>> then was reminded how many people use Git, and toned it down), as
>> long as we have a good default.  And I thought that this discussion
>> was about coming up with a good-enough default.
>
> agreed
>
>> To be bluntly honest, I think the current one is sufficient as a
>> good-enough default.  The first thing I would do after seeing that
>> message is to either "git checkout <commit-object-name>" or "git
>> show <commit-object-name>", and the current full 40-hex output gives
>> me an easier mouse-double-click target than the proposed abbreviated
>> one, so in that sense the original proposal may even be a usability
>> regression.
>
> I think printing the full 40 chars once is reasonable, but twice in 2
> lines seems a bit excessive.  I was thinking of changing the format to
> be
>
> the first bad commit is
> $(git log -1 <bad sha1>)
>
>> It is tempting to say that the output can be eliminated by always
>> checking out the first-bad-commit (i.e. only when the last answer
>> that led to the first-bad decision was "good", do a "git checkout"
>> of that bad commit), but in a project where a branch switching is
>> not instantaneous, that might be problematic (unless the first step
>> the user would have done is to check it out anyway, of course).
>
> Well,  if you just finished bisecting you are probably on a commit close
> to the first bad one so it probably will be fast.  However I don't
> really like that idea because what I generally want to do is read the
> patch so having the hash printed so I can copy it and run git show -p
> $hash or something is nice.  Though I guess if the first bad commit is
> checked out you can just skip the copy paste and use HEAD.

Only if you are operating within your local repository only. If you want
to check a build bot or another database for continuous builds or anything
outside your local repository you need the hash and not HEAD.
So I'd think

    the first bad commit is
    $(git log -1 <bad sha1>)

is fine.

>
> Trev
>

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-11 16:54               ` Junio C Hamano
  2015-05-11 18:17                 ` Trevor Saunders
@ 2015-05-12  9:21                 ` Christian Couder
  2015-05-12 17:11                   ` Junio C Hamano
  1 sibling, 1 reply; 17+ messages in thread
From: Christian Couder @ 2015-05-12  9:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, Trevor Saunders, Stefan Beller, git

On Mon, May 11, 2015 at 6:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Christian Couder <christian.couder@gmail.com> writes:
>
>> On Mon, May 11, 2015 at 6:33 AM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Jeff King <peff@peff.net> writes:
>>>
>>>> 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.
>>>
>>> Yeah, I think that is sensible. It may even be OK to just give a
>>> "log --oneline".
>>
>> Or maybe we could let the user configure the diff options or even the
>> command used when the first bad commit is found?
>
> That is a separate discussion.  I do not mind but I doubt many
> people would use it (I was tempted to say "doubt anybody would", but
> then was reminded how many people use Git, and toned it down), as
> long as we have a good default.  And I thought that this discussion
> was about coming up with a good-enough default.
>
> To be bluntly honest, I think the current one is sufficient as a
> good-enough default.  The first thing I would do after seeing that
> message is to either "git checkout <commit-object-name>" or "git
> show <commit-object-name>", and the current full 40-hex output gives
> me an easier mouse-double-click target than the proposed abbreviated
> one, so in that sense the original proposal may even be a usability
> regression.

Yeah, it might also be a regression if some users have scripts that
depend on the current behavior. That's why with a config option,
people annoyed by the current behavior can get exactly what they want,
and it makes it possible to more safely change the default to
something more user friendly the next time we change the major version
number.

> It is tempting to say that the output can be eliminated by always
> checking out the first-bad-commit (i.e. only when the last answer
> that led to the first-bad decision was "good", do a "git checkout"
> of that bad commit), but in a project where a branch switching is
> not instantaneous, that might be problematic (unless the first step
> the user would have done is to check it out anyway, of course).

Yeah, and speaking of regressions, elimiting the output might be a
more serious regression.

Best,
Christian.

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-12  9:21                 ` Christian Couder
@ 2015-05-12 17:11                   ` Junio C Hamano
  2015-05-12 20:43                     ` Christian Couder
  0 siblings, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2015-05-12 17:11 UTC (permalink / raw)
  To: Christian Couder; +Cc: Jeff King, Trevor Saunders, Stefan Beller, git

Christian Couder <christian.couder@gmail.com> writes:

> On Mon, May 11, 2015 at 6:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
>> To be bluntly honest, I think the current one is sufficient as a
>> good-enough default.  The first thing I would do after seeing that
>> message is to either "git checkout <commit-object-name>" or "git
>> show <commit-object-name>", and the current full 40-hex output gives
>> me an easier mouse-double-click target than the proposed abbreviated
>> one, so in that sense the original proposal may even be a usability
>> regression.
>
> Yeah, it might also be a regression if some users have scripts that
> depend on the current behavior.
> ...
>> It is tempting to say that the output can be eliminated by always
>> checking out the first-bad-commit (i.e. only when the last answer
>> that led to the first-bad decision was "good", do a "git checkout"
>> of that bad commit), but in a project where a branch switching is
>> not instantaneous, that might be problematic (unless the first step
>> the user would have done is to check it out anyway, of course).
>
> Yeah, and speaking of regressions, elimiting the output might be a
> more serious regression.

I am getting somewhat annoyed by this line of thought.

Who said bisect output is meant to be parseable and be read by
scripts in the first place?  If that were the case, we wouldn't be
having this discussion thread in the first place.

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-12 17:11                   ` Junio C Hamano
@ 2015-05-12 20:43                     ` Christian Couder
  2015-05-12 20:58                       ` Stefan Beller
  0 siblings, 1 reply; 17+ messages in thread
From: Christian Couder @ 2015-05-12 20:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, Trevor Saunders, Stefan Beller, git

On Tue, May 12, 2015 at 7:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Christian Couder <christian.couder@gmail.com> writes:
>
>> On Mon, May 11, 2015 at 6:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>
>>> To be bluntly honest, I think the current one is sufficient as a
>>> good-enough default.  The first thing I would do after seeing that
>>> message is to either "git checkout <commit-object-name>" or "git
>>> show <commit-object-name>", and the current full 40-hex output gives
>>> me an easier mouse-double-click target than the proposed abbreviated
>>> one, so in that sense the original proposal may even be a usability
>>> regression.
>>
>> Yeah, it might also be a regression if some users have scripts that
>> depend on the current behavior.
>> ...
>>> It is tempting to say that the output can be eliminated by always
>>> checking out the first-bad-commit (i.e. only when the last answer
>>> that led to the first-bad decision was "good", do a "git checkout"
>>> of that bad commit), but in a project where a branch switching is
>>> not instantaneous, that might be problematic (unless the first step
>>> the user would have done is to check it out anyway, of course).
>>
>> Yeah, and speaking of regressions, elimiting the output might be a
>> more serious regression.
>
> I am getting somewhat annoyed by this line of thought.
>
> Who said bisect output is meant to be parseable and be read by
> scripts in the first place?  If that were the case, we wouldn't be
> having this discussion thread in the first place.

Well "git bisect run" is all about automating bisecting and we know
that some people have been using it for a long time.

See for example this message from 2007:

http://lkml.iu.edu/hypermail/linux/kernel/0711.1/1443.html

where there is:

"Today we can autonomouly
bisect build bugs via a simple shell command around "git-bisect run",
without any human interaction!"

So it is reasonnable to wonder if some scripts might be parsing
the output.

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-12 20:43                     ` Christian Couder
@ 2015-05-12 20:58                       ` Stefan Beller
  2015-05-12 23:40                         ` Trevor Saunders
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Beller @ 2015-05-12 20:58 UTC (permalink / raw)
  To: Christian Couder; +Cc: Junio C Hamano, Jeff King, Trevor Saunders, git

On Tue, May 12, 2015 at 1:43 PM, Christian Couder
<christian.couder@gmail.com> wrote:
> On Tue, May 12, 2015 at 7:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Christian Couder <christian.couder@gmail.com> writes:
>>
>>> On Mon, May 11, 2015 at 6:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>>
>>>> To be bluntly honest, I think the current one is sufficient as a
>>>> good-enough default.  The first thing I would do after seeing that
>>>> message is to either "git checkout <commit-object-name>" or "git
>>>> show <commit-object-name>", and the current full 40-hex output gives
>>>> me an easier mouse-double-click target than the proposed abbreviated
>>>> one, so in that sense the original proposal may even be a usability
>>>> regression.
>>>
>>> Yeah, it might also be a regression if some users have scripts that
>>> depend on the current behavior.
>>> ...
>>>> It is tempting to say that the output can be eliminated by always
>>>> checking out the first-bad-commit (i.e. only when the last answer
>>>> that led to the first-bad decision was "good", do a "git checkout"
>>>> of that bad commit), but in a project where a branch switching is
>>>> not instantaneous, that might be problematic (unless the first step
>>>> the user would have done is to check it out anyway, of course).
>>>
>>> Yeah, and speaking of regressions, elimiting the output might be a
>>> more serious regression.
>>
>> I am getting somewhat annoyed by this line of thought.
>>
>> Who said bisect output is meant to be parseable and be read by
>> scripts in the first place?  If that were the case, we wouldn't be
>> having this discussion thread in the first place.
>
> Well "git bisect run" is all about automating bisecting and we know
> that some people have been using it for a long time.
>
> See for example this message from 2007:
>
> http://lkml.iu.edu/hypermail/linux/kernel/0711.1/1443.html
>
> where there is:
>
> "Today we can autonomouly
> bisect build bugs via a simple shell command around "git-bisect run",
> without any human interaction!"
>
> So it is reasonnable to wonder if some scripts might be parsing
> the output.

This reasoning sounds to me, that the lack of a plumbing counterpart
to bisect(porcelain) made it a de facto plumbing command,
which is unfortunate for discussing changes like these.

So how to proceed here?
* one way would be to ignore the scripts out there, "because it's
  porcelain, so nobody sane would have written a script using it anyway"
  but this attitude is not well perceived in the community I'd assume.
* declare the current bisect command a plumbing layer command and
  introduce a new porcelain command, how about "git find" which can address
  a variety of issues such as also having the capability to find a fix
instead of
  just regressions (make good/bad markers less confusing)
  Depending on the implementation this may be a lot of work
  -> copy/paste is fast and involves less work now, but more in the future
  -> or having a new plumbing-bisect header making calls from the porcelain
      to the plumbing bisect tool.

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-12 20:58                       ` Stefan Beller
@ 2015-05-12 23:40                         ` Trevor Saunders
  2015-05-13 13:24                           ` Christian Couder
  0 siblings, 1 reply; 17+ messages in thread
From: Trevor Saunders @ 2015-05-12 23:40 UTC (permalink / raw)
  To: Stefan Beller; +Cc: Christian Couder, Junio C Hamano, Jeff King, git

On Tue, May 12, 2015 at 01:58:56PM -0700, Stefan Beller wrote:
> On Tue, May 12, 2015 at 1:43 PM, Christian Couder
> <christian.couder@gmail.com> wrote:
> > On Tue, May 12, 2015 at 7:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
> >> Christian Couder <christian.couder@gmail.com> writes:
> >>
> >>> On Mon, May 11, 2015 at 6:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
> >>>
> >>>> To be bluntly honest, I think the current one is sufficient as a
> >>>> good-enough default.  The first thing I would do after seeing that
> >>>> message is to either "git checkout <commit-object-name>" or "git
> >>>> show <commit-object-name>", and the current full 40-hex output gives
> >>>> me an easier mouse-double-click target than the proposed abbreviated
> >>>> one, so in that sense the original proposal may even be a usability
> >>>> regression.
> >>>
> >>> Yeah, it might also be a regression if some users have scripts that
> >>> depend on the current behavior.
> >>> ...
> >>>> It is tempting to say that the output can be eliminated by always
> >>>> checking out the first-bad-commit (i.e. only when the last answer
> >>>> that led to the first-bad decision was "good", do a "git checkout"
> >>>> of that bad commit), but in a project where a branch switching is
> >>>> not instantaneous, that might be problematic (unless the first step
> >>>> the user would have done is to check it out anyway, of course).
> >>>
> >>> Yeah, and speaking of regressions, elimiting the output might be a
> >>> more serious regression.
> >>
> >> I am getting somewhat annoyed by this line of thought.
> >>
> >> Who said bisect output is meant to be parseable and be read by
> >> scripts in the first place?  If that were the case, we wouldn't be
> >> having this discussion thread in the first place.
> >
> > Well "git bisect run" is all about automating bisecting and we know
> > that some people have been using it for a long time.
> >
> > See for example this message from 2007:
> >
> > http://lkml.iu.edu/hypermail/linux/kernel/0711.1/1443.html
> >
> > where there is:
> >
> > "Today we can autonomouly
> > bisect build bugs via a simple shell command around "git-bisect run",
> > without any human interaction!"
> >
> > So it is reasonnable to wonder if some scripts might be parsing
> > the output.
> 
> This reasoning sounds to me, that the lack of a plumbing counterpart
> to bisect(porcelain) made it a de facto plumbing command,
> which is unfortunate for discussing changes like these.
> 
> So how to proceed here?
> * one way would be to ignore the scripts out there, "because it's
>   porcelain, so nobody sane would have written a script using it anyway"
>   but this attitude is not well perceived in the community I'd assume.

honestly in this case I'd be inclined to go that route since the output
isn't really great for parsing so I do find it hard to believe there is
a reasonable number of scripts that use git bisect, and depend on its
output.

> * declare the current bisect command a plumbing layer command and
>   introduce a new porcelain command, how about "git find" which can address
>   a variety of issues such as also having the capability to find a fix
> instead of
>   just regressions (make good/bad markers less confusing)

Solving that issue would be nice, but I think git find is much less
intuitive to new people than bisect, but I'm not really a good judge of
that.

>   Depending on the implementation this may be a lot of work
>   -> copy/paste is fast and involves less work now, but more in the future
>   -> or having a new plumbing-bisect header making calls from the porcelain
>       to the plumbing bisect tool.

my sense is that the division between git-bisect.sh and bisect--helper.c
isn't really great and could already use refactoring so I suspect it'd
be a fair amount of work.

Trev

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

* Re: [PATCH] bisect: print abbrev sha1 for first bad commit
  2015-05-12 23:40                         ` Trevor Saunders
@ 2015-05-13 13:24                           ` Christian Couder
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Couder @ 2015-05-13 13:24 UTC (permalink / raw)
  To: Trevor Saunders; +Cc: Stefan Beller, Junio C Hamano, Jeff King, git

On Wed, May 13, 2015 at 1:40 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
>
> my sense is that the division between git-bisect.sh and bisect--helper.c
> isn't really great and could already use refactoring so I suspect it'd
> be a fair amount of work.

About the division between git-bisect.sh and bisect--helper.c, yeah I
started converting git-bisect.sh into C code, but haven't finished
that.

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

end of thread, other threads:[~2015-05-13 13:24 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.