From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton Newsgroups: gmane.emacs.bugs Subject: bug#52349: 29.0.50; vc-git and diff-mode: stage hunks Date: Thu, 08 Sep 2022 15:48:42 -0700 Message-ID: <87edwlo52t.fsf@melete.silentflame.com> References: <268cee0d-465d-b862-d1d6-f5da4d69e737@inventati.org> <9106387a-98cf-396f-bf45-ccb04581787b@yandex.ru> <864k7kfd56.fsf@mail.linkov.net> <86fsr3uen2.fsf@mail.linkov.net> <95d2d999-49ad-13c4-9f25-0935650a1e42@yandex.ru> <8635ktjfll.fsf@mail.linkov.net> <36b963e4-5af7-dd9e-af92-4404541b9f4d@yandex.ru> <86v8xjx45h.fsf@mail.linkov.net> <861qt9h1hh.fsf@mail.linkov.net> <864jy1mrk8.fsf@mail.linkov.net> <86fsh1ll5y.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="12519"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: Juri Linkov , Dmitry Gutov , 52349@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 09 00:49:28 2022 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 1oWQKt-00033J-7W for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Sep 2022 00:49:28 +0200 Original-Received: from localhost ([::1]:52922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWQKq-0002Y8-Bt for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Sep 2022 18:49:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWQKU-0002Xn-Cv for bug-gnu-emacs@gnu.org; Thu, 08 Sep 2022 18:49:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWQKU-0006Vt-4X for bug-gnu-emacs@gnu.org; Thu, 08 Sep 2022 18:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oWQKT-0000hZ-Ol for bug-gnu-emacs@gnu.org; Thu, 08 Sep 2022 18:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Sep 2022 22:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52349 X-GNU-PR-Package: emacs Original-Received: via spool by 52349-submit@debbugs.gnu.org id=B52349.16626773352685 (code B ref 52349); Thu, 08 Sep 2022 22:49:01 +0000 Original-Received: (at 52349) by debbugs.gnu.org; 8 Sep 2022 22:48:55 +0000 Original-Received: from localhost ([127.0.0.1]:60452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oWQKN-0000hE-12 for submit@debbugs.gnu.org; Thu, 08 Sep 2022 18:48:55 -0400 Original-Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:56463) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oWQKK-0000gy-Oz for 52349@debbugs.gnu.org; Thu, 08 Sep 2022 18:48:54 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id CBE56320069B; Thu, 8 Sep 2022 18:48:44 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 08 Sep 2022 18:48:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1662677324; x=1662763724; bh=XVBMlt0p1I C7lUMXHIzGO9hxvMkQz4jVXv9QHpRKZug=; b=kuVMRpW5uKvEYjAZxVwfZdm06c NihKev8nWiVs1/L55+srbdCuuo8rTXz5KV5sFP91EFeDNnC8jCVdCjc9J8YEFyf5 YkXq0sHVcuiwpx5Xy4rW5V3JtTXTDeg/7pwRyP3uzOUnexQTIj2WxHwa9cuT8pxt p+Pl3BeBsQlWl6xNduWC38cH9nz2+Q+0cHmhmy4Dolf+c/dHgTw3A5ngv3oDbW3R 9wUlcWscG4XBM7wcjYKaMKzsLezKI+VYmc13HQlcwfxyPAXuKz5XHuAilwmqgtnL gspkAKNopWiTYNUW1KxJGa0MHd3VC710ygNqAXNi1BHYxr/mFrOTaZAuTFWg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1662677324; x=1662763724; bh=XVBMlt0p1IC7lUMXHIzGO9hxvMkQ z4jVXv9QHpRKZug=; b=fxEGVHQfgpQjGvia28UAQlBl8KSFykuXa/rP8SluvUPR tHEmsQnVaAnncrko4pL29GZf7z9sFv1+E63XN3iOEeRN4SQZ5sjFRNdCpw9CUihS jrO65bo+SJm1+D5swjavrpwcMIOJ3MFLF+80dzfd37YDNxSM2mG1rP6XfBJZu/hC rD1ROPHMJh+5d/nG0EeYL7SYUqsXw58rmpmPRP1DJqpkxzyc+tJFj/a34/IbNpyO yvUTuGw8s0xjD18lKK0aQNdId/7rRHjX5uVFipiW3N3v1BweccHTbfKKqrmIfKRK zCMrhz/LgU2X6KVcTlbcYc+qtecr6W6Vm7vjvubMow== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedtgedgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnhepffeutedtfedvtdetvefgueefjefggedugfefuddtgeefteek heduvdefjeejieefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 8 Sep 2022 18:48:43 -0400 (EDT) Original-Received: by melete.silentflame.com (Postfix, from userid 1000) id 77B587EAF02; Thu, 8 Sep 2022 15:48:42 -0700 (MST) In-Reply-To: <86fsh1ll5y.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 08 Sep 2022 22:29: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:241946 Archived-At: Hello, On Thu 08 Sep 2022 at 10:29PM +03, Juri Linkov wrote: >>>>>> Perhaps we should also check that there are no existing staged changes for >>>>>> those files, and if so, abort? This way we won't commit anything else by >>>>>> accident. >>>>> Will do later. >>>> Shouldn't be too hard, if we don't try to do it eagerly. Just add a check >>>> inside (when vc-git-patch-string ...) in vc-git-checkin. >>> + (unless (eq (vc-git-command nil t nil "diff" "--cached" "--quiet") 0) >>> + (error "Index not empty")) >> >> user-error, maybe? > > Oh, it has a sad shortcoming: this feature can't be used when a new file > is added with 'C-x v v' since new files get added directly to the index, > and checking for the empty index raises the error for the whole changeset > with modified old files and new files. VC is a bit strange with adding and deleting files with Git -- doing so stages the additions or deletions, whereas in every other case VC doesn't use the staging area at all, except as an implementation detail when actually committing. So when you add or delete files you end up in a sort of transient state that you aren't otherwise in. What I've been doing is immediately committing any additions or deletions and then preparing --amend commits with the changes to existing files, using your new feature. Would it be too disruptive to make "registering" a new file with Git a no-op, and then require the user to commit it by going to VC Dir and marking it? That's the only alternative I can think of, given that it's common to have lots of untracked, unignored files around you don't intend ever to commit. -- Sean Whitton