@matheusbsbs / matheus-bagliano / commits / c4e4644e17
Fork 0

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 <maxin@maxinbjohn.info> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Mar 21, 2011 at 09:14 UTC c4e4644e17e0fad4a6ffedba22b739cf1b1ac3fc
1 file changed +6 -4
git-bisect.sh
+6 -4
@@ -288,10 +288,12 @@ bisect_visualize() {
288
289 if test $# = 0
290 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
297 else
298 case "$1" in
299 git*|tig) ;;