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

Re: git-bisect feature suggestion: "git-bisect diff"

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 7, 2007, 10:25 UTC
Message-ID
<7vwsrq3iox.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7v63za4yic.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
> Ingo Molnar <mingo@elte.hu> writes:
>
>> would be nice to have:
>>
>>  git-bisect diff
>>
>> that enables one to have a look at the currently open bisection window, 
>> in git-log -p format. This would often be much faster to analyze than 
>> looking at git-bisect visualize. (and it could also be used in non-GUI 
>> workflows)
>
> Hmm.  It is very unfortunate that "bisect log" is taken for something
> unrelated, so tentatively let's call it lumber.
>
> 	$ git bisect lumber [-p] [--stat]
>
> would give you the short-hand, hopefully.
More seriously...

-- >8 -- git-bisect visualize: work in non-windowed environments better

This teaches "git bisect visualize" to be more useful in non-windowed environments.

 (1) When no option is given, and $DISPLAY is set, it continues to
     spawn gitk as before;
 (2) When no option is given, and $DISPLAY is unset, "git log" is run
     to show the range of commits between the bad one and the good ones;
 (3) If only "-flag" options are given, "git log <options>" is run.
     E.g. "git bisect visualize --stat"
 (4) Otherwise, all of the given options are taken as the initial part
     of the command line and the commit range expression is given to
     that command.  E.g. "git bisect visualize tig" will run "tig"
     history viewer to show between the bad one and the good ones.

As "visualize" is a bit too long to type, we also give it a shorter synonym "view".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-bisect.sh |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/git-bisect.sh b/git-bisect.sh
index 7a6521e..bb6fe84 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -324,8 +324,23 @@ bisect_next() {
 
 bisect_visualize() {
 	bisect_next_check fail
+
+	if test $# = 0
+	then
+		case "${DISPLAY+set}" in
+		'')	set git log ;;
+		set)	set gitk ;;
+		esac
+	else
+		case "$1" in
+		git*|tig) ;;
+		-*)	set git log "$@" ;;
+		*)	set git "$@" ;;
+		esac
+	fi
+
 	not=$(git for-each-ref --format='%(refname)' "refs/bisect/good-*")
-	eval gitk refs/bisect/bad --not $not -- $(cat "$GIT_DIR/BISECT_NAMES")
+	eval '"$@"' refs/bisect/bad --not $not -- $(cat "$GIT_DIR/BISECT_NAMES")
 }
 
 bisect_reset() {
@@ -449,7 +464,7 @@ case "$#" in
     next)
         # Not sure we want "next" at the UI level anymore.
         bisect_next "$@" ;;
-    visualize)
+    visualize|view)
 	bisect_visualize "$@" ;;
     reset)
         bisect_reset "$@" ;;
Previous: Junio C HamanoNext: Ingo Molnar
Message 3 of 36 in “git-bisect feature suggestion: "git-bisect diff"”
  1. Ingo MolnarDec 7, 2007
  2. Junio C HamanoDec 7, 2007
  3. Junio C HamanoDec 7, 2007
  4. Ingo MolnarDec 7, 2007
  5. Junio C HamanoDec 7, 2007
  6. Ingo MolnarDec 7, 2007
  7. Jeff KingDec 7, 2007
  8. Jeff KingDec 7, 2007
  9. Junio C HamanoDec 7, 2007
  10. Jeff KingDec 7, 2007
  11. Junio C HamanoDec 7, 2007
  12. Jeff KingDec 7, 2007
  13. Junio C HamanoDec 8, 2007
  14. Christian CouderDec 8, 2007
  15. Ingo MolnarDec 8, 2007
  16. git-bisect run make -j64 kernel/ (was Re: git-bisect feature suggestion: "git-bisect diff")Christian Couder, Dec 9, 2007
  17. Ingo MolnarDec 12, 2007
  18. Ingo MolnarDec 11, 2007
  19. Pierre HabouzitDec 11, 2007
  20. Jakub NarebskiDec 11, 2007
  21. Pierre HabouzitDec 11, 2007
  22. Jeff KingDec 11, 2007
  23. Jeff KingDec 11, 2007
  24. Ingo MolnarDec 11, 2007
  25. Invert numbers and names in the git-shortlog summary mode.Pierre Habouzit, Dec 11, 2007
  26. Ingo MolnarDec 11, 2007
  27. Pierre HabouzitDec 11, 2007
  28. Nicolas PitreDec 11, 2007
  29. Junio C HamanoDec 11, 2007
  30. Ingo MolnarDec 11, 2007
  31. Pierre HabouzitDec 11, 2007
  32. Pierre HabouzitDec 11, 2007
  33. Ingo MolnarDec 11, 2007
  34. Junio C HamanoDec 11, 2007
  35. Junio C HamanoDec 11, 2007
  36. Ingo MolnarDec 11, 2007

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.