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

From: Dmitry Gutov <[email-masked]>
Date: Fri, 4 Nov 2022 03:32:53 +0200

(Sorry, resending after unarchiving).

On 02.10.2022 21:51, Juri Linkov wrote:
>> It doesn't seem like it's going to differentiate between "add whole file"
>> chunks and any other kinds of chunks.
>>
>> Which is not a bad thing by itself, probably. But can increase the odds of
>> something like the above happening.
> I added more checks to detect the whole files boundaries, and pushed.

Thanks.

>>>>>> It's complex logic, so if you manage to write a test as well, that would be
>>>>>> excellent.
>>>>> A test could written when someone will create infrastructure for testing
>>>>> git commands with helpers to create a git repository and checking its content.
>>>> test/lisp/vc/vc-tests.el actually contains a helper like this.
>>>>
>>>> Every scenario starts with calling vc-test--create-repo-function, and there
>>>> are tests for 'version-diff' at the very end of the file. It's somewhat
>>>> convoluted, so I don't blame you for missing it.
>>> Actually, I looked into test/lisp/vc/vc-git-tests.el that is almost
>>> empty.
>>> I expected that since this check is git-specific, it should be in
>>> vc-git-tests.el.
>> Not sure how to best share the setup/teardown logic between vc-tests.el and
>> vc-git-test.el.
> I looked into this, but this is a too big task.  It would be nice if
> Someone (TM) created the git-specific setup/teardown logic, and other
> helper functions in test/lisp/vc/vc-git-tests.el.

FWIW, now that the feature is supported across backends, we can add a 
corresponding test in vc-tests.el. ;-)

Some backends will probably need to be skipped anyway, but the most 
popular ones will hopefully work.