@@ -1230,6 +1230,12 @@ set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
1230
1230
if {![ info exists env(SSH_ASKPASS)] } {
1231
1231
set env(SSH_ASKPASS) [ gitexec git-gui--askpass]
1232
1232
}
1233
+ if {![ info exists env(GIT_ASKPASS)] } {
1234
+ set env(GIT_ASKPASS) [ gitexec git-gui--askpass]
1235
+ }
1236
+ if {![ info exists env(GIT_ASK_YESNO)] } {
1237
+ set env(GIT_ASK_YESNO) [ gitexec git-gui--askyesno]
1238
+ }
1233
1239
1234
1240
######################################################################
1235
1241
##
@@ -1326,9 +1332,6 @@ if {[lindex $_reponame end] eq {.git}} {
1326
1332
set _reponame [ lindex $_reponame end]
1327
1333
}
1328
1334
1329
- set env(GIT_DIR) $_gitdir
1330
- set env(GIT_WORK_TREE) $_gitworktree
1331
-
1332
1335
######################################################################
1333
1336
##
1334
1337
## global init
@@ -2153,7 +2156,7 @@ set starting_gitk_msg [mc "Starting gitk... please wait..."]
2153
2156
2154
2157
proc do_gitk {revs {is_submodule false}} {
2155
2158
global current_diff_path file_states current_diff_side ui_index
2156
- global _gitdir _gitworktree
2159
+ global _gitworktree
2157
2160
2158
2161
# -- Always start gitk through whatever we were loaded with. This
2159
2162
# lets us bypass using shell process on Windows systems.
@@ -2165,12 +2168,19 @@ proc do_gitk {revs {is_submodule false}} {
2165
2168
} else {
2166
2169
global env
2167
2170
2171
+ if {[ info exists env(GIT_DIR)] } {
2172
+ set old_GIT_DIR $env(GIT_DIR)
2173
+ } else {
2174
+ set old_GIT_DIR {}
2175
+ }
2176
+
2168
2177
set pwd [ pwd ]
2169
2178
2170
2179
if {!$is_submodule } {
2171
2180
if {![ is_bare] } {
2172
2181
cd $_gitworktree
2173
2182
}
2183
+ set env(GIT_DIR) [ file normalize [gitdir] ]
2174
2184
} else {
2175
2185
cd $current_diff_path
2176
2186
if {$revs eq {--}} {
@@ -2191,18 +2201,15 @@ proc do_gitk {revs {is_submodule false}} {
2191
2201
}
2192
2202
set revs $old_sha1 ...$new_sha1
2193
2203
}
2194
- # GIT_DIR and GIT_WORK_TREE for the submodule are not the ones
2195
- # we've been using for the main repository, so unset them.
2196
- # TODO we could make life easier (start up faster?) for gitk
2197
- # by setting these to the appropriate values to allow gitk
2198
- # to skip the heuristics to find their proper value
2199
- unset env(GIT_DIR)
2200
- unset env(GIT_WORK_TREE)
2204
+ if {[ info exists env(GIT_DIR)] } {
2205
+ unset env(GIT_DIR)
2206
+ }
2201
2207
}
2202
2208
eval exec $cmd $revs " --" " --" &
2203
2209
2204
- set env(GIT_DIR) $_gitdir
2205
- set env(GIT_WORK_TREE) $_gitworktree
2210
+ if {$old_GIT_DIR ne {}} {
2211
+ set env(GIT_DIR) $old_GIT_DIR
2212
+ }
2206
2213
cd $pwd
2207
2214
2208
2215
ui_status $::starting_gitk_msg
@@ -2223,20 +2230,22 @@ proc do_git_gui {} {
2223
2230
error_popup [ mc " Couldn't find git gui in PATH" ]
2224
2231
} else {
2225
2232
global env
2226
- global _gitdir _gitworktree
2227
2233
2228
- # see note in do_gitk about unsetting these vars when
2229
- # running tools in a submodule
2230
- unset env(GIT_DIR)
2231
- unset env(GIT_WORK_TREE)
2234
+ if {[ info exists env(GIT_DIR)] } {
2235
+ set old_GIT_DIR $env(GIT_DIR)
2236
+ unset env(GIT_DIR)
2237
+ } else {
2238
+ set old_GIT_DIR {}
2239
+ }
2232
2240
2233
2241
set pwd [ pwd ]
2234
2242
cd $current_diff_path
2235
2243
2236
2244
eval exec $exe gui &
2237
2245
2238
- set env(GIT_DIR) $_gitdir
2239
- set env(GIT_WORK_TREE) $_gitworktree
2246
+ if {$old_GIT_DIR ne {}} {
2247
+ set env(GIT_DIR) $old_GIT_DIR
2248
+ }
2240
2249
cd $pwd
2241
2250
2242
2251
ui_status $::starting_gitk_msg
0 commit comments