Skip to content

Commit cb8329a

Browse files
davvidpaulusmack
authored andcommitted
[PATCH] gitk: Don't show local changes when we there is no work tree
Launching gitk on a bare repository or a .git directory would previously show the work tree as having removed all files. We now inhibit showing local changes when gitk is not launched from within a work tree. Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 8809d69 commit cb8329a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gitk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,9 @@ proc readcommit {id} {
403403
proc updatecommits {} {
404404
global viewdata curview phase displayorder ordertok idpending
405405
global children commitrow selectedline thickerline showneartags
406+
global isworktree
407+
408+
set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
406409

407410
if {$phase ne {}} {
408411
stop_rev_list
@@ -2885,8 +2888,9 @@ proc dohidelocalchanges {} {
28852888
# spawn off a process to do git diff-index --cached HEAD
28862889
proc dodiffindex {} {
28872890
global localirow localfrow lserial showlocalchanges
2891+
global isworktree
28882892

2889-
if {!$showlocalchanges} return
2893+
if {!$showlocalchanges || !$isworktree} return
28902894
incr lserial
28912895
set localfrow -1
28922896
set localirow -1
@@ -8698,6 +8702,7 @@ set patchnum 0
86988702
set localirow -1
86998703
set localfrow -1
87008704
set lserial 0
8705+
set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
87018706
setcoords
87028707
makewindow
87038708
# wait for the window to become visible

0 commit comments

Comments
 (0)