[PATCH] gitk: Show an error and exit if no .git could be found
[gitweb.git] / 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