aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgitk12
1 files changed, 11 insertions, 1 deletions
diff --git a/gitk b/gitk
index 9ad7bfc7e..b44144870 100755
--- a/gitk
+++ b/gitk
@@ -8,10 +8,20 @@ exec wish "$0" -- "${1+$@}"
# either version 2, or (at your option) any later version.
proc getcommits {rargs} {
- global commits commfd phase canv mainfont
+ global commits commfd phase canv mainfont env
global startmsecs nextupdate
global ctext maincursor textcursor leftover
+ # check that we can find a .git directory somewhere...
+ if {[info exists env(GIT_DIR)]} {
+ set gitdir $env(GIT_DIR)
+ } else {
+ set gitdir ".git"
+ }
+ if {![file isdirectory $gitdir]} {
+ error_popup "Cannot find the git directory \"$gitdir\"."
+ exit 1
+ }
set commits {}
set phase getcommits
set startmsecs [clock clicks -milliseconds]