Skip to content

Commit

Permalink
Check for the existence of the git directory on startup.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Paul Mackerras committed Jun 27, 2005
1 parent ee3dc72 commit e2ede2b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gitk
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit e2ede2b

Please sign in to comment.