all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: tomasn@posteo.net, dmitry@gutov.dev, Juri Linkov <juri@linkov.net>
Cc: 72556@debbugs.gnu.org
Subject: bug#72556: 29.1.90; vc-diff does not undo hunk in end of source file
Date: Sat, 31 Aug 2024 11:09:36 +0300	[thread overview]
Message-ID: <86msktcdvj.fsf@gnu.org> (raw)
In-Reply-To: <861q2lhrxc.fsf@mail.linkov.net> (message from Juri Linkov on Mon, 19 Aug 2024 19:49:05 +0300)

> From: Juri Linkov <juri@linkov.net>
> Cc: Tomas Nordin <tomasn@posteo.net>,  Dmitry Gutov <dmitry@gutov.dev>,
>   72556@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?





  reply	other threads:[~2024-08-31  8:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-10 12:11 bug#72556: 29.1.90; vc-diff does not undo hunk in end of source file Tomas Nordin
2024-08-17  9:38 ` Eli Zaretskii
2024-08-19 16:49   ` Juri Linkov
2024-08-31  8:09     ` Eli Zaretskii [this message]
2024-09-14  7:35       ` Eli Zaretskii
2024-09-14 15:47     ` Dmitry Gutov
2024-09-14 15:50 ` Dmitry Gutov
2024-09-15 10:41   ` Tomas Nordin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86msktcdvj.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=72556@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=juri@linkov.net \
    --cc=tomasn@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.