emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 4803fba487 1/2: 'C-x v v' on a diff buffer commits it as a pa


From: Dmitry Gutov
Subject: Re: master 4803fba487 1/2: 'C-x v v' on a diff buffer commits it as a patch (bug#52349)
Date: Mon, 17 Oct 2022 02:53:26 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2

On 31.08.2022 19:36, Eli Zaretskii wrote:
Date: Wed, 31 Aug 2022 19:21:12 +0300
Cc: Po Lu<luangruo@yahoo.com>, "Alfred M. Szmidt"<ams@gnu.org>,
  eliz@gnu.org,larsi@gnus.org,emacs-devel@gnu.org
From: Dmitry Gutov<dgutov@yandex.ru>

On 31.08.2022 19:06, Juri Linkov wrote:
But a loop is necessary because the diff can have more than one hunk, isn't
it?
A loop is necessary indeed.  The problem is that I tried it with Bzr,
but it has such a bug that `bzr diff` adds an extra line at the end,
so it's not (eobp) after the last diff hunk.  After removing the
final newline in the*vc-diff*  buffer the loop can be finished.
Hmm, so how do we apply the full diff in a backend-agnostic fashion?

Should we delegate to 'patch', then? And require it to be installed.
Shouldn't the code which looks for hunks be resilient to such minor
differences?  Why does it fail if there's an extra line at the end?
Does that line look anything like another hunk?

I'm not sure how that line is supposed to look (I haven't been able to reproduce it with the one Bzr repo I had), but it should be possible to use a loop like

  (while (or (bobp) (looking-at diff-hunk-header-re)
    (diff-apply-hunk))

Anyway, I went ahead with using 'patch' for now. At least it will show simpler errors if user tries to commit patch with broken syntax.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]