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

From: Juri Linkov <[email-masked]>
Date: Sun, 02 Oct 2022 21:51:19 +0300

> 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.

>>>>> 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.