git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-gui: fix diff for partially staged submodule changes

From
Jens Lehmann <jens.lehmann@web.de>
Date
Aug 26, 2009, 20:25 UTC
Message-ID
<4A959A2B.9080505@web.de>

When a submodule commit had already been staged and another commit had been checked out inside the submodule, the diff always displayed the submodule commit log messages between the last supermodule commit and the working tree, totally ignoring the commit in the index.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---

This fixes a regression introduced by this recent patch of mine: "git-gui: display summary when showing diff of a submodule"

Sorry for the inconvenience.
 git-gui/lib/diff.tcl |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index ae1ea3a..d593323 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -298,7 +298,12 @@ proc start_show_diff {cont_info {add_opts {}}} {

 	if {[string match {160000 *} [lindex $s 2]]
         || [string match {160000 *} [lindex $s 3]]} {
-		set cmd {submodule summary -- $current_diff_path}
+		set is_submodule_diff 1
+		if {$w eq $ui_index} {
+			set cmd {submodule summary --cached -- $current_diff_path}
+		} else {
+			set cmd {submodule summary --files -- $current_diff_path}
+		}
 	}

 	if {[catch {set fd [eval git_read --nice $cmd]} err]} {
@@ -343,9 +348,6 @@ proc read_diff {fd cont_info} {
 		}
 		set ::current_diff_inheader 0

-		if {[regexp {^\* } $line]} {
-			set is_submodule_diff 1
-		}
 		# -- Automatically detect if this is a 3 way diff.
 		#
 		if {[string match {@@@ *} $line]} {set is_3way_diff 1}
-- 
1.6.4.184.ge7b6.dirty
Message 1 of 1 in “git-gui: fix diff for partially staged submodule changes”
  1. git-gui: fix diff for partially staged submodule changesJens Lehmann, Aug 26, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.