git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitk: show staged submodules regardless of ignore config
@ 2014-04-08 19:36 Jens Lehmann
  2014-04-15 22:34 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Lehmann @ 2014-04-08 19:36 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Git Mailing List

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(-)

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] gitk: show staged submodules regardless of ignore config
@ 2014-06-06 21:08 Junio C Hamano
  2014-06-15  4:57 ` Paul Mackerras
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2014-06-06 21:08 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

From: Jens Lehmann <Jens.Lehmann@web.de>
Date: Tue, 8 Apr 2014 21:36:08 +0200

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>
---

 * Paul, I've been carrying this in my 'pu' but I would prefer
   changes to gitk fed to me through you.  Could you apply this so
   that I can drop my tentative copy?

   Thanks.

 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
-- 
2.0.0-531-gbd04298

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-15  4:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-08 19:36 [PATCH] gitk: show staged submodules regardless of ignore config Jens Lehmann
2014-04-15 22:34 ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2014-06-06 21:08 Junio C Hamano
2014-06-15  4:57 ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).