GNU bug report logs - #72556
29.1.90; vc-diff does not undo hunk in end of source file

Previous Next

Package: emacs;

Reported by: Tomas Nordin <tomasn <at> posteo.net>

Date: Sat, 10 Aug 2024 12:12:01 UTC

Severity: normal

Found in version 29.1.90

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: Eli Zaretskii <eliz <at> gnu.org>
To: dmitry <at> gutov.dev, juri <at> linkov.net
Cc: tomasn <at> posteo.net, 72556 <at> debbugs.gnu.org
Subject: bug#72556: 29.1.90; vc-diff does not undo hunk in end of source file
Date: Sat, 14 Sep 2024 10:35:15 +0300
Ping! Would someone want to work on a patch, or should I close this
bug as wontfix?

> Cc: 72556 <at> debbugs.gnu.org
> Date: Sat, 31 Aug 2024 11:09:36 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > From: Juri Linkov <juri <at> linkov.net>
> > Cc: Tomas Nordin <tomasn <at> posteo.net>,  Dmitry Gutov <dmitry <at> gutov.dev>,
> >   72556 <at> debbugs.gnu.org
> > Date: Mon, 19 Aug 2024 19:49:05 +0300
> > 
> > >> To reproduce:
> > >>
> > >> $ mkdir apply
> > >> $ cd apply
> > >> $ echo "first line of code" > example.file
> > >> $ git init
> > >> $ git add .
> > >> $ git commit -m 'init'
> > >> $ echo "last line of code" >> example.file
> > >> $ emacs -Q example.file
> > >>
> > >> C-x v =
> > >> n
> > >> C-c C-a
> > >>
> > >> The hunk is applied in the source buffer.
> > >
> > > Juri and Dmitry, any comments or suggestions?
> > 
> > I don't know why it fails at the end, so I tried to debug 'diff-apply-hunk',
> > and found that the problem is in these lines of 'diff-find-source-location':
> > 
> >     ;; FIXME: Check for case where both OLD and NEW are found.
> >     (pos (or (diff-find-text (car old))
> > 
> > When the hunk is at the beginning/end of the diff buffer,
> > then it misses the top/bottom part of the context,
> > so 'diff-find-text' wrongly matches it because it fails
> > to see any changes in it due to insufficient context,
> > and returns switched=nil.
> > 
> > A possible solution would be to add a condition to detect the case
> > when the hunk is at the beginning/end of the diff buffer.
> 
> Thanks.  Would anyone like to submit a patch along these lines?
> 
> 
> 
> 




This bug report was last modified 65 days ago.

Previous Next


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