Skip to content

Commit 17f9836

Browse files
jlehmannpaulusmack
authored andcommitted
gitk: Show staged submodules regardless of ignore config
Currently setting submodule.<name>.ignore and/or diff.ignoreSubmodules to "all" suppresses all output of submodule changes for gitk. This is really confusing, as even when the user chooses to record a new commit for an ignored submodule by adding it manually this change won't show up under "Local changes checked in to index but not committed". Fix that by using the '--ignore-submodules=dirty' option for both callers of "git diff-index --cached" when the underlying git version supports that option. Signed-off-by: Jens Lehmann <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 019e163 commit 17f9836

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

gitk

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5206,11 +5206,15 @@ proc dohidelocalchanges {} {
52065206
# spawn off a process to do git diff-index --cached HEAD
52075207
proc dodiffindex {} {
52085208
global lserial showlocalchanges vfilelimit curview
5209-
global hasworktree
5209+
global hasworktree git_version
52105210

52115211
if {!$showlocalchanges || !$hasworktree} return
52125212
incr lserial
5213-
set cmd "|git diff-index --cached HEAD"
5213+
if {[package vcompare $git_version "1.7.2"] >= 0} {
5214+
set cmd "|git diff-index --cached --ignore-submodules=dirty HEAD"
5215+
} else {
5216+
set cmd "|git diff-index --cached HEAD"
5217+
}
52145218
if {$vfilelimit($curview) ne {}} {
52155219
set cmd [concat $cmd -- $vfilelimit($curview)]
52165220
}
@@ -7710,7 +7714,7 @@ proc addtocflist {ids} {
77107714
}
77117715

77127716
proc diffcmd {ids flags} {
7713-
global log_showroot nullid nullid2
7717+
global log_showroot nullid nullid2 git_version
77147718

77157719
set i [lsearch -exact $ids $nullid]
77167720
set j [lsearch -exact $ids $nullid2]
@@ -7731,6 +7735,9 @@ proc diffcmd {ids flags} {
77317735
}
77327736
}
77337737
} elseif {$j >= 0} {
7738+
if {[package vcompare $git_version "1.7.2"] >= 0} {
7739+
set flags "$flags --ignore-submodules=dirty"
7740+
}
77347741
set cmd [concat | git diff-index --cached $flags]
77357742
if {[llength $ids] > 1} {
77367743
# comparing index with specific revision

0 commit comments

Comments
 (0)