diff options
author | Paul Mackerras <paulus@samba.org> | 2005-06-27 10:37:11 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-06-27 10:37:11 +1000 |
commit | e2ede2b9f59e1bb95a4a862daf57cb47d97d0d8c (patch) | |
tree | 44d6ab722205eff9052cc4f7a51c0e420d137165 | |
parent | ee3dc72e30a7e9b4eed301bd4fd21b306f811e36 (diff) | |
download | git-e2ede2b9f59e1bb95a4a862daf57cb47d97d0d8c.tar.gz git-e2ede2b9f59e1bb95a4a862daf57cb47d97d0d8c.tar.xz |
Check for the existence of the git directory on startup.
Check that $GIT_DIR (or .git, if GIT_DIR is not set) is a directory.
This means we can give a more informative error message if the user
runs gitk somewhere that isn't a git repository.
-rwxr-xr-x | gitk | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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] |