{"thread":{"id":"22361","subject":"[PATCH (resend 3)] git gui: Use git diff --submodule when available","startedAt":"2010-01-23T22:04:12Z","lastAt":"2010-01-23T22:42:26Z","messageCount":3,"participants":["Jens Lehmann","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"132506","messageId":"4B5B725C.6060301@web.de","threadId":"22361","inReplyTo":null,"subject":"[PATCH (resend 3)] git gui: Use git diff --submodule when available","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-01-23T22:04:12Z","receivedAt":"2010-01-23T22:04:12Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"The necessary feature is present since 1.6.6, it would be good\nto have this patch in the next release (see numbers below).\n\nShawn, This is a third re-send, in case you missed the previous\nrounds. Thanks.\n\n-- >8 --\nSubject: [PATCH] git gui: Use git diff --submodule when available\n\nDoing so is much faster and gives the same output. Here are some\nnumbers:\n\ntime git submodule summary\n<snip>\nreal\t0m0.219s\nuser\t0m0.050s\nsys\t0m0.111s\n\n\ntime git diff --submodule\n<snip>\nreal\t0m0.012s\nuser\t0m0.003s\nsys\t0m0.009s\n\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.1.558.gc20e6.dirty\n"},{"id":"132510","messageId":"20100123223458.GB12679@spearce.org","threadId":"22361","inReplyTo":"4B5B725C.6060301@web.de","subject":"Re: [PATCH (resend 3)] git gui: Use git diff --submodule when available","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2010-01-23T22:34:58Z","receivedAt":"2010-01-23T22:34:58Z","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> The necessary feature is present since 1.6.6, it would be good\n> to have this patch in the next release (see numbers below).\n> \n> Shawn, This is a third re-send, in case you missed the previous\n> rounds. Thanks.\n\nI didn't miss them, I just was ignoring git-gui patches for a while.\nI only work on git-gui in short spurts.\n\nI actually just applied a modified version of your patch, so diff\non submodules still works via submodule summary if git < 1.6.6.\n\n-- \nShawn.\n"},{"id":"132513","messageId":"4B5B7B52.9020500@web.de","threadId":"22361","inReplyTo":"20100123223458.GB12679@spearce.org","subject":"Re: [PATCH (resend 3)] git gui: Use git diff --submodule when available","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-01-23T22:42:26Z","receivedAt":"2010-01-23T22:42:26Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 23.01.2010 23:34, schrieb Shawn O. Pearce:\n> I actually just applied a modified version of your patch, so diff\n> on submodules still works via submodule summary if git < 1.6.6.\n\nOne caveat: This will only work in versions 1.6.4 and above, as i\nhad to add the --files option to git submodule summary to make it\nwork.\n"}]}