[PATCH] more meaningful error message in gitk when git binary is not available

Subsystems: the rest

DORMANTno replies

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

[PATCH] more meaningful error message in gitk when git binary is not available

From: Josef Assad <hidden>
Date: 2016-06-15 22:54:54

Hi. I ran across what is a decidedly trivial little issue in gitk. The
TCL/Tk looked simple enough so I am giving you a patch anyhow in case
you want to fix it.

When for whatever reason the git binary is unavailable, gitk would
complain about missing git repository instead, so this patch adds a
check for git binary availability.

In case anyone is curious, I found this issue here:

http://stackoverflow.com/q/11967110/53936



Signed-off-by: Josef Assad <redacted>
---
 gitk-git/gitk |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index d93bd99..7e2e0a7 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -11680,6 +11680,12 @@ setui $uicolor

 setoptions

+# check that the git executables are available for use
+if [catch {set gitexists [exec which git]}] {
+    show_error {} . [mc "Cannot find a suitable git executable."]
+    exit 1
+}
+
 # check that we can find a .git directory somewhere...
 if {[catch {set gitdir [exec git rev-parse --git-dir]}]} {
     show_error {} . [mc "Cannot find a git repository here."]
-- 
1.7.5.4

Re: [PATCH] more meaningful error message in gitk when git binary is not available

From: Joachim Schmitz <hidden>
Date: 2016-06-15 22:54:54

Josef Assad wrote:
quoted hunk
Hi. I ran across what is a decidedly trivial little issue in gitk. The
TCL/Tk looked simple enough so I am giving you a patch anyhow in case
you want to fix it.

When for whatever reason the git binary is unavailable, gitk would
complain about missing git repository instead, so this patch adds a
check for git binary availability.

In case anyone is curious, I found this issue here:

http://stackoverflow.com/q/11967110/53936



Signed-off-by: Josef Assad <redacted>
---
gitk-git/gitk |    6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index d93bd99..7e2e0a7 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -11680,6 +11680,12 @@ setui $uicolor
setoptions

+# check that the git executables are available for use
+if [catch {set gitexists [exec which git]}] {
I believe 'which' is not portable, you could use 'type' instead.
+    show_error {} . [mc "Cannot find a suitable git executable."]
+    exit 1
+}
+
# check that we can find a .git directory somewhere...
if {[catch {set gitdir [exec git rev-parse --git-dir]}]} {
    show_error {} . [mc "Cannot find a git repository here."]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help