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

Subsystems: the rest

6 messages, 3 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:57

Junio C Hamano [off-list ref] writes:
Ingo Molnar [off-list ref] writes:
quoted
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 <redacted>
---
 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 "$@" ;;

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

From: Ingo Molnar <hidden>
Date: 2016-06-15 22:43:57

* Junio C Hamano [off-list ref] wrote:
 (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.
nice. One small detail though: i frequently ssh to testboxes that have 
DISPLAY set but i want text output. So git-bisect view --text should be 
a special-case perhaps?

	Ingo

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:57

Ingo Molnar [off-list ref] writes:
... One small detail though: i frequently ssh to testboxes that have 
DISPLAY set but i want text output. So git-bisect view --text should be 
a special-case perhaps?
Yeah, but at that point, wouldn't "git bisect view log" be shorter to
type?

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

From: Ingo Molnar <hidden>
Date: 2016-06-15 22:43:57

* Junio C Hamano [off-list ref] wrote:
Ingo Molnar [off-list ref] writes:
quoted
... One small detail though: i frequently ssh to testboxes that have 
DISPLAY set but i want text output. So git-bisect view --text should be 
a special-case perhaps?
Yeah, but at that point, wouldn't "git bisect view log" be shorter to 
type?
it's also more intuitive. ok :-)

	Ingo

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

From: Jeff King <hidden>
Date: 2016-06-15 22:43:57

On Fri, Dec 07, 2007 at 02:25:34AM -0800, Junio C Hamano wrote:
git-bisect visualize: work in non-windowed environments better
Isn't this more or less the use case for the "git view" alias?
diff --git a/git-bisect.sh b/git-bisect.sh
index 7a6521e..3a21386 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -325,7 +325,7 @@ bisect_next() {
 bisect_visualize() {
 	bisect_next_check fail
 	not=$(git for-each-ref --format='%(refname)' "refs/bisect/good-*")
-	eval gitk refs/bisect/bad --not $not -- $(cat "$GIT_DIR/BISECT_NAMES")
+	eval git view refs/bisect/bad --not $not -- $(cat "$GIT_DIR/BISECT_NAMES")
 }
 
 bisect_reset() {

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

From: Jeff King <hidden>
Date: 2016-06-15 22:43:57

On Fri, Dec 07, 2007 at 04:34:14PM -0500, Jeff King wrote:
On Fri, Dec 07, 2007 at 02:25:34AM -0800, Junio C Hamano wrote:
quoted
git-bisect visualize: work in non-windowed environments better
Isn't this more or less the use case for the "git view" alias?
Which isn't to say that I don't think your solution is nicer; it is. But
if we don't use it here, then perhaps "git view" really is a solution in
search of a problem.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help