From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk Date: Thu, 23 Dec 2021 19:20:45 +0200 Organization: LINKOV.NET Message-ID: <86ilvfba32.fsf@mail.linkov.net> References: <20211215095324.18195-1-ashwin@ashwink.com.np> <86a6h13j4i.fsf@mail.linkov.net> <85o85hsr3b.fsf@ashwink.com.np> <861r2dzqrj.fsf@mail.linkov.net> <85fsqt67y1.fsf@ashwink.com.np> <8535mt67k8.fsf@ashwink.com.np> <86k0g4a875.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3335"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) 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 23 18:37:01 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 1n0S1V-0000gY-2z for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Dec 2021 18:37:01 +0100 Original-Received: from localhost ([::1]:49312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0S1U-0004w7-7I for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Dec 2021 12:37:00 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0Ryc-00088y-NE for bug-gnu-emacs@gnu.org; Thu, 23 Dec 2021 12:34:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51502) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n0Ryc-000077-E2 for bug-gnu-emacs@gnu.org; Thu, 23 Dec 2021 12:34:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n0Ryb-0007k6-Qm for bug-gnu-emacs@gnu.org; Thu, 23 Dec 2021 12:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Dec 2021 17:34: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.164028083829753 (code B ref 52507); Thu, 23 Dec 2021 17:34:01 +0000 Original-Received: (at 52507) by debbugs.gnu.org; 23 Dec 2021 17:33:58 +0000 Original-Received: from localhost ([127.0.0.1]:34815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n0RyY-0007jp-FK for submit@debbugs.gnu.org; Thu, 23 Dec 2021 12:33:58 -0500 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:56433) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n0RyV-0007jN-FW for 52507@debbugs.gnu.org; Thu, 23 Dec 2021 12:33:57 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id C17EF20005; Thu, 23 Dec 2021 17:33:47 +0000 (UTC) In-Reply-To: (Dmitry Gutov's message of "Mon, 20 Dec 2021 02:46:29 +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:222992 Archived-At: > Or alternatively, if we consider the potential feature which we've been > talking about (committing a subset of hunks from a file selectively), its > implementation should have a step which either uses a staging area, or adds > stuff to it first. > > And that step could be the place to enact a change like presently discussed > (add a deletion to the staging area, and then commit it). That deletion > would either already be in the staging area (meaning we pick up any staged > changes for commit, which might be weird), or we would store the "intent to > remove with --cached" in some buffer-local variable, which would be picked > up by the new code. > > The latter solution would be the "cleaner" one, but the former is one that > we could have _right now_. > > On the plus side, the former also doesn't seem like it's going to require > changes in the VC API after all. The feature of committing a subset of hunks will be performed by one command 'log-edit-done' ('C-c C-c') from the *vc-log* buffer that will run git commands `git apply --cached` followed by `git commit`. Doing something similar could mean for example that 'C-u M-x vc-delete-file' could immediately pop up the *vc-log* buffer waiting for a commit message, and on 'C-c C-c' will commit only the deleted file. I doubt that anyone might want to commit the file deletion immediately, because file deletions usually are committed together with other changes. But maybe git has a way to mark a file as deleted without actually deleting it? So `git status --porcelain -z --untracked-files` could return "D" for such file that still exists, this would be the simplest solution.