aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2009-08-26 22:25:15 +0200
committerShawn O. Pearce <spearce@spearce.org>2009-08-26 17:35:16 -0700
commitaf413de47b8b285ffa489df14023180456986c05 (patch)
tree1b32e1ebb3eff2176b6bc543415e1128c6c472cd
parentb350e460daac075a676f6ca449a3b83c9dc37a25 (diff)
downloadgit-af413de47b8b285ffa489df14023180456986c05.tar.gz
git-af413de47b8b285ffa489df14023180456986c05.tar.xz
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>
-rw-r--r--lib/diff.tcl10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/diff.tcl b/lib/diff.tcl
index ae1ea3a61..d593323ae 100644
--- a/lib/diff.tcl
+++ b/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}