Code

[PATCH] gitk: Show an error and exit if no .git could be found
authorAlex Riesen <raa.lkml@gmail.com>
Sun, 29 Jul 2007 20:29:45 +0000 (22:29 +0200)
committerPaul Mackerras <paulus@samba.org>
Sun, 12 Aug 2007 07:30:57 +0000 (17:30 +1000)
This is to help people starting gitk from graphical file managers where
the stderr output is hidden.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk

diff --git a/gitk b/gitk
index b0a76dd225bc453ce177ce81bfe7216588ca80dd..769c79ab07520d5bcdad9493ab383553d2031988 100755 (executable)
--- a/gitk
+++ b/gitk
@@ -7636,7 +7636,10 @@ catch {source ~/.gitk}
 font create optionfont -family sans-serif -size -12
 
 # check that we can find a .git directory somewhere...
-set gitdir [gitdir]
+if {[catch {set gitdir [gitdir]}]} {
+    show_error {} . "Cannot find a git repository here."
+    exit 1
+}
 if {![file isdirectory $gitdir]} {
     show_error {} . "Cannot find the git directory \"$gitdir\"."
     exit 1