threads / patch / 36374

patchgit-gui: show staged submodules regardless of ignore config

Subject: [PATCH] git-gui: show staged submodules regardless of ignore config

## tl;dr

2 messages between Apr 8, 2014 and Apr 15, 2014. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Jens Lehmann· Apr 8, 2014, 19:30 UTC · lore

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 <Jens.Lehmann@web.de>
---
 git-gui.sh   | 6 +++++-
 lib/diff.tcl | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)
Show changes to 2 files +8 −1

git-gui.sh, lib/diff.tcl

diff --git a/git-gui.sh b/git-gui.sh
index cf2209b..c69bfb3 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1558,7 +1558,11 @@ proc rescan_stage2 {fd after} {

 	set rescan_active 2
 	ui_status [mc "Scanning for modified files ..."]
-	set fd_di [git_read diff-index --cached -z [PARENT]]
+	if {[git-version >= "1.7.2"]} {
+		set fd_di [git_read diff-index --cached --ignore-submodules=dirty -z [PARENT]]
+	} else {
+		set fd_di [git_read diff-index --cached -z [PARENT]]
+	}
 	set fd_df [git_read diff-files -z]

 	fconfigure $fd_di -blocking 0 -translation binary -encoding binary
diff --git a/lib/diff.tcl b/lib/diff.tcl
index 30d9a79..b0a5180 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -287,6 +287,9 @@ proc start_show_diff {cont_info {add_opts {}}} {
 	if {$w eq $ui_index} {
 		lappend cmd diff-index
 		lappend cmd --cached
+		if {[git-version >= "1.7.2"]} {
+			lappend cmd --ignore-submodules=dirty
+		}
 	} elseif {$w eq $ui_workdir} {
 		if {[string first {U} $m] >= 0} {
 			lappend cmd diff
-- 
1.9.1.492.g8149f6f
Junio C Hamano· Apr 15, 2014, 22:32 UTC · re: Jens Lehmann · lore

Re: [PATCH] git-gui: show staged submodules regardless of ignore config

Jens Lehmann <Jens.Lehmann@web.de> writes:
Show 12 quoted lines
> 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 <Jens.Lehmann@web.de>
> ---

I'll tentatively queue this on jl/git-gui-show-added-submodule-changes and park it on 'pu'.

I'll be tagging 2.0.0-rc0 later this week; if you have some accumulated changes (I saw that your public repository is at gitgui-0.19.0 which I already have), please plan to get them in by the end of next week.

Thanks.
Show 35 quoted lines
>  git-gui.sh   | 6 +++++-
>  lib/diff.tcl | 3 +++
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/git-gui.sh b/git-gui.sh
> index cf2209b..c69bfb3 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -1558,7 +1558,11 @@ proc rescan_stage2 {fd after} {
>
>  	set rescan_active 2
>  	ui_status [mc "Scanning for modified files ..."]
> -	set fd_di [git_read diff-index --cached -z [PARENT]]
> +	if {[git-version >= "1.7.2"]} {
> +		set fd_di [git_read diff-index --cached --ignore-submodules=dirty -z [PARENT]]
> +	} else {
> +		set fd_di [git_read diff-index --cached -z [PARENT]]
> +	}
>  	set fd_df [git_read diff-files -z]
>
>  	fconfigure $fd_di -blocking 0 -translation binary -encoding binary
> diff --git a/lib/diff.tcl b/lib/diff.tcl
> index 30d9a79..b0a5180 100644
> --- a/lib/diff.tcl
> +++ b/lib/diff.tcl
> @@ -287,6 +287,9 @@ proc start_show_diff {cont_info {add_opts {}}} {
>  	if {$w eq $ui_index} {
>  		lappend cmd diff-index
>  		lappend cmd --cached
> +		if {[git-version >= "1.7.2"]} {
> +			lappend cmd --ignore-submodules=dirty
> +		}
>  	} elseif {$w eq $ui_workdir} {
>  		if {[string first {U} $m] >= 0} {
>  			lappend cmd diff

← back to recent threads