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

Previous Next

Package: emacs;

Reported by: Ashwin Kafle <ashwin <at> ashwink.com.np>

Date: Wed, 15 Dec 2021 12:56:02 UTC

Severity: normal

Merged with 52508

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ashwin Kafle <ashwin <at> ashwink.com.np>
To: Juri Linkov <juri <at> linkov.net>
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin <at> ashwink.com.np>
Subject: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
Date: Wed, 15 Dec 2021 18:26:14 +0000
[Message part 1 (text/plain, inline)]
Juri Linkov <juri <at> linkov.net> writes:

> Then another question: why backup is needed at all?
> When the file is not going to be deleted, then
> there is no need to make a backup copy?

There could be deletion or not depending on the value of keep-file.
Maybe the check for that can be made earlier and backup can be skipped
conditionally.  

> The comment before calling `vc-resynch-buffer' says it's to
> make sure the buffer is deleted.  But it seems the buffer
> is already deleted at that point?

No, the buffer is not deleted at that point. I should've changed that
comment too.  vc-resynch-buffer would've deleted that buffer if the
second arg was nil.

>
> Also it looks that your another change is dangerous:
>
>  (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" "--")))
>
> because it deletes the file in the staging area
> that is not used by vc-git, so there is no way
> to commit the deletion using vc commands.

I think this check in vc-delete-file takes care of that

[Message part 2 (text/plain, inline)]
(when (eq state 'edited)
        (error "Please commit or undo your changes before deleting %s" file))
[Message part 3 (text/plain, inline)]
-- 
I'd rather just believe that it's done by little elves running around.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 166 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.