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

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

bug#52349: 29.0.50; vc-git and diff-mode: stage hunks


From: Dmitry Gutov
Subject: bug#52349: 29.0.50; vc-git and diff-mode: stage hunks
Date: Mon, 12 Sep 2022 00:57:47 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 11.09.2022 18:05, Juri Linkov wrote:
+              (if (string-search file-diff vc-git-patch-string)
+                  (setq vc-git-patch-string
+                        (string-replace file-diff "" vc-git-patch-string))

Not sure I understand this part. We're replacing some text (the diff file header) with empty text in the patch string? But not the whole hunk?

It might work if we removed the whole hunk as well, but we need to make sure that the staged contents for that file are exactly the same as what is contained for that file in vc-git-patch-string.

Perhaps if we called diff-file-next in addition to (move-beginning-of-line 1)? But we need to save both strings: and ensure that if there is a match for that file header, then all hunks are contained in the patch as well (and nothing extra, for that file).

It's complex logic, so if you manage to write a test as well, that would be excellent.





reply via email to

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