diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-01-23 11:03:36 +0100 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-01-23 15:14:04 -0800 |
commit | 87cd09f43e56de5235d09aef3ff5d840419fef49 (patch) | |
tree | c2707c97a5987af4cc8074649d533b8d189e37ce | |
parent | 390425bdef450a0eb246552f94ca88a05dc11d06 (diff) | |
download | git-87cd09f43e56de5235d09aef3ff5d840419fef49.tar.gz git-87cd09f43e56de5235d09aef3ff5d840419fef49.tar.xz |
git-gui: work from the .git dir
When git-gui is run from a .git dir, _gitdir would be set to "." by
rev-parse, something that confuses the worktree detection.
Fix by expanding the value of _gitdir to pwd in this special case.
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rwxr-xr-x | git-gui.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/git-gui.sh b/git-gui.sh index e3473a81a..1fb3cbfc7 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1074,6 +1074,8 @@ if {[catch { set _prefix {} }] && [catch { + # beware that from the .git dir this sets _gitdir to . + # and _prefix to the empty string set _gitdir [git rev-parse --git-dir] set _prefix [git rev-parse --show-prefix] } err]} { @@ -1082,6 +1084,14 @@ if {[catch { choose_repository::pick set picked 1 } + +# we expand the _gitdir when it's just a single dot (i.e. when we're being +# run from the .git dir itself) lest the routines to find the worktree +# get confused +if {$_gitdir eq "."} { + set _gitdir [pwd] +} + if {![file isdirectory $_gitdir] && [is_Cygwin]} { catch {set _gitdir [exec cygpath --windows $_gitdir]} } |