From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ashwin Kafle Newsgroups: gmane.emacs.bugs Subject: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk Date: Wed, 15 Dec 2021 18:26:14 +0000 Message-ID: <85fsqt67y1.fsf@ashwink.com.np> References: <20211215095324.18195-1-ashwin@ashwink.com.np> <86a6h13j4i.fsf@mail.linkov.net> <85o85hsr3b.fsf@ashwink.com.np> <861r2dzqrj.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39213"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 52507@debbugs.gnu.org, Ashwin Kafle To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 15 20:26:40 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxZvE-000A3H-2f for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Dec 2021 20:26:40 +0100 Original-Received: from localhost ([::1]:54800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxZvC-0000tv-DP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Dec 2021 14:26:38 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxYyY-0000hD-RM for bug-gnu-emacs@gnu.org; Wed, 15 Dec 2021 13:26:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50372) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mxYyY-0007f5-Hl for bug-gnu-emacs@gnu.org; Wed, 15 Dec 2021 13:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mxYyY-0005RI-Fs for bug-gnu-emacs@gnu.org; Wed, 15 Dec 2021 13:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ashwin Kafle Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Dec 2021 18:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52507 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 52507-submit@debbugs.gnu.org id=B52507.163959272620836 (code B ref 52507); Wed, 15 Dec 2021 18:26:02 +0000 Original-Received: (at 52507) by debbugs.gnu.org; 15 Dec 2021 18:25:26 +0000 Original-Received: from localhost ([127.0.0.1]:33680 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxYxx-0005Q0-VO for submit@debbugs.gnu.org; Wed, 15 Dec 2021 13:25:26 -0500 Original-Received: from forward102j.mail.yandex.net ([5.45.198.243]:46776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxYxw-0005Pk-4Y for 52507@debbugs.gnu.org; Wed, 15 Dec 2021 13:25:25 -0500 Original-Received: from myt5-b88997415fa8.qloud-c.yandex.net (myt5-b88997415fa8.qloud-c.yandex.net [IPv6:2a02:6b8:c12:1fa2:0:640:b889:9741]) by forward102j.mail.yandex.net (Yandex) with ESMTP id D94CD4BE69E2; Wed, 15 Dec 2021 21:25:16 +0300 (MSK) Original-Received: from myt5-aad1beefab42.qloud-c.yandex.net (myt5-aad1beefab42.qloud-c.yandex.net [2a02:6b8:c12:128:0:640:aad1:beef]) by myt5-b88997415fa8.qloud-c.yandex.net (mxback/Yandex) with ESMTP id ttzoAkXQKs-PGfSfWBk; Wed, 15 Dec 2021 21:25:16 +0300 Authentication-Results: myt5-b88997415fa8.qloud-c.yandex.net; dkim=pass Original-Received: by myt5-aad1beefab42.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id SztCjPO7BH-PFP8YZuW; Wed, 15 Dec 2021 21:25:15 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Yandex-Fwd: 2 In-Reply-To: <861r2dzqrj.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 15 Dec 2021 20:06:56 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222444 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Juri Linkov 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.=20=20 > 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" "--cac= hed" "--"))) > > 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 --=-=-= Content-Type: text/plain Content-Disposition: inline (when (eq state 'edited) (error "Please commit or undo your changes before deleting %s" file)) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =2D-=20 I'd rather just believe that it's done by little elves running around. --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHKBAEBCAA0FiEEvNoXmdYXLw2CzQ66EHbebDayoY8FAmG6M0YWHGFzaHdpbkBh c2h3aW5rLmNvbS5ucAAKCRAQdt5sNrKhjyr+C/9g/bz3nJARmthlQDgJvgCaUBem tg7SOlz3C9c9Up2j+RMS6NFLhnOSILBU88yUSYMeDLhA0yzn3DCzWwlpuIpZYwxm EhTHZ6f+rc3TqMGeMavC2xkPu6U5SMsxcchNLlAQB1/tfDoJrBFAydWReTvShOEH jxrPwaUcRvGBl+H4jtdewtcSjZVJtbM73DzmyIxsxYDt9eqjcJH/fSni4ONwYvpy FQ0JCBs3KjT2I77xWX9RjjKrfKPOTYXR77mXORiY/ZtUpIRBNTQMhh4U9tR+N3// hzI5gCvJFaaP7/X10W3/nUGKRp8yfHnTY6dDBMSApmAoY/es+wVT+gwFjPZeWdLO usFfpyZ7Wp+2R/nNlRHXrbdeuntAEFIvuNIdpENb/CGrk+AIA/3u0N5vG7yQJwxW ClfHb9NOpBnLooAa/5am1Tf+wfgwThR1aKY+swbl0yddpbUNNesW7TDhVDBmyvB1 lYjNBaO453i5Fsw92cYl9jHzZfJI6UcHD1c9L9Q= =YU/H -----END PGP SIGNATURE----- --==-=-=--