aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2025-11-06 10:42:37 +0100
committerJohannes Sixt <j6t@kdbg.org>2025-11-06 10:59:02 +0100
commitd445a78873423c55b79f97361a082272acd17f7b (patch)
tree63b36343b8572b102a8e18d9b4c15e33c08eb1d2
parent77e7aab693daee402ef37323715207c5a2daec9f (diff)
downloadgit-d445a78873423c55b79f97361a082272acd17f7b.tar.xz
gitk: show unescaped file names on 'rename' and 'copy' lines
When a file is selected in the file list, the diff window scrolls to the corresponding section. The administrative data needed for this purpose is extracted from the 'rename from', 'rename to', and 'copy to' lines. Escaped file names are unescaped for this purpose. However, the lines shown in the diff window are left in the escaped form. This is not very pleasing. Replace the escaped form by the unescaped form. Add a section to treat the 'copy from' case. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
-rwxr-xr-xgitk8
1 files changed, 8 insertions, 0 deletions
diff --git a/gitk b/gitk
index eb657aa1e4..9e4f113c9b 100755
--- a/gitk
+++ b/gitk
@@ -8401,6 +8401,7 @@ proc parseblobdiffline {ids line} {
if {$i >= 0} {
setinlist difffilestart $i $curdiffstart
}
+ set line "rename from $fname"
} elseif {![string compare -length 10 $line "rename to "] ||
![string compare -length 8 $line "copy to "]} {
set fname [string range $line [expr 4 + [string first " to " $line] ] end]
@@ -8408,6 +8409,13 @@ proc parseblobdiffline {ids line} {
set fname [lindex $fname 0]
}
makediffhdr $fname $ids
+ set line "[lindex $line 0] to $fname"
+ } elseif {![string compare -length 10 $line "copy from "]} {
+ set fname [string range $line 10 end]
+ if {[string index $fname 0] eq "\""} {
+ set fname [lindex $fname 0]
+ }
+ set line "copy from $fname"
} elseif {[string compare -length 3 $line "---"] == 0} {
# do nothing
return