Skip to content

Commit e0db1dd

Browse files
jlehmannpatthoyts
authored andcommitted
git-gui: 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 git-gui. 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 "Staged Changes (Will Commit)". 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: Pat Thoyts <[email protected]>
1 parent 1b2c79e commit e0db1dd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

git-gui.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,11 @@ proc rescan_stage2 {fd after} {
15581558
15591559
set rescan_active 2
15601560
ui_status [mc "Scanning for modified files ..."]
1561-
set fd_di [git_read diff-index --cached -z [PARENT]]
1561+
if {[git-version >= "1.7.2"]} {
1562+
set fd_di [git_read diff-index --cached --ignore-submodules=dirty -z [PARENT]]
1563+
} else {
1564+
set fd_di [git_read diff-index --cached -z [PARENT]]
1565+
}
15621566
set fd_df [git_read diff-files -z]
15631567
15641568
fconfigure $fd_di -blocking 0 -translation binary -encoding binary

lib/diff.tcl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ proc start_show_diff {cont_info {add_opts {}}} {
287287
if {$w eq $ui_index} {
288288
lappend cmd diff-index
289289
lappend cmd --cached
290+
if {[git-version >= "1.7.2"]} {
291+
lappend cmd --ignore-submodules=dirty
292+
}
290293
} elseif {$w eq $ui_workdir} {
291294
if {[string first {U} $m] >= 0} {
292295
lappend cmd diff

0 commit comments

Comments
 (0)