git-gui: Use git diff --submodule when available
Doing so is much faster and gives the same output. Here are some numbers: $ time git submodule summary real 0m0.219s user 0m0.050s sys 0m0.111s $ time git diff --submodule real 0m0.012s user 0m0.003s sys 0m0.009s Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
87cd09f43e
commit
a9ae14a1c5
17
lib/diff.tcl
17
lib/diff.tcl
@ -281,6 +281,15 @@ proc start_show_diff {cont_info {add_opts {}}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if {[string match {160000 *} [lindex $s 2]]
|
||||||
|
|| [string match {160000 *} [lindex $s 3]]} {
|
||||||
|
set is_submodule_diff 1
|
||||||
|
|
||||||
|
if {[git-version >= "1.6.6"]} {
|
||||||
|
lappend cmd --submodule
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lappend cmd -p
|
lappend cmd -p
|
||||||
lappend cmd --no-color
|
lappend cmd --no-color
|
||||||
if {$repo_config(gui.diffcontext) >= 1} {
|
if {$repo_config(gui.diffcontext) >= 1} {
|
||||||
@ -296,9 +305,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
|
|||||||
lappend cmd $path
|
lappend cmd $path
|
||||||
}
|
}
|
||||||
|
|
||||||
if {[string match {160000 *} [lindex $s 2]]
|
if {$is_submodule_diff && [git-version < "1.6.6"]} {
|
||||||
|| [string match {160000 *} [lindex $s 3]]} {
|
|
||||||
set is_submodule_diff 1
|
|
||||||
if {$w eq $ui_index} {
|
if {$w eq $ui_index} {
|
||||||
set cmd [list submodule summary --cached -- $path]
|
set cmd [list submodule summary --cached -- $path]
|
||||||
} else {
|
} else {
|
||||||
@ -387,7 +394,9 @@ proc read_diff {fd cont_info} {
|
|||||||
}
|
}
|
||||||
} elseif {$is_submodule_diff} {
|
} elseif {$is_submodule_diff} {
|
||||||
if {$line == ""} continue
|
if {$line == ""} continue
|
||||||
if {[regexp {^\* } $line]} {
|
if {[regexp {^Submodule } $line]} {
|
||||||
|
set tags d_@
|
||||||
|
} elseif {[regexp {^\* } $line]} {
|
||||||
set line [string replace $line 0 1 {Submodule }]
|
set line [string replace $line 0 1 {Submodule }]
|
||||||
set tags d_@
|
set tags d_@
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user