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>
Johannes Sixt committed
Nov 6, 2025 at 10:42 UTC
d445a78873423c55b79f97361a082272acd17f7b
1 file changed
+8
gitk
+8
@@ -8401,6 +8401,7 @@ proc parseblobdiffline {ids line} {
8401
if {$i >= 0} {
8402
setinlist difffilestart $i $curdiffstart
8403
}
8404
+ set line "rename from $fname"
8405
} elseif {![string compare -length 10 $line "rename to "] ||
8406
![string compare -length 8 $line "copy to "]} {
8407
set fname [string range $line [expr 4 + [string first " to " $line] ] end]
@@ -8408,6 +8409,13 @@ proc parseblobdiffline {ids line} {
8409
set fname [lindex $fname 0]
8410
}
8411
makediffhdr $fname $ids
8412
+ set line "[lindex $line 0] to $fname"
8413
+ } elseif {![string compare -length 10 $line "copy from "]} {
8414
+ set fname [string range $line 10 end]
8415
+ if {[string index $fname 0] eq "\""} {
8416
+ set fname [lindex $fname 0]
8417
+ }
8418
+ set line "copy from $fname"
8419
} elseif {[string compare -length 3 $line "---"] == 0} {
8420
# do nothing
8421
return