@matheusbsbs / matheus-bagliano / commits / af413de47b
Fork 0

git-gui: fix diff for partially staged submodule changes

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> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Jens Lehmann committed Aug 26, 2009 at 22:25 UTC af413de47b8b285ffa489df14023180456986c05
1 file changed +6 -4
lib/diff.tcl
+6 -4
@@ -298,7 +298,12 @@ proc start_show_diff {cont_info {add_opts {}}} {
298
299 if {[string match {160000 *} [lindex $s 2]]
300 || [string match {160000 *} [lindex $s 3]]} {
301 - set cmd {submodule summary -- $current_diff_path}
301 + set is_submodule_diff 1
302 + if {$w eq $ui_index} {
303 + set cmd {submodule summary --cached -- $current_diff_path}
304 + } else {
305 + set cmd {submodule summary --files -- $current_diff_path}
306 + }
307 }
308
309 if {[catch {set fd [eval git_read --nice $cmd]} err]} {
@@ -343,9 +348,6 @@ proc read_diff {fd cont_info} {
348 }
349 set ::current_diff_inheader 0
350
346 - if {[regexp {^\* } $line]} {
347 - set is_submodule_diff 1
348 - }
351 # -- Automatically detect if this is a 3 way diff.
352 #
353 if {[string match {@@@ *} $line]} {set is_3way_diff 1}