Skip to content

Commit bee3f6b

Browse files
max630dscho
authored andcommitted
git-gui: correctly restore GIT_DIR after invoking gitk
git-gui tries to temporary set GIT_DIR for starting gitk and restore it back after they are started. But in case of GIT_DIR which was not set prior to invocation it is not unset after it. This affects commands which can be later started from that git gui, for example "Git Bash". Fix it. Signed-off-by: Max Kirillov <[email protected]>
1 parent a299d10 commit bee3f6b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

git-gui/git-gui.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,8 +2201,13 @@ proc do_gitk {revs {is_submodule false}} {
22012201
}
22022202
eval exec $cmd $revs "--" "--" &
22032203
2204-
set env(GIT_DIR) $_gitdir
2205-
set env(GIT_WORK_TREE) $_gitworktree
2204+
if {$old_GIT_DIR ne {}} {
2205+
set env(GIT_DIR) $old_GIT_DIR
2206+
set env(GIT_WORK_TREE) $_gitworktree
2207+
} else {
2208+
unset env(GIT_DIR)
2209+
unset env(GIT_WORK_TREE)
2210+
}
22062211
cd $pwd
22072212
22082213
ui_status $::starting_gitk_msg

0 commit comments

Comments
 (0)