git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: ToBoMi via GitGitGadget
Message 17 of 17 in “gitk: added external diff file rename detection”
  1. gitk: added external diff file rename detectionToBoMi via GitGitGadget, Aug 22, 2024
  2. gitk: added external diff file rename detectionToBoMi via GitGitGadget, Sep 6, 2024
  3. AW: [PATCH v2] gitk: added external diff file rename detectiontobias.boesch@miele.com, Oct 2, 2024
  4. gitk: added external diff file rename detectionToBoMi via GitGitGadget, Mar 4, 2025
  5. Johannes SixtMar 16, 2025
  6. AW: [PATCH v3] gitk: added external diff file rename detectiontobias.boesch@miele.com, Apr 28, 2025
  7. gitk: add external diff file rename detectionToBoMi via GitGitGadget, Apr 28, 2025
  8. Johannes SixtMay 6, 2025
  9. AW: [PATCH v4] gitk: add external diff file rename detectiontobias.boesch@miele.com, Jun 10, 2025
  10. gitk: add external diff file rename detectionToBoMi via GitGitGadget, Jun 10, 2025
  11. AW: [PATCH v5] gitk: add external diff file rename detectiontobias.boesch@miele.com, Jun 13, 2025
  12. gitk: add external diff file rename detectionToBoMi via GitGitGadget, Jun 24, 2025
  13. Johannes SixtJun 25, 2025
  14. gitk: add external diff file rename detectionToBoMi via GitGitGadget, Oct 31, 2025
  15. Johannes SixtNov 4, 2025
  16. gitk: add external diff file rename detectionToBoMi via GitGitGadget, Nov 6, 2025
  17. Johannes SixtNov 6, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.