{"thread":{"id":"20182","subject":"[RFC/PATCH RESEND v2] git-gui: display summary when showing diff of a submodule","startedAt":"2009-07-21T17:32:31Z","lastAt":"2009-08-10T15:33:46Z","messageCount":2,"participants":["Jens Lehmann","Shawn O. Pearce"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"118389","messageId":"4A65FBAF.9020603@web.de","threadId":"20182","inReplyTo":null,"subject":"[RFC/PATCH RESEND v2] git-gui: display summary when showing diff of a submodule","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2009-07-21T17:32:31Z","receivedAt":"2009-07-21T17:32:31Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"As it is hard to say what changed in a submodule by looking at the hashes,\nlet's show the colored submodule summary instead.\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n\nI got only one response two weeks ago, so here is a resend.\n\n\n git-gui/git-gui.sh   |    2 +-\n git-gui/lib/diff.tcl |   30 ++++++++++++++++++++++++++++--\n 2 files changed, 29 insertions(+), 3 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 14b92ba..3c0ce26 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -3212,7 +3212,7 @@ proc popup_diff_menu {ctxm ctxmmg x y X Y} {\n \t\t\tset l [mc \"Stage Hunk For Commit\"]\n \t\t\tset t [mc \"Stage Line For Commit\"]\n \t\t}\n-\t\tif {$::is_3way_diff\n+\t\tif {$::is_3way_diff || $::is_submodule_diff\n \t\t\t|| $current_diff_path eq {}\n \t\t\t|| {__} eq $state\n \t\t\t|| {_O} eq $state\ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex 925b3f5..ae1ea3a 100644\n--- a/git-gui/lib/diff.tcl\n+++ b/git-gui/lib/diff.tcl\n@@ -255,7 +255,7 @@ proc show_other_diff {path w m cont_info} {\n\n proc start_show_diff {cont_info {add_opts {}}} {\n \tglobal file_states file_lists\n-\tglobal is_3way_diff diff_active repo_config\n+\tglobal is_3way_diff is_submodule_diff diff_active repo_config\n \tglobal ui_diff ui_index ui_workdir\n \tglobal current_diff_path current_diff_side current_diff_header\n\n@@ -265,6 +265,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \tset s $file_states($path)\n \tset m [lindex $s 0]\n \tset is_3way_diff 0\n+\tset is_submodule_diff 0\n \tset diff_active 1\n \tset current_diff_header {}\n\n@@ -295,6 +296,11 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \t\tlappend cmd $path\n \t}\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}\n+\n \tif {[catch {set fd [eval git_read --nice $cmd]} err]} {\n \t\tset diff_active 0\n \t\tunlock_index\n@@ -312,7 +318,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n }\n\n proc read_diff {fd cont_info} {\n-\tglobal ui_diff diff_active\n+\tglobal ui_diff diff_active is_submodule_diff\n \tglobal is_3way_diff is_conflict_diff current_diff_header\n \tglobal current_diff_queue\n \tglobal diff_empty_count\n@@ -337,6 +343,9 @@ 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@@ -374,6 +383,23 @@ proc read_diff {fd cont_info} {\n \t\t\t\tset tags {}\n \t\t\t}\n \t\t\t}\n+\t\t} elseif {$is_submodule_diff} {\n+\t\t\tif {$line == \"\"} continue\n+\t\t\tif {[regexp {^\\* } $line]} {\n+\t\t\t\tset line [string replace $line 0 1 {Submodule }]\n+\t\t\t\tset tags d_@\n+\t\t\t} else {\n+\t\t\t\tset op [string range $line 0 2]\n+\t\t\t\tswitch -- $op {\n+\t\t\t\t{  <} {set tags d_-}\n+\t\t\t\t{  >} {set tags d_+}\n+\t\t\t\t{  W} {set tags {}}\n+\t\t\t\tdefault {\n+\t\t\t\t\tputs \"error: Unhandled submodule diff marker: {$op}\"\n+\t\t\t\t\tset tags {}\n+\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n \t\t} else {\n \t\t\tset op [string index $line 0]\n \t\t\tswitch -- $op {\n-- \n1.6.3.3.386.g0f75a.dirty\n"},{"id":"120171","messageId":"20090810153346.GS1033@spearce.org","threadId":"20182","inReplyTo":"4A65FBAF.9020603@web.de","subject":"Re: [RFC/PATCH RESEND v2] git-gui: display summary when showing diff of a submodule","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-08-10T15:33:46Z","receivedAt":"2009-08-10T15:33:46Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jens Lehmann <Jens.Lehmann@web.de> wrote:\n> As it is hard to say what changed in a submodule by looking at the hashes,\n> let's show the colored submodule summary instead.\n> \n> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n> ---\n> \n> I got only one response two weeks ago, so here is a resend.\n\nThanks for the resend, got lost in my inbox.  Applied.\n \n-- \nShawn.\n"}]}