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

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

bug#52507: [PATCH] Option for vc-delete-file to keep file on disk


From: Ashwin Kafle
Subject: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
Date: Thu, 16 Dec 2021 07:12:44 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 15.12.2021 12:53, Ashwin Kafle wrote:
>>   (defun vc-git-delete-file (file)
>> -  (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--"))
>> -
>> +  (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" 
>> "--cached" "--"))
>
> This changes the semantics of the 'delete-file' backend action. Kind
> of breaking strict compatibility with third-party backends.
>
> I think it would be better to add an optional argument to it instead
> (e.g. call it KEEP-FILE, just like the new arg to vc-delete-file; or
> KEEP-ON-DISK).
>
> Then git's implementation's signature will look like
>
>   (defun vc-git-delete-file (file &optional keep-on-disk)
>
> and it will decide whether to add '--cached' based on that argument.
>
> No 'delete-file' investigation will be needed as a result.

But this would mean that every vc-backend will have to be changed,
immediately.  If we keep things as-is, Existing code either both emacs and
third-party packages will continue to work with no changes.
We can then say in NEWS that all vc backends should always leave files
in disk and let vc-delete-file handle deletion from the disk.

Also, having every vc-backend accept and check keep-on-disk will result
on a lot of duplicate code that can simply be avoided.





reply via email to

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