GNU bug report logs -
#52508
[PATCH] Option for vc-delete-file to keep file on disk
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52508 in the body.
You can then email your comments to 52508 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52508
; Package
emacs
.
(Wed, 15 Dec 2021 12:56:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ashwin Kafle <ashwin <at> ashwink.com.np>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 15 Dec 2021 12:56:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
I've created the attached patch to have vc-delete file to keep files on
disk using a prefix argument. I've only tested it for vc-git.
I've already signed the copyright papers.
[0001-Option-for-vc-delete-file-to-keep-file-on-disk.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52508
; Package
emacs
.
(Wed, 15 Dec 2021 14:15:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 52508 <at> debbugs.gnu.org (full text, mbox):
> From: Ashwin Kafle <ashwin <at> ashwink.com.np>
> Date: Wed, 15 Dec 2021 10:23:42 +0000
> Cc: Ashwin Kafle <ashwin <at> ashwink.com.np>, Dmitry Gutov <dgutov <at> yandex.ru>
>
> I've created the attached patch to have vc-delete file to keep files on
> disk using a prefix argument. I've only tested it for vc-git.
Thanks, sounds useful.
A few minor comments below, mainly to the documentation parts:
> * doc/emacs/vc1-xtra.texi: Document the change.
> * lisp/vc/vc-git.el: Make git leave files on disk.
> * lisp/vc/vc.el: Change vc-delete-file to accept optional prefix argument.
Our conventions are to use the ChangeLog style of these entries, which
means they should state the function names where the changes are made,
not just the file names.
> --- a/doc/emacs/vc1-xtra.texi
> +++ b/doc/emacs/vc1-xtra.texi
> @@ -122,7 +122,8 @@ VC Delete/Rename
> If you wish to delete a version-controlled file, use the command
> @kbd{M-x vc-delete-file}. This prompts for the file name, and deletes
> it via the version control system. The file is removed from the
> -working tree, and in the VC Directory buffer
> +working tree, and in the VC Directory buffer. If you give a prefix argument,
^^
We leave 2 spaces between sentences, per US English conventions.
> +*** 'C-x v x' accepts a prefix argument to keep file on disk
Period at the end of the heading, please.
> +Previously 'C-x v x' always deleted the selected file. Now if you give it
> +prefix argument, it will keep the buffer and file on disk intact.
Two spaces between sentences.
> -(defun vc-delete-file (file)
> +(defun vc-delete-file (file &optional keep-file)
> "Delete file and mark it as such in the version control system.
> If called interactively, read FILE, defaulting to the current
> -buffer's file name if it's under version control."
> - (interactive (list (read-file-name "VC delete file: " nil
> - (when (vc-backend buffer-file-name)
> - buffer-file-name)
> - t)))
> +buffer's file name if it's under version control.
> +If a prefix argument is given (optional argument KEEP-FILE) then
> +don't delete the file from the disk"
Period missing at the end of the last sentence.
> - (let ((backup-inhibited nil))
> + (let ((backup-inhibited nil)
> + ;; if you don't set this, then for some reason, the file is never brought back
> + (backup-by-copying t))
Wouldn't it be better to understand why this mystery happens?
Also, please start the comment with a capital letter and end it with a
period.
Forcibly Merged 52507 52508.
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Wed, 15 Dec 2021 16:56:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52508
; Package
emacs
.
(Wed, 15 Dec 2021 18:07:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 52508 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
[...]
>> I've created the attached patch to have vc-delete file to keep files on
>> disk using a prefix argument. I've only tested it for vc-git.
>
> Thanks, sounds useful.
>
> A few minor comments below, mainly to the documentation parts:
[...]
Thanks, now fixed and attached.
>
>> - (let ((backup-inhibited nil))
>> + (let ((backup-inhibited nil)
>> + ;; if you don't set this, then for some reason, the file is never
>> brought back
>> + (backup-by-copying t))
>
> Wouldn't it be better to understand why this mystery happens?
Yeah, a backup function should bring back the original file. That is
indeed weird. But I can't read much elisp yet to be of help in here.
In this case, backup-by-copying seems to be the better method for
backups since the intention is to not touch the original files at all.
Reading the docstring of backup-buffer, backup-by-rename doesn't look
fit for this use case.
[0001-Option-for-vc-delete-file-to-keep-file-on-disk.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52508
; Package
emacs
.
(Sat, 18 Dec 2021 04:42:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 52508 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> I've created the attached patch to have vc-delete file to keep files on
> disk using a prefix argument. I've only tested it for vc-git.
This may seem shocking, but what about changing vc-delete-file
to ALWAYS preserve the local file? In other words, to change ONLY the repo?
That's the operation that vc-delete-file is necessary for.
If you do in fact want to delete the local file as well, that's easy to do.
This would have the advantage of one less switch to remember.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52508
; Package
emacs
.
(Sat, 18 Dec 2021 07:09:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 52508 <at> debbugs.gnu.org (full text, mbox):
> From: Richard Stallman <rms <at> gnu.org>
> Date: Fri, 17 Dec 2021 23:41:15 -0500
> Cc: ashwin <at> ashwink.com.np, 52508 <at> debbugs.gnu.org, dgutov <at> yandex.ru
>
> > I've created the attached patch to have vc-delete file to keep files on
> > disk using a prefix argument. I've only tested it for vc-git.
>
> This may seem shocking, but what about changing vc-delete-file
> to ALWAYS preserve the local file? In other words, to change ONLY the repo?
I think it would be unexpected. VCS deletion usually means you delete
both the file on the local disk and tell the VCS to delete it from the
repository.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52508
; Package
emacs
.
(Sat, 18 Dec 2021 07:36:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 52508 <at> debbugs.gnu.org (full text, mbox):
Richard Stallman <rms <at> gnu.org> writes:
> [[[ To any NSA and FBI agents reading my email: please consider ]]]
> [[[ whether defending the US Constitution against all enemies, ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
> > I've created the attached patch to have vc-delete file to keep files on
> > disk using a prefix argument. I've only tested it for vc-git.
>
> This may seem shocking, but what about changing vc-delete-file
> to ALWAYS preserve the local file? In other words, to change ONLY the repo?
>
> That's the operation that vc-delete-file is necessary for.
> If you do in fact want to delete the local file as well, that's easy to do.
>
> This would have the advantage of one less switch to remember.
I had the same initial thought ;)
But, vc-delete-file is used by a lot of people and it's probably muscle
memory for them. I didn't want people to be affected much by this patch.
Also, there's a new revision of this patch under bug#52507 that will
make sure that the local file is always preserved even if the VCS itself
deletes it.
After i understand what Juri is saying, i'll likely make a
new patch removing the change from vc-git.el
Thank you, Stallman, for all the hard work you've done and continue to do.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52508
; Package
emacs
.
(Mon, 20 Dec 2021 04:43:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 52508 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> But, vc-delete-file is used by a lot of people and it's probably muscle
> memory for them. I didn't want people to be affected much by this patch.
I'm convinced. Happy hacking.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52508
; Package
emacs
.
(Thu, 08 Sep 2022 14:18:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 52508 <at> debbugs.gnu.org (full text, mbox):
Reading this bug report, it's unclear what the conclusion is. I agree
that it would be useful to have a command to remove a file from the VC
without deleting it. But I don't think the proposed implementation is
safe, because it only works with git -- and in other VCs, doing `C-u M-x
vc-delete-file' would continue to delete the file, contrary to what the
doc string says.
Dmitry suggested to alter the interface, but that makes for awkward
compatibility.
Perhaps this should be a new command instead? That'd be less confusing,
I think. `M-x vc-remove-file', for instance.
Removed tag(s) patch.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 08 Sep 2022 14:18:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52508
; Package
emacs
.
(Mon, 10 Mar 2025 07:01:02 GMT)
Full text and
rfc822 format available.
Message #33 received at 52508 <at> debbugs.gnu.org (full text, mbox):
close 52508
thanks
On Thu 08 Sep 2022 at 04:17pm +02, Lars Ingebrigtsen wrote:
> Reading this bug report, it's unclear what the conclusion is. I agree
> that it would be useful to have a command to remove a file from the VC
> without deleting it. But I don't think the proposed implementation is
> safe, because it only works with git -- and in other VCs, doing `C-u M-x
> vc-delete-file' would continue to delete the file, contrary to what the
> doc string says.
>
> Dmitry suggested to alter the interface, but that makes for awkward
> compatibility.
>
> Perhaps this should be a new command instead? That'd be less confusing,
> I think. `M-x vc-remove-file', for instance.
In addition, in the interim, a lot has changed in this area, because now
we have committing of individual hunks, and we had to deal with some
tricky issues relating to file addition and deletion in that context.
I think we need a fresh proposal and PoC patch to proceed any further
and I think it should probably be a new bug report. So I'm going ahead
and closing this one.
I had one general comment after reading: I think we should avoid letting
the git staging area become visible to the user as much as we possibly
can, even in Git-specific VC code.
There is the general concern of remaining compatible with past and
future VCS. But I think eschewing use of the staging area is one of
VC's selling points over Magit for people who only actually use Git.
--
Sean Whitton
bug closed, send any further explanations to
52508 <at> debbugs.gnu.org and Ashwin Kafle <ashwin <at> ashwink.com.np>
Request was from
Sean Whitton <spwhitton <at> spwhitton.name>
to
control <at> debbugs.gnu.org
.
(Mon, 10 Mar 2025 07:01:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 07 Apr 2025 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 59 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.