Skip to content

Commit c4e4644

Browse files
peffgitster
authored andcommitted
bisect: visualize with git-log if gitk is unavailable
If gitk is not available in the PATH, bisect ends up exiting with the shell's 127 error code, confusing the git wrapper into thinking that bisect is not a git command. We already fallback to git-log if there doesn't seem to be a graphical display available. We should do the same if gitk is not available in our PATH at all. This not only fixes the ugly error message, but is a much more sensible default than failing to show the user anything. Reported by Maxin John. Tested-by: Maxin B. John <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d98f24c commit c4e4644

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

git-bisect.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,12 @@ bisect_visualize() {
288288

289289
if test $# = 0
290290
then
291-
case "${DISPLAY+set}${SESSIONNAME+set}${MSYSTEM+set}${SECURITYSESSIONID+set}" in
292-
'') set git log ;;
293-
set*) set gitk ;;
294-
esac
291+
if test -n "${DISPLAY+set}${SESSIONNAME+set}${MSYSTEM+set}${SECURITYSESSIONID+set}" &&
292+
type gitk >/dev/null 2>&1; then
293+
set gitk
294+
else
295+
set git log
296+
fi
295297
else
296298
case "$1" in
297299
git*|tig) ;;

0 commit comments

Comments
 (0)