bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes


From: Dmitry Gutov
Subject: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes
Date: Sat, 24 Dec 2022 21:26:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 24/12/2022 20:22, Sean Whitton wrote:

Now that we understand clearly what we want it to do, I bet the code in
vc-checkin-git could be simplified (vc-git--stash-staged-changes is
fine).  So I'll see about doing that, with some tests, as you suggest.

Let me ask you about the parsing of the 'diff --git' lines.
...
> Do you have any better ideas of how to extract the filename from the git
> --diff line, or perhaps a proof that my approach can't fail? :)

I don't know. You could try

  (and (looking-at diff-file-header-re) (match-string 1))

instead, but it matches a different line (one that starts with "---").

I wasn't
happy with my regexp approach to extracting the filename.  I'm not sure
it can actually fail, but the current codes assumes it can, and that
adds complexity.

Not sure which failure you are referring to, but the process of removing already-staged hunks from vc-git-patch-string can indeed fail, because the hunks might be staged, or might be not. The idea was to support both situations.

The --src-prefix, --dst-prefix and --no-prefix options to git-diff(1)
might be relevant, but then we couldn't use a simple string-match to
find hunks in vc-git-patch-string.

Right.





reply via email to

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