git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ] "git bisect visualize" results in an invalid error if "gitk" is not installed
@ 2011-03-20 21:10 Maxin john
  2011-03-21 11:29 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Maxin john @ 2011-03-20 21:10 UTC (permalink / raw)
  To: Git Mailing List

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" || {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-21 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-20 21:10 [PATCH ] "git bisect visualize" results in an invalid error if "gitk" is not installed Maxin john
2011-03-21 11:29 ` Jeff King
2011-03-21 12:26   ` Maxin john
2011-03-21 13:14     ` [PATCH] bisect: visualize with git-log if gitk is unavailable Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).