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 <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Paul Mackerras <paulus@samba.org>

Jens Lehmann committed Apr 8, 2014 at 21:36 UTC 17f9836c8afc8d4b6d6bb91fd0658df090d75c8f
1 file changed +10 -3
gitk
+10 -3
@@ -5206,11 +5206,15 @@ proc dohidelocalchanges {} {
5206 # spawn off a process to do git diff-index --cached HEAD
5207 proc dodiffindex {} {
5208 global lserial showlocalchanges vfilelimit curview
5209 - global hasworktree
5209 + global hasworktree git_version
5210
5211 if {!$showlocalchanges || !$hasworktree} return
5212 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 + }
5218 if {$vfilelimit($curview) ne {}} {
5219 set cmd [concat $cmd -- $vfilelimit($curview)]
5220 }
@@ -7710,7 +7714,7 @@ proc addtocflist {ids} {
7714 }
7715
7716 proc diffcmd {ids flags} {
7713 - global log_showroot nullid nullid2
7717 + global log_showroot nullid nullid2 git_version
7718
7719 set i [lsearch -exact $ids $nullid]
7720 set j [lsearch -exact $ids $nullid2]
@@ -7731,6 +7735,9 @@ proc diffcmd {ids flags} {
7735 }
7736 }
7737 } elseif {$j >= 0} {
7738 + if {[package vcompare $git_version "1.7.2"] >= 0} {
7739 + set flags "$flags --ignore-submodules=dirty"
7740 + }
7741 set cmd [concat | git diff-index --cached $flags]
7742 if {[llength $ids] > 1} {
7743 # comparing index with specific revision