Skip to content

Commit d445a78

Browse files
committed
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>
1 parent 77e7aab commit d445a78

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

gitk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8401,13 +8401,21 @@ proc parseblobdiffline {ids line} {
84018401
if {$i >= 0} {
84028402
setinlist difffilestart $i $curdiffstart
84038403
}
8404+
set line "rename from $fname"
84048405
} elseif {![string compare -length 10 $line "rename to "] ||
84058406
![string compare -length 8 $line "copy to "]} {
84068407
set fname [string range $line [expr 4 + [string first " to " $line] ] end]
84078408
if {[string index $fname 0] eq "\""} {
84088409
set fname [lindex $fname 0]
84098410
}
84108411
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"
84118419
} elseif {[string compare -length 3 $line "---"] == 0} {
84128420
# do nothing
84138421
return

0 commit comments

Comments
 (0)