@@ -1223,6 +1223,12 @@ set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
1223
1223
if {![ info exists env(SSH_ASKPASS)] } {
1224
1224
set env(SSH_ASKPASS) [ gitexec git-gui--askpass]
1225
1225
}
1226
+ if {![ info exists env(GIT_ASKPASS)] } {
1227
+ set env(GIT_ASKPASS) [ gitexec git-gui--askpass]
1228
+ }
1229
+ if {![ info exists env(GIT_ASK_YESNO)] } {
1230
+ set env(GIT_ASK_YESNO) [ gitexec git-gui--askyesno]
1231
+ }
1226
1232
1227
1233
######################################################################
1228
1234
##
@@ -1319,9 +1325,6 @@ if {[lindex $_reponame end] eq {.git}} {
1319
1325
set _reponame [ lindex $_reponame end]
1320
1326
}
1321
1327
1322
- set env(GIT_DIR) $_gitdir
1323
- set env(GIT_WORK_TREE) $_gitworktree
1324
-
1325
1328
######################################################################
1326
1329
##
1327
1330
## global init
@@ -2141,7 +2144,7 @@ set starting_gitk_msg [mc "Starting gitk... please wait..."]
2141
2144
2142
2145
proc do_gitk {revs {is_submodule false}} {
2143
2146
global current_diff_path file_states current_diff_side ui_index
2144
- global _gitdir _gitworktree
2147
+ global _gitworktree
2145
2148
2146
2149
# -- Always start gitk through whatever we were loaded with. This
2147
2150
# lets us bypass using shell process on Windows systems.
@@ -2153,12 +2156,19 @@ proc do_gitk {revs {is_submodule false}} {
2153
2156
} else {
2154
2157
global env
2155
2158
2159
+ if {[ info exists env(GIT_DIR)] } {
2160
+ set old_GIT_DIR $env(GIT_DIR)
2161
+ } else {
2162
+ set old_GIT_DIR {}
2163
+ }
2164
+
2156
2165
set pwd [ pwd ]
2157
2166
2158
2167
if {!$is_submodule } {
2159
2168
if {![ is_bare] } {
2160
2169
cd $_gitworktree
2161
2170
}
2171
+ set env(GIT_DIR) [ file normalize [gitdir] ]
2162
2172
} else {
2163
2173
cd $current_diff_path
2164
2174
if {$revs eq {--}} {
@@ -2179,18 +2189,15 @@ proc do_gitk {revs {is_submodule false}} {
2179
2189
}
2180
2190
set revs $old_sha1 ...$new_sha1
2181
2191
}
2182
- # GIT_DIR and GIT_WORK_TREE for the submodule are not the ones
2183
- # we've been using for the main repository, so unset them.
2184
- # TODO we could make life easier (start up faster?) for gitk
2185
- # by setting these to the appropriate values to allow gitk
2186
- # to skip the heuristics to find their proper value
2187
- unset env(GIT_DIR)
2188
- unset env(GIT_WORK_TREE)
2192
+ if {[ info exists env(GIT_DIR)] } {
2193
+ unset env(GIT_DIR)
2194
+ }
2189
2195
}
2190
2196
eval exec $cmd $revs " --" " --" &
2191
2197
2192
- set env(GIT_DIR) $_gitdir
2193
- set env(GIT_WORK_TREE) $_gitworktree
2198
+ if {$old_GIT_DIR ne {}} {
2199
+ set env(GIT_DIR) $old_GIT_DIR
2200
+ }
2194
2201
cd $pwd
2195
2202
2196
2203
ui_status $::starting_gitk_msg
@@ -2211,20 +2218,22 @@ proc do_git_gui {} {
2211
2218
error_popup [ mc " Couldn't find git gui in PATH" ]
2212
2219
} else {
2213
2220
global env
2214
- global _gitdir _gitworktree
2215
2221
2216
- # see note in do_gitk about unsetting these vars when
2217
- # running tools in a submodule
2218
- unset env(GIT_DIR)
2219
- unset env(GIT_WORK_TREE)
2222
+ if {[ info exists env(GIT_DIR)] } {
2223
+ set old_GIT_DIR $env(GIT_DIR)
2224
+ unset env(GIT_DIR)
2225
+ } else {
2226
+ set old_GIT_DIR {}
2227
+ }
2220
2228
2221
2229
set pwd [ pwd ]
2222
2230
cd $current_diff_path
2223
2231
2224
2232
eval exec $exe gui &
2225
2233
2226
- set env(GIT_DIR) $_gitdir
2227
- set env(GIT_WORK_TREE) $_gitworktree
2234
+ if {$old_GIT_DIR ne {}} {
2235
+ set env(GIT_DIR) $old_GIT_DIR
2236
+ }
2228
2237
cd $pwd
2229
2238
2230
2239
ui_status $::starting_gitk_msg
0 commit comments