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: Thu, 16 Dec 2021 07:12:44 +0000 Message-ID: <85pmpxvx8z.fsf@ashwink.com.np> References: <20211215095324.18195-1-ashwin@ashwink.com.np> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33867"; 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: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 16 08:12:24 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 1mxkwB-0008cz-OB for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Dec 2021 08:12:23 +0100 Original-Received: from localhost ([::1]:55958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxkw9-0000dC-St for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Dec 2021 02:12:21 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxkvs-0000by-2B for bug-gnu-emacs@gnu.org; Thu, 16 Dec 2021 02:12:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51057) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mxkvq-0004Ab-0o for bug-gnu-emacs@gnu.org; Thu, 16 Dec 2021 02:12:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mxkvp-00006N-TV for bug-gnu-emacs@gnu.org; Thu, 16 Dec 2021 02:12:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ashwin Kafle Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Dec 2021 07:12:01 +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.1639638719383 (code B ref 52507); Thu, 16 Dec 2021 07:12:01 +0000 Original-Received: (at 52507) by debbugs.gnu.org; 16 Dec 2021 07:11:59 +0000 Original-Received: from localhost ([127.0.0.1]:34370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxkvn-000067-M9 for submit@debbugs.gnu.org; Thu, 16 Dec 2021 02:11:59 -0500 Original-Received: from forward102p.mail.yandex.net ([77.88.28.102]:41310) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxkvk-00005n-A6 for 52507@debbugs.gnu.org; Thu, 16 Dec 2021 02:11:58 -0500 Original-Received: from sas1-9b68b0b83e4d.qloud-c.yandex.net (sas1-9b68b0b83e4d.qloud-c.yandex.net [IPv6:2a02:6b8:c14:2706:0:640:9b68:b0b8]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 8DCFD393DB0E for <52507@debbugs.gnu.org>; Thu, 16 Dec 2021 10:11:47 +0300 (MSK) Original-Received: from sas1-7a2c1d25dbfc.qloud-c.yandex.net (sas1-7a2c1d25dbfc.qloud-c.yandex.net [2a02:6b8:c08:c9f:0:640:7a2c:1d25]) by sas1-9b68b0b83e4d.qloud-c.yandex.net (mxback/Yandex) with ESMTP id U9QjRv2NhB-Bke0mjus; Thu, 16 Dec 2021 10:11:47 +0300 Authentication-Results: sas1-9b68b0b83e4d.qloud-c.yandex.net; dkim=pass Original-Received: by sas1-7a2c1d25dbfc.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id LsxHPCJILI-BjPScrHk; Thu, 16 Dec 2021 10:11:45 +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: (Dmitry Gutov's message of "Thu, 16 Dec 2021 01:59:35 +0300") 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:222463 Archived-At: Dmitry Gutov 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.