Re: [PATCH v8] gitk: add external diff file rename detection
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Nov 6, 2025, 18:16 UTC
- Message-ID
- <93e6fffd-3d23-43ad-b9df-940894b459d9@kdbg.org>
- In-Reply-To
- <pull.1774.v8.git.1762440131635.gitgitgadget@gmail.com>
Am 06.11.25 um 15:42 schrieb ToBoMi via GitGitGadget:
Show 15 quoted lines
> From: Tobias Boesch <tobias.boesch@miele.com> > > If a file is renamed between commits and an external diff is started > through gitk on the original or the renamed file name, > gitk is unable to open the renamed file in the external diff editor. > It fails to fetch the renamed file from git, because it fetches it > using its original path in contrast to using the renamed path of the > file. > Detect the rename and open the external diff with the original and > the renamed file instead of no file (fetch the renamed file path and > name from git) no matter if the original or the renamed file is > selected in gitk. > > Signed-off-by: Tobias Boesch <tobias.boesch@miele.com> > ---
Thanks, this is looking good now. I applied these whitespace fixes while queuing:
diff --git a/gitk b/gitk index caaee16..9659466 100755 --- a/gitk +++ b/gitk @@ -3811,7 +3811,7 @@ proc check_for_renames_in_diff {filepath} { # renames set filename [file tail $filepath] set renames {} - + foreach loc $difffilestart { set loclineend [string map {.0 .end} $loc] set fromlineloc "$loc + 2 lines" @@ -3822,15 +3822,15 @@ proc check_for_renames_in_diff {filepath} { # renames && [string equal -length 10 "rename to " $rentoline]} { set renfrom [string range $renfromline 12 end] set rento [string range $rentoline 10 end] - if {[string first $filename $renfrom] != -1 - || [string first $filename $rento] != -1} { - lappend renames $renfrom - lappend renames $rento + if {[string first $filename $renfrom] != -1 + || [string first $filename $rento] != -1} { + lappend renames $renfrom + lappend renames $rento break } } } - + return $renames } -- Hannes