{"thread":{"id":"20745","subject":"[PATCH] git-gui: fix diff for partially staged submodule changes","startedAt":"2009-08-26T20:25:15Z","lastAt":"2009-08-26T20:25:15Z","messageCount":1,"participants":["Jens Lehmann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"121821","messageId":"4A959A2B.9080505@web.de","threadId":"20745","inReplyTo":null,"subject":"[PATCH] git-gui: fix diff for partially staged submodule changes","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2009-08-26T20:25:15Z","receivedAt":"2009-08-26T20:25:15Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"When a submodule commit had already been staged and another commit had\nbeen checked out inside the submodule, the diff always displayed the\nsubmodule commit log messages between the last supermodule commit and\nthe working tree, totally ignoring the commit in the index.\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n\nThis fixes a regression introduced by this recent patch of mine:\n\"git-gui: display summary when showing diff of a submodule\"\n\nSorry for the inconvenience.\n\n\n git-gui/lib/diff.tcl |   10 ++++++----\n 1 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex ae1ea3a..d593323 100644\n--- a/git-gui/lib/diff.tcl\n+++ b/git-gui/lib/diff.tcl\n@@ -298,7 +298,12 @@ proc start_show_diff {cont_info {add_opts {}}} {\n\n \tif {[string match {160000 *} [lindex $s 2]]\n         || [string match {160000 *} [lindex $s 3]]} {\n-\t\tset cmd {submodule summary -- $current_diff_path}\n+\t\tset is_submodule_diff 1\n+\t\tif {$w eq $ui_index} {\n+\t\t\tset cmd {submodule summary --cached -- $current_diff_path}\n+\t\t} else {\n+\t\t\tset cmd {submodule summary --files -- $current_diff_path}\n+\t\t}\n \t}\n\n \tif {[catch {set fd [eval git_read --nice $cmd]} err]} {\n@@ -343,9 +348,6 @@ proc read_diff {fd cont_info} {\n \t\t}\n \t\tset ::current_diff_inheader 0\n\n-\t\tif {[regexp {^\\* } $line]} {\n-\t\t\tset is_submodule_diff 1\n-\t\t}\n \t\t# -- Automatically detect if this is a 3 way diff.\n \t\t#\n \t\tif {[string match {@@@ *} $line]} {set is_3way_diff 1}\n-- \n1.6.4.184.ge7b6.dirty\n"}]}