* [PATCH] git gui: Use git diff --submodule when available
@ 2009-12-10 22:44 Jens Lehmann
2009-12-10 22:52 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Jens Lehmann @ 2009-12-10 22:44 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Git Mailing List, Junio C Hamano
Changed the use of submodule summary to diff --submodule because the
implementation in C is much faster than the submodule script. Also a test
has been added to make sure that the underlying git supports the diff
option --submodule (which was introduced in 1.6.6).
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
git-gui/lib/diff.tcl | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index bd5d189..0623e3e 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -281,6 +281,14 @@ proc start_show_diff {cont_info {add_opts {}}} {
}
}
+ if {[git-version >= "1.6.6"]} {
+ if {[string match {160000 *} [lindex $s 2]]
+ || [string match {160000 *} [lindex $s 3]]} {
+ set is_submodule_diff 1
+ lappend cmd --submodule
+ }
+ }
+
lappend cmd -p
lappend cmd --no-color
if {$repo_config(gui.diffcontext) >= 1} {
@@ -296,16 +304,6 @@ proc start_show_diff {cont_info {add_opts {}}} {
lappend cmd $path
}
- if {[string match {160000 *} [lindex $s 2]]
- || [string match {160000 *} [lindex $s 3]]} {
- set is_submodule_diff 1
- if {$w eq $ui_index} {
- set cmd [list submodule summary --cached -- $path]
- } else {
- set cmd [list submodule summary --files -- $path]
- }
- }
-
if {[catch {set fd [eval git_read --nice $cmd]} err]} {
set diff_active 0
unlock_index
@@ -387,8 +385,7 @@ proc read_diff {fd cont_info} {
}
} elseif {$is_submodule_diff} {
if {$line == ""} continue
- if {[regexp {^\* } $line]} {
- set line [string replace $line 0 1 {Submodule }]
+ if {[regexp {^Submodule } $line]} {
set tags d_@
} else {
set op [string range $line 0 2]
--
1.6.6.rc2.274.g2cee7
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] git gui: Use git diff --submodule when available
2009-12-10 22:44 [PATCH] git gui: Use git diff --submodule when available Jens Lehmann
@ 2009-12-10 22:52 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2009-12-10 22:52 UTC (permalink / raw)
To: Jens Lehmann; +Cc: Shawn O. Pearce, Git Mailing List, Junio C Hamano
Jens Lehmann <Jens.Lehmann@web.de> writes:
> Changed the use of submodule summary to diff --submodule because the
> implementation in C is much faster than the submodule script. Also a test
> has been added to make sure that the underlying git supports the diff
> option --submodule (which was introduced in 1.6.6).
>
> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
> ---
> @@ -296,16 +304,6 @@ proc start_show_diff {cont_info {add_opts {}}} {
> lappend cmd $path
> }
>
> - if {[string match {160000 *} [lindex $s 2]]
> - || [string match {160000 *} [lindex $s 3]]} {
> - set is_submodule_diff 1
> - if {$w eq $ui_index} {
> - set cmd [list submodule summary --cached -- $path]
> - } else {
> - set cmd [list submodule summary --files -- $path]
> - }
> - }
> -
Heh, I didn't even know that it originally came from git-gui ;-)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-10 22:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10 22:44 [PATCH] git gui: Use git diff --submodule when available Jens Lehmann
2009-12-10 22:52 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox