Skip to content

Commit

Permalink
gitk: Show staged submodules regardless of ignore config
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Lehmann authored and Paul Mackerras committed Jun 15, 2014
1 parent 019e163 commit 17f9836
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions gitk
Original file line number Diff line number Diff line change
Expand Up @@ -5206,11 +5206,15 @@ proc dohidelocalchanges {} {
# spawn off a process to do git diff-index --cached HEAD
proc dodiffindex {} {
global lserial showlocalchanges vfilelimit curview
global hasworktree
global hasworktree git_version

if {!$showlocalchanges || !$hasworktree} return
incr lserial
set cmd "|git diff-index --cached HEAD"
if {[package vcompare $git_version "1.7.2"] >= 0} {
set cmd "|git diff-index --cached --ignore-submodules=dirty HEAD"
} else {
set cmd "|git diff-index --cached HEAD"
}
if {$vfilelimit($curview) ne {}} {
set cmd [concat $cmd -- $vfilelimit($curview)]
}
Expand Down Expand Up @@ -7710,7 +7714,7 @@ proc addtocflist {ids} {
}

proc diffcmd {ids flags} {
global log_showroot nullid nullid2
global log_showroot nullid nullid2 git_version

set i [lsearch -exact $ids $nullid]
set j [lsearch -exact $ids $nullid2]
Expand All @@ -7731,6 +7735,9 @@ proc diffcmd {ids flags} {
}
}
} elseif {$j >= 0} {
if {[package vcompare $git_version "1.7.2"] >= 0} {
set flags "$flags --ignore-submodules=dirty"
}
set cmd [concat | git diff-index --cached $flags]
if {[llength $ids] > 1} {
# comparing index with specific revision
Expand Down

0 comments on commit 17f9836

Please sign in to comment.