summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2009-10-28 11:40:45 (GMT)
committerPaul Mackerras <paulus@samba.org>2009-11-03 11:28:42 (GMT)
commit5c838d23aa02476cfe91b0eea047b6d5857da770 (patch)
tree5aacf98cbdcf9a121e18fbd25f0b1db2140d5ed0
parent90a77925417646041ac408e591f969d7477be0a9 (diff)
downloadgit-5c838d23aa02476cfe91b0eea047b6d5857da770.zip
git-5c838d23aa02476cfe91b0eea047b6d5857da770.tar.gz
git-5c838d23aa02476cfe91b0eea047b6d5857da770.tar.bz2
gitk: Use the --submodule option for displaying diffs when available
When displaying diffs in a submodule, this makes gitk display the headlines of the commits being diffed, instead of just showing not-quite-helpful SHA-1 pairs, if the underlying git installation supports this. That makes it much easier to evaluate the changes, as it eliminates the need to start a gitk inside the submodule and use the superprojects hashes there to find out what the commits are about. Since the --submodule option of git diff is new in git version 1.6.6, this only uses the --submodule option when a git version of 1.6.6 or higher is detected. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk21
1 files changed, 20 insertions, 1 deletions
diff --git a/gitk b/gitk
index 785afd2..59d5925 100755
--- a/gitk
+++ b/gitk
@@ -7344,7 +7344,11 @@ proc getblobdiffs {ids} {
if {[package vcompare $git_version "1.6.1"] >= 0} {
set textconv "--textconv"
}
- set cmd [diffcmd $ids "-p $textconv -C --cc --no-commit-id -U$diffcontext"]
+ set submodule {}
+ if {[package vcompare $git_version "1.6.6"] >= 0} {
+ set submodule "--submodule"
+ }
+ set cmd [diffcmd $ids "-p $textconv $submodule -C --cc --no-commit-id -U$diffcontext"]
if {$ignorespace} {
append cmd " -w"
}
@@ -7482,6 +7486,21 @@ proc getblobdiffline {bdf ids} {
set diffnparents [expr {[string length $ats] - 1}]
set diffinhdr 0
+ } elseif {![string compare -length 10 "Submodule " $line]} {
+ # start of a new submodule
+ if {[string compare [$ctext get "end - 4c" end] "\n \n\n"]} {
+ $ctext insert end "\n"; # Add newline after commit message
+ }
+ set curdiffstart [$ctext index "end - 1c"]
+ lappend ctext_file_names ""
+ set fname [string range $line 10 [expr [string last " " $line] - 1]]
+ lappend ctext_file_lines $fname
+ makediffhdr $fname $ids
+ $ctext insert end "\n$line\n" filesep
+ } elseif {![string compare -length 3 " >" $line]} {
+ $ctext insert end "$line\n" dresult
+ } elseif {![string compare -length 3 " <" $line]} {
+ $ctext insert end "$line\n" d0
} elseif {$diffinhdr} {
if {![string compare -length 12 "rename from " $line]} {
set fname [string range $line [expr 6 + [string first " from " $line] ] end]