GNU bug report logs - #62731
29.0.60; diff-apply-hunk doesn't work for creating new files

Previous Next

Package: emacs;

Reported by: sbaugh <at> catern.com

Date: Sun, 9 Apr 2023 01:15:02 UTC

Severity: normal

Found in version 29.0.60

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: sbaugh <at> catern.com, 62731 <at> debbugs.gnu.org
Subject: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files
Date: Tue, 15 Oct 2024 19:13:32 +0300
>> All right, the attached seems to support both creation and deletion,
>> including applying hunks in reverse direction.
>> Things got trickier but not by a lot.
>
> Now pushed to master, seems useful enough. Let's see if some unforeseen
> problems are reported.

This change broke diff of files:

@@ -1957,7 +1970,7 @@ diff-find-source-location
                                 diff-context-mid-hunk-header-re nil t)
 			 (error "Can't find the hunk separator"))
 		       (match-string 1)))))
-	   (file (or (diff-find-file-name other noprompt)
+	   (file (or (diff-find-file-name (xor other reverse) noprompt)
                      (error "Can't find the file")))
 	   (revision (and other diff-vc-backend
                           (if reverse (nth 1 diff-vc-revisions)

So after 'dired-backup-diff', typing 'C-c C-c' visits wrong file:
visits the backup when point is on the file line, and vice versa:
visits the file when point is on backup file line.




This bug report was last modified 217 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.