threads / patch / 36375

patchgitk: show staged submodules regardless of ignore config

Subject: [PATCH] gitk: 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:36 UTC · lore

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>
---
 gitk | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
Show changes to gitk +10 −3
diff --git a/gitk b/gitk
index 90764e8..f6efaa6 100755
--- a/gitk
+++ b/gitk
@@ -5205,11 +5205,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)]
     }
@@ -7705,7 +7709,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]
@@ -7726,6 +7730,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
-- 
1.9.1.492.g8149f6f
Junio C Hamano· Apr 15, 2014, 22:34 UTC · re: Jens Lehmann · lore

Re: [PATCH] gitk: 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 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>
> ---

I'll tentatively queue this on jl/gitk-show-added-submodule-changes and park it on 'pu', but I'd prefer it to come to me through your tree.

I'll be tagging 2.0.0-rc0 later this week; if you have some accumulated changes (I saw that your public repository has an initial vietnamese translation patch that I still do not have), please plan to get them in by the end of next week.

Thanks.
Show 44 quoted lines
>  gitk | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/gitk b/gitk
> index 90764e8..f6efaa6 100755
> --- a/gitk
> +++ b/gitk
> @@ -5205,11 +5205,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)]
>      }
> @@ -7705,7 +7709,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]
> @@ -7726,6 +7730,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

← back to recent threads