{"thread":{"id":"21932","subject":"[PATCH] git gui: Use git diff --submodule when available","startedAt":"2009-12-10T22:44:52Z","lastAt":"2009-12-10T22:52:54Z","messageCount":2,"participants":["Jens Lehmann","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"129710","messageId":"4B2179E4.3070603@web.de","threadId":"21932","inReplyTo":null,"subject":"[PATCH] git gui: Use git diff --submodule when available","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2009-12-10T22:44:52Z","receivedAt":"2009-12-10T22:44:52Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Changed the use of submodule summary to diff --submodule because the\nimplementation in C is much faster than the submodule script. Also a test\nhas been added to make sure that the underlying git supports the diff\noption --submodule (which was introduced in 1.6.6).\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n git-gui/lib/diff.tcl |   21 +++++++++------------\n 1 files changed, 9 insertions(+), 12 deletions(-)\n\ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex bd5d189..0623e3e 100644\n--- a/git-gui/lib/diff.tcl\n+++ b/git-gui/lib/diff.tcl\n@@ -281,6 +281,14 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \t\t}\n \t}\n\n+\tif {[git-version >= \"1.6.6\"]} {\n+\t\tif {[string match {160000 *} [lindex $s 2]]\n+\t\t    || [string match {160000 *} [lindex $s 3]]} {\n+\t\t\tset is_submodule_diff 1\n+\t\t\tlappend cmd --submodule\n+\t\t}\n+\t}\n+\n \tlappend cmd -p\n \tlappend cmd --no-color\n \tif {$repo_config(gui.diffcontext) >= 1} {\n@@ -296,16 +304,6 @@ 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 is_submodule_diff 1\n-\t\tif {$w eq $ui_index} {\n-\t\t\tset cmd [list submodule summary --cached -- $path]\n-\t\t} else {\n-\t\t\tset cmd [list submodule summary --files -- $path]\n-\t\t}\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@@ -387,8 +385,7 @@ proc read_diff {fd cont_info} {\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\tif {[regexp {^Submodule } $line]} {\n \t\t\t\tset tags d_@\n \t\t\t} else {\n \t\t\t\tset op [string range $line 0 2]\n-- \n1.6.6.rc2.274.g2cee7\n"},{"id":"129711","messageId":"7vskbi8mrd.fsf@alter.siamese.dyndns.org","threadId":"21932","inReplyTo":"4B2179E4.3070603@web.de","subject":"Re: [PATCH] git gui: Use git diff --submodule when available","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-10T22:52:54Z","receivedAt":"2009-12-10T22:52:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jens Lehmann <Jens.Lehmann@web.de> writes:\n\n> Changed the use of submodule summary to diff --submodule because the\n> implementation in C is much faster than the submodule script. Also a test\n> has been added to make sure that the underlying git supports the diff\n> option --submodule (which was introduced in 1.6.6).\n>\n> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n> ---\n> @@ -296,16 +304,6 @@ 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 is_submodule_diff 1\n> -\t\tif {$w eq $ui_index} {\n> -\t\t\tset cmd [list submodule summary --cached -- $path]\n> -\t\t} else {\n> -\t\t\tset cmd [list submodule summary --files -- $path]\n> -\t\t}\n> -\t}\n> -\n\nHeh, I didn't even know that it originally came from git-gui ;-)\n"}]}