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

[PATCH ] "git bisect visualize" results in an invalid error if "gitk" is not installed

From
MJMaxin john <maxin@maxinbjohn.info>
Date
Mar 20, 2011, 21:10 UTC
Message-ID
<AANLkTi=HJjqrvv-PFO3VjhrHzBsLZmAbN0yU47WScWd_@mail.gmail.com>
Hi,

While using "git bisect visualize" on my PC running Ubuntu 10.10, I came across this error:

$ git bisect visualize eval: 1: gitk: not found git: 'bisect' is not a git command. See 'git --help'.

Did you mean this?
	bisect
$

As this distribution don't keep "gitk" as a dependency for git,we will have to install "gitk" as a separate package. However, I found the error message a bit confusing. So,I have prepared a "quick and dirty" patch to solve it. Please let me know your comments.

Signed-off-by: Maxin B. John <maxin@maxinbjohn.info>
---
diff --git a/git-bisect.sh b/git-bisect.sh
index c21e33c..fefe212 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -290,7 +290,8 @@ bisect_visualize() {
        then
                case
"${DISPLAY+set}${SESSIONNAME+set}${MSYSTEM+set}${SECURITYSESSIONID+set}"
in
                '')     set git log ;;
-               set*)   set gitk ;;
+               set*)   is_gitk_present
+                       set gitk ;;
                esac
        else
                case "$1" in
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index aa16b83..5e78b54 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -132,6 +132,14 @@ is_bare_repository () {
        git rev-parse --is-bare-repository
 }

+is_gitk_present () {
+       GIT_GITK=$(which gitk)
+       test -n "$GIT_GITK" || {
+               echo >&2 "Cannot find 'gitk' in the PATH"
+               exit 1
+       }
+}
+
 cd_to_toplevel () {
        cdup=$(git rev-parse --show-toplevel) &&
        cd "$cdup" || {
Next: Jeff King
Message 1 of 4 in “"git bisect visualize" results in an invalid error if "gitk" is not installed”
  1. "git bisect visualize" results in an invalid error if "gitk" is not installedMaxin john, Mar 20, 2011
  2. Jeff KingMar 21, 2011
  3. Maxin johnMar 21, 2011
  4. bisect: visualize with git-log if gitk is unavailableJeff King, Mar 21, 2011

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.