From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 16 13:33:06 2022 Received: (at submit) by debbugs.gnu.org; 16 Dec 2022 18:33:06 +0000 Received: from localhost ([127.0.0.1]:50880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6FW6-0005C7-8x for submit@debbugs.gnu.org; Fri, 16 Dec 2022 13:33:06 -0500 Received: from lists.gnu.org ([209.51.188.17]:52190) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6FW2-0005C1-28 for submit@debbugs.gnu.org; Fri, 16 Dec 2022 13:33:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6FW1-0003bz-JH for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 13:33:01 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6FVz-000792-HF for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 13:33:01 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id D3FD95C003D for ; Fri, 16 Dec 2022 13:32:56 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 16 Dec 2022 13:32:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t= 1671215576; x=1671301976; bh=HvQGyctllnKUunpdmwisukdhBO+N4RZgWpw ZICMip3I=; b=ny8D2mj+tJYb0C23LkOY+R9+nLrUs9toXASffJZaRgmc7hDh9KQ 5nO+wIUOm8VvtAlWLRE96eZNzcrDmKyJeW3VtGkTMgKwqAcVmE0JRFVKiPODcbUj 7YXkkEOwXCy5yT6qZOzNAs0HqjVRGbbrjKiBk2FDOtP8cykieiMfjv43PbeYC6ie rJHEjVCaB5dqSWrPSij450EMXna3LY1OURYpbVG53Ox6ZG/fByzdcSQdhdhCdnB2 eB7yaHc0IWgaKQgb8t+CLTzDa+bvWH2EW0sQKHtNKAHGX4lQrvzQiivr7WPRjSA1 Ed2Ow1MWqbk3U8R51Y43CwsHyo2+waQx0Xg== 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:message-id:mime-version :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=1671215576; x= 1671301976; bh=HvQGyctllnKUunpdmwisukdhBO+N4RZgWpwZICMip3I=; b=Q v7/qKDOL5t4RDWlZfYMULWDUqukmJIkCxBLgURMPICaq8xi/EPvSRfTJ+h7JnVrI qg7OSI6tWDbx43Jyll26Ijlju+Qtwm8BJNe69KYTocR7gTH4xMdbSA0igYb0P3Bt KhpOaxnHEZYkySCUTh8J+e1bCJceTomB+RR6UV3qW8zk8mVQnTl8leCrlO9O/iqu ceolC9Q8aNhQDLAkBQm2OqYtmXS0VF5laKgMqdjEtyUK+mSNX9S1yZn2EQXh7J9R snJpXGRHNrJf/ZgUkmcWbh+HSfxgApJ4k9Rsabe9A+Sfikbl0NN6nsGjRONi1b4K 6Uh/TZVKUCja+WnnImgiQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejgdduudduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkgggtugesmhdttdertd dtvdenucfhrhhomhepufgvrghnucghhhhithhtohhnuceoshhpfihhihhtthhonhesshhp fihhihhtthhonhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeelhfevhffhvefgteeffe etueeuieekvdfftddtveevkeelffejffevffdugeejgfenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsphifhhhithhtohhnsehsphifhhhith htohhnrdhnrghmvg X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 16 Dec 2022 13:32:56 -0500 (EST) Received: by athena.silentflame.com (Postfix, from userid 1000) id 6A63E1B6346; Fri, 16 Dec 2022 18:32:54 +0000 (UTC) Date: Fri, 16 Dec 2022 18:32:54 +0000 From: Sean Whitton To: bug-gnu-emacs@gnu.org Subject: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="PTDfVvaC6/GuvJJJ" Content-Disposition: inline Received-SPF: pass client-ip=66.111.4.28; envelope-from=spwhitton@spwhitton.name; helo=out4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --PTDfVvaC6/GuvJJJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-debbugs-cc: juri@linkov.net, dgutov@yandex.ru I seem often to end up with a nonempty index when trying to commit patches using C-x v v from diff-mode, so I came up with this patch. -- Sean Whitton --PTDfVvaC6/GuvJJJ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-vc-git-checkin-Offer-to-unstage-conflicting-changes.patch" >From b30ed86e2d2277c94a6655e9ebdeb8253805899d Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 16 Dec 2022 11:28:20 -0700 Subject: [PATCH] vc-git-checkin: Offer to unstage conflicting changes * lisp/vc/vc-git.el (vc-git-checkin): When committing a patch, if conflicting changes are already staged, offer to clear them, instead of just immediately failing with "Index not empty". --- lisp/vc/vc-git.el | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 2876a983fb0..dcb51bb933f 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1030,23 +1030,33 @@ vc-git-checkin (with-temp-buffer (vc-git-command (current-buffer) t nil "diff" "--cached") (goto-char (point-min)) - (let ((pos (point)) file-diff file-beg) + (let ((pos (point)) file-name file-diff file-beg) (while (not (eobp)) + (when (looking-at "^diff --git a/.+ b/\\(.+\\)") + (setq file-name (match-string 1))) (forward-line 1) ; skip current "diff --git" line (search-forward "diff --git" nil 'move) (move-beginning-of-line 1) (setq file-diff (buffer-substring pos (point))) - (if (and (setq file-beg (string-search - file-diff vc-git-patch-string)) - ;; Check that file diff ends with an empty string - ;; or the beginning of the next file diff. - (string-match-p "\\`\\'\\|\\`diff --git" - (substring - vc-git-patch-string - (+ file-beg (length file-diff))))) - (setq vc-git-patch-string - (string-replace file-diff "" vc-git-patch-string)) - (user-error "Index not empty")) + (cond ((and (setq file-beg (string-search + file-diff vc-git-patch-string)) + ;; Check that file diff ends with an empty string + ;; or the beginning of the next file diff. + (string-match-p "\\`\\'\\|\\`diff --git" + (substring + vc-git-patch-string + (+ file-beg (length file-diff))))) + (setq vc-git-patch-string + (string-replace file-diff "" vc-git-patch-string))) + ((and file-name + ;; Check the regexp extracted an actual file + ;; from the 'diff --git' line. + (file-exists-p (expand-file-name file-name root)) + (yes-or-no-p + (format "Unstage already-staged changes to %s?" + file-name))) + (vc-git-command nil 0 file-name "reset" "-q" "--")) + (t (user-error "Index not empty"))) (setq pos (point)))))) (let ((patch-file (make-nearby-temp-file "git-patch"))) (with-temp-file patch-file -- 2.30.2 --PTDfVvaC6/GuvJJJ-- From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 12:27:45 2022 Received: (at 60126) by debbugs.gnu.org; 17 Dec 2022 17:27:45 +0000 Received: from localhost ([127.0.0.1]:57026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6ayP-0005dG-96 for submit@debbugs.gnu.org; Sat, 17 Dec 2022 12:27:45 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:38445) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6ayM-0005d3-Ki for 60126@debbugs.gnu.org; Sat, 17 Dec 2022 12:27:43 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 54C08C0004; Sat, 17 Dec 2022 17:27:31 +0000 (UTC) From: Juri Linkov To: Sean Whitton Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: (Sean Whitton's message of "Fri, 16 Dec 2022 18:32:54 +0000") Organization: LINKOV.NET References: Date: Sat, 17 Dec 2022 19:06:50 +0200 Message-ID: <86sfhe2i4t.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, dgutov@yandex.ru X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > I seem often to end up with a nonempty index when trying to commit patches > using C-x v v from diff-mode, so I came up with this patch. >From the version 30.0.50 in the subject do I correctly infer that you propose this patch for master? In master this could be installed immediately, but for the release branch I'd prefer first to test it extensively. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 19:20:13 2022 Received: (at 60126) by debbugs.gnu.org; 18 Dec 2022 00:20:13 +0000 Received: from localhost ([127.0.0.1]:58796 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6hPY-0003p6-NZ for submit@debbugs.gnu.org; Sat, 17 Dec 2022 19:20:13 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:39225) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6hPX-0003ow-G7 for 60126@debbugs.gnu.org; Sat, 17 Dec 2022 19:20:12 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4C0475C00B0; Sat, 17 Dec 2022 19:20:06 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 17 Dec 2022 19:20:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671322806; x=1671409206; bh=IR 2xM+72hbYTxNDsCL7CDYaui3HSKi7ceG2gIOWJx+A=; b=ispna4dC35RD5k2yS2 ZstrY7tjMDMHPI+3aNy2e6bsHm1cvh4XlgYSR24scwMiJLEAIx7r6Fp/lhOjC2So jr+7tKM5nbVCJBSgvL40Km03TE338pE5cTWn5O5RqOGLupM8EWTh+qE55kcXsYK2 WfZGh6dBKg/q9Cmhy/i4N7VBNch+vdaNowxnx7pwroUkJnGa2i6Yb2YcaYfYt+xd raIhpnvPcp5bs960jUAq1v2dsXkIJVpqp5raGrwwE/eWjqkfPGPTZtQZr9vlDRuc Xgk1+VP+b6PHnRqT7OgCka21iVz4ELSUkHbulQRHs4EIRrW69d1wM+YpyRdaEKSn okfQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671322806; x=1671409206; bh=IR2xM+72hbYTxNDsCL7CDYaui3HS Ki7ceG2gIOWJx+A=; b=sa6KbHY+1AIPkFFyDrjR7BvVUlxk7U2JPnejsYdUiJ+Y 5kZt1CZlpG4kGPyW3RplofGKNpB5va3ZtKEj1+RZxGFkMUgAb7l6eCn/lJqk0cru UivjZTOr93QHP2ZLgBxM/BDoFmhQWiXtxYnn3DGQCOd1KxUPN7I9z0URSOltqsJW UFiUdh8hPu+oEIuzoOMeHUArB8Pl04VidyNIqoFBvY+oAqMNroDslIqDP7FYlI0d HtZVYj9NQeWl3pSd5Zlz8KFe1s5b97eHlH4NMOeXGf3A2iljIfgAAmK4VpvwFrdm XPMmDe6CT8oc5feQksLBP+j2R+F/Tfzv9f8oW73h0w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedtgddulecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Dec 2022 19:20:05 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 035057EE3CA; Sat, 17 Dec 2022 17:20:04 -0700 (MST) From: Sean Whitton To: Juri Linkov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <86sfhe2i4t.fsf@mail.linkov.net> (Juri Linkov's message of "Sat, 17 Dec 2022 19:06:50 +0200") References: <86sfhe2i4t.fsf@mail.linkov.net> Date: Sat, 17 Dec 2022 17:20:03 -0700 Message-ID: <87mt7lwojw.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, dgutov@yandex.ru X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Sat 17 Dec 2022 at 07:06PM +02, Juri Linkov wrote: >> I seem often to end up with a nonempty index when trying to commit patches >> using C-x v v from diff-mode, so I came up with this patch. > > From the version 30.0.50 in the subject do I correctly infer > that you propose this patch for master? In master this > could be installed immediately, but for the release branch > I'd prefer first to test it extensively. Yes. It's a new feature, so I don't see how it could go on the release branch? -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 20:08:13 2022 Received: (at 60126) by debbugs.gnu.org; 18 Dec 2022 01:08:13 +0000 Received: from localhost ([127.0.0.1]:59012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6iA1-0006d3-1w for submit@debbugs.gnu.org; Sat, 17 Dec 2022 20:08:13 -0500 Received: from mail-ed1-f43.google.com ([209.85.208.43]:35536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6i9z-0006cw-3e for 60126@debbugs.gnu.org; Sat, 17 Dec 2022 20:08:11 -0500 Received: by mail-ed1-f43.google.com with SMTP id i15so8504456edf.2 for <60126@debbugs.gnu.org>; Sat, 17 Dec 2022 17:08:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=Z02pN4fYp5TJGQAlDjPidpSy18+uHrJUmZgM7TgqyM4=; b=enGyIBH/S3x5WNxUhstxdZYfwiePbtp8XQKbvtAgptaAvvJmoggvvdpNFX5VO0hzl4 TsDWWlV+3Rozq/++QWoe7YJMqT/rnFFJxxT2lQXW1SqElQ0VRwHqQ+3PnnRD/Ha8eA68 HKTOi7gs4EWCqDpFKZDYOxZdKXYJ62kS/bnyECvakUMT5/IBBC//e79tGTjBqFZ4hh9b p9CGRmYkhzesUKq7xU49ZY1WNgx7GqzamUNGGsUzVIbNYgDpxTVCIEkZomj7/PYHhVRg wDwiV9Ahg2CSE39Lrig34gelBgEoghRFTUNSowQoLwpk9c1BVOVoZXyp1fOvjee2Ov3C vGGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Z02pN4fYp5TJGQAlDjPidpSy18+uHrJUmZgM7TgqyM4=; b=R9O1glnByGOnsoxuHwPQhEG7T0EI4jMVpcceVYRpZnJpgFTFwLKVIIn6osVpuhyt4j bRztd9QbKnLSLoV2anpdf5VAOBSMdp1y1gkVCDTN8meR8kHQxQqeu+PgHvLVOHxcjPId /qJFuqmEIwYYf1ZZoSIZdMWIvq9PDXVZDuo8ls10GgVl2oirTZePZ2mlOUwcw61u0zbU LJTZQ8r4QVxRGZs/dR1ueYZfKtkD5Q2Bi9XveS1iRtAlGyxme4umQQKYQnnFyvxBxmhm CNbj1fvQ0JtfD9UOY8JAADjYA7I3/USsUGv+MLWvwgrvQ2PrndgyttmXX30DoKs0uEvM ZibQ== X-Gm-Message-State: ANoB5pnas11umwy/fKzDxjEK9ZSpE4g5jony+v81FUatbiCU4hu1kIYo IhLVu79axyhLGjbcJcVBJiQ= X-Google-Smtp-Source: AA0mqf4lHlC5vIHRgh62aJ65MiOlbliZWiY/Sc5r79DL5ADTFntxmexrlvl85YVVMBx+j9K4dtmvoQ== X-Received: by 2002:aa7:db43:0:b0:46c:2c94:d30b with SMTP id n3-20020aa7db43000000b0046c2c94d30bmr44419896edt.33.1671325684064; Sat, 17 Dec 2022 17:08:04 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id a1-20020a170906244100b007b2a58e31dasm2621666ejb.145.2022.12.17.17.08.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 17 Dec 2022 17:08:03 -0800 (PST) Message-ID: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> Date: Sun, 18 Dec 2022 03:08:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Content-Language: en-US To: Sean Whitton , 60126@debbugs.gnu.org References: From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 60126 Cc: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 16/12/2022 20:32, Sean Whitton wrote: > I seem often to end up with a nonempty index when trying to commit patches > using C-x v v from diff-mode, so I came up with this patch. Thanks! Perhaps we should offer to stash the changes, though? Starting with Git 2.13, 'git stash' now has the 'push' subcommand which accepts individual file names: https://stackoverflow.com/a/5506483/615245 Or make it a three-way choice with read-multiple-choice. From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 19 17:30:30 2022 Received: (at 60126) by debbugs.gnu.org; 19 Dec 2022 22:30:30 +0000 Received: from localhost ([127.0.0.1]:40729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7OeU-0008KR-5H for submit@debbugs.gnu.org; Mon, 19 Dec 2022 17:30:30 -0500 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:48027) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7OeQ-0008KJ-Vn for 60126@debbugs.gnu.org; Mon, 19 Dec 2022 17:30:28 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 2F9703200947; Mon, 19 Dec 2022 17:30:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 19 Dec 2022 17:30:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671489019; x=1671575419; bh=ug Q23ZUavqK6sdZCaB8F+qdnhfBgPgxTBzLMxmo8UCY=; b=koyTha2EWY0o9b9Ydw Z7UEgmo8B4Iux3odn84buEY+WMOcaVEMDb1Uz41/0tWr1qPlxUBeUZifvq2IGaKT h1n1MB0mJwIvpbY5BCgL4lWpP4mPh6Rc9lsLbqJ4u5uDqsggdSTvy5vmVPbRnGRu e/Vo4PyviD4bDJYasWUsvtDOF3FbLmGMMggiTraHz1vFtYBdLO3DebiVFbvEEZ7e yFG41q/NyMare4freIKF0ig4AkclRGuV0J6S2RREzGntWtF9WH7XZ7Nxkq+5ZyxI GDebuhhnGl1NIZgYEBXp59k8pVywNykrRIC7obBZ+VzTp4iWHDOfH+MxemOLGLRz 2uLg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671489019; x=1671575419; bh=ugQ23ZUavqK6sdZCaB8F+qdnhfBg PgxTBzLMxmo8UCY=; b=Q/Rt3FXzcqnmXnM0mQ/9XEZ6uCb/BB5bkoHJEW9pw0eH 3EVkg2VKrAhxnW+3/VdZpzeT3/oVVMapQlcAzG0NFzbaO9Q18XW4PahvQBIx81kK ntg9EngEehFTT+naaRkr1Octl7nJsQR7W0aYz3WFdhLGQorgywadq5hkCZTnTBFG N9zRlANQVwkah5Q7Y7z9g1ex4TtdyBZO+ZF3kzwIqMzLdmbGY8RaPxZyVPSEGf8u A1SAG56sknL21EcDh5oHlNnfFpZbxLFCTiA5c/4LvLqyCXwlereeNwf+HMWfckVa khoomiTHzyObN78N+GIcivOmlPJIynwJ1lZQsfP0Xg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeefgddufeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffffkfgggtgesthdttddttdertdenucfhrhhomhepufgvrghn ucghhhhithhtohhnuceoshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpeefgeduhffhhfeifeeijeeutdehteetjeetffeuieeihffg uddtgfdvkeekfeelteenucffohhmrghinhepshhtrggtkhhovhgvrhhflhhofidrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsphif hhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvg X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Dec 2022 17:30:19 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 015847E0B44; Mon, 19 Dec 2022 15:30:17 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> (Dmitry Gutov's message of "Sun, 18 Dec 2022 03:08:02 +0200") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> Date: Mon, 19 Dec 2022 15:30:17 -0700 Message-ID: <871qovjabq.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Sun 18 Dec 2022 at 03:08AM +02, Dmitry Gutov wrote: > Perhaps we should offer to stash the changes, though? > > Starting with Git 2.13, 'git stash' now has the 'push' subcommand which > accepts individual file names: > > https://stackoverflow.com/a/5506483/615245 > > Or make it a three-way choice with read-multiple-choice. This is a nice suggestion. A step further would be to unconditionally stash and unstash. Given how committing patches with C-x v v works, I don't believe it can ever be the case that the stash is not applicable afterwards? If that's wrong, I'll implement what you suggest. -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 19 19:53:41 2022 Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 00:53:41 +0000 Received: from localhost ([127.0.0.1]:41366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7Qt3-0001B4-Gh for submit@debbugs.gnu.org; Mon, 19 Dec 2022 19:53:41 -0500 Received: from mail-wr1-f46.google.com ([209.85.221.46]:44977) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7Qsz-0001Ax-KL for 60126@debbugs.gnu.org; Mon, 19 Dec 2022 19:53:39 -0500 Received: by mail-wr1-f46.google.com with SMTP id a17so9162403wrt.11 for <60126@debbugs.gnu.org>; Mon, 19 Dec 2022 16:53:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=z82fZLCGi66c+b1miW7PLVBO7Y2Kd9Vo8YmcQN/DJ+w=; b=TtG6nF6d/PeN8hEf9hqK85FQPSmvKgudDgB9Io22U7VlWXQ+YsIa4edK4qDiYSIL3R FGg3T2lS785Gowh2aW1MSEZpCWHoNqCG9JSSyeFEe2lqq+Xg/z3sEJuFJOeGZMVFGePl 2HkSl2rNR+s1ggT6CaJjoH8ZPgDWGVwESaaABGAYInvjSkhct22XXnukirXNXa8GJmUx d+I/FIQ3ancQGxddrwpwu63YlGOXH4JJXqfOXsan0egYWpSeMjo0W+S8ViVRoRu0YURJ 8k+grtuH4PowPdOufrWuFNpP+gOn+2ckpmRSm37/OTTyIPtqO8Z2GHeO2iOcNg7/l1Wb x4zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=z82fZLCGi66c+b1miW7PLVBO7Y2Kd9Vo8YmcQN/DJ+w=; b=LEcDNQYv9SyCehyrypgi1vlqqf9JW8nr7Da+9Vl/kKnIJV1N/UEe7icoGhwgzl3z/u 4Wor4bRvkOfVyjRGGornJTicoK34lBtj/Yixrhwrjft40cn2TxToKKN8qw3wSO2PEkpd 2gmKzM7jkbiH2/tS+3RtMPrIZqc8IuV6Y+iIGMbIuYRZAn0raqZ8tCU9PBVtvVNRXjVq KoHr8zAVrMhxQh3HnB4nl8rzX2wsxeO0rNVrdAPmJcIoFVCFYsorSdKoTj+pjrgNWfWe e0qt9HZ/0g1kxK1QbKZ+HcoBMdmHspfVamwlEcw/j5WOdxo2TjtJIRP8sFsyl0zMNVHm 1ktg== X-Gm-Message-State: AFqh2kra26zEg2qy136MSgI7EawbSJXlGjlBfxH7o4h21a9UBBSqTCkt zyreI52Wgco6EFXVGZo0wWE= X-Google-Smtp-Source: AMrXdXsLCDKlTMKsziuNjewt1W7NSUaPXydzjV5yUglfGdChNYyPnfKUhY/pH+hM+QNX8WtqV89cvg== X-Received: by 2002:adf:f6c2:0:b0:25c:bb30:600f with SMTP id y2-20020adff6c2000000b0025cbb30600fmr184763wrp.7.1671497611491; Mon, 19 Dec 2022 16:53:31 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id bx33-20020a5d5b21000000b002420a2cdc96sm11405006wrb.70.2022.12.19.16.53.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Dec 2022 16:53:30 -0800 (PST) Message-ID: <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> Date: Tue, 20 Dec 2022 02:53:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Content-Language: en-US To: Sean Whitton References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> From: Dmitry Gutov In-Reply-To: <871qovjabq.fsf@melete.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 20/12/2022 00:30, Sean Whitton wrote: > This is a nice suggestion. A step further would be to unconditionally > stash and unstash. Given how committing patches with C-x v v works, I > don't believe it can ever be the case that the stash is not applicable > afterwards? I'm not sure that's 100% true, given that we'll want to stage the contents of the staging area (which are supposedly represented as diffs against the last committed state), and our command, while keeping the contents of files on disk intact, moves the last commit to a new state. > If that's wrong, I'll implement what you suggest. ...but we might as well try and experiment. Worst case: the stash won't apply cleanly and the user will have to do it by hand. That would mean no big loss of information, at least. From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 20 01:43:58 2022 Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 06:43:58 +0000 Received: from localhost ([127.0.0.1]:42887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7WM1-0007MU-Sg for submit@debbugs.gnu.org; Tue, 20 Dec 2022 01:43:58 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:53181) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7WLx-0007MN-81 for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 01:43:56 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id AC0745C0106; Tue, 20 Dec 2022 01:43:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 20 Dec 2022 01:43:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671518625; x=1671605025; bh=v3 b28gKpmRZABD39TYS9nDHxW+NJBHiMZWFaH0qDKGw=; b=l0sSXdp4IFYFlIxY9f Y4Ri2TqnNL2QHEh+f2fTXWVnRxQ7beHxsXDzugUbIEtYGTGSLH86TozS8pyMcx0U KtHxvsac9vm4rdvVRW3ZOqFtfudEY+IwJsfR8baZaqoEr71f5FTlX92+OKov4HeT XNfinsmQzHZF37WhIOsYrzM9pSFWdqt1XG2lb4HTlzQnWHHRcYeDmdRsH/UEByDC fC4KArUtjqF4S9kV7vXhIQvQ8CTbWrUZIC8uvInZ/Yd8FB1VfhKs1WRPqmWHpMS6 ckXEstnf867uncorlx6f3s43R/zD1PqgMj3U+7Wxlz1XE+Lqn6Y06fjaj51hFsL2 TSrw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671518625; x=1671605025; bh=v3b28gKpmRZABD39TYS9nDHxW+NJ BHiMZWFaH0qDKGw=; b=FYpHWrAt2j+Iv3YSMguom6QEQ4N3OVUjcq0UBDDsEJdP kg790HQZr83U0kYUJjX4M2gniyudd5j1aMM8gAAN8AiuM1UbrTR/Dvf5Ny8YRLxE 2ijZ77nR+DZerl23VKmdO3pX1MOuXT5vYvahw0zUXXxQEf2PumWsz355/TFkuftO S17vkAAUKyHZAoGkwTyYUviARRtEhzjFLaR819YkmwXm/RjZ4QIRR30Y9fW8hVyg BVQtDQusxkfNZ3saDPWTn5YHx9eXBW+CxBDt77FQYUNAR+V0J+CZAgc69nhXvdBk JyxYSLqjemE02HX6Tg1kbnpgrnN4bsYNgCpVWO2nHg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeeggdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Dec 2022 01:43:45 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 6BCF57EFE85; Mon, 19 Dec 2022 23:43:44 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> (Dmitry Gutov's message of "Tue, 20 Dec 2022 02:53:28 +0200") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> Date: Mon, 19 Dec 2022 23:43:44 -0700 Message-ID: <87zgbih8wv.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Tue 20 Dec 2022 at 02:53AM +02, Dmitry Gutov wrote: > On 20/12/2022 00:30, Sean Whitton wrote: >> This is a nice suggestion. A step further would be to unconditionally >> stash and unstash. Given how committing patches with C-x v v works, I >> don't believe it can ever be the case that the stash is not applicable >> afterwards? > > I'm not sure that's 100% true, given that we'll want to stage the contents of > the staging area (which are supposedly represented as diffs against the last > committed state), and our command, while keeping the contents of files on disk > intact, moves the last commit to a new state. Good point about the representation of the index. In addition, you can't stash just the content of the staging area, and not also the working tree, without hacks -- see `magit-stash-save' as called by `magit-stash-index'. I don't want to reproduce those hacks, so I was thinking we would be stashing both the worktree and the index for any and all files that have any changes staged. However ... >> If that's wrong, I'll implement what you suggest. > > ...but we might as well try and experiment. Worst case: the stash won't apply > cleanly and the user will have to do it by hand. That would mean no big loss > of information, at least. ... for files that are modified by the patch to be committed, it's very easy to generate situations where git can't or won't apply the stash. It's true that there isn't a loss of information, but it's a frustrating context switch for the user, who might not have even realised a stash would be created, and now has to untangle things. So, I'm now thinking: - automatically stash index+worktree for any files with changes staged that are *not* modified by the patch to be committed - offer to unstage any files with changes staged that *are* modified by the patch to be committed. This way, we have to prompt the user only when files involved in the patch have staged changes, and we shouldn't ever force the user into dealing with a stash that won't apply. -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 20 08:47:16 2022 Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 13:47:17 +0000 Received: from localhost ([127.0.0.1]:44977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7cxg-0002QK-Lf for submit@debbugs.gnu.org; Tue, 20 Dec 2022 08:47:16 -0500 Received: from mail-ej1-f54.google.com ([209.85.218.54]:44614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7cxd-0002QE-MM for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 08:47:14 -0500 Received: by mail-ej1-f54.google.com with SMTP id x22so29264262ejs.11 for <60126@debbugs.gnu.org>; Tue, 20 Dec 2022 05:47:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=ax1QWtYQ218fJOwNsdt2BYpJPAzBTkxtS5ajeKXIWn4=; b=Fuwo4hljDAnZdUwtiW9X6ztsZOgRKgry5pAyoSLpHBMtiDKB0njh8aAB3JjVJtT5Qu JROtHSEHJ15Ndjj13wKLTZAdKP6rNXBSU1VqTtyQ3WBljKxC3Afw/O9HS1R33KFxIZ7k O4ucMpscsbjG3lLWOiaw2CpBFbHETouUps+8arHkQS5JhFP52F3GHBbd/IwD9KbzBP5U AP0FyBA8P7ENtnIbGUfeVcVG3oA817EJu8FLWORjXQl2IbzJvVEAQnZY1bOV+pRpNdKu h1KT2IEdAWPKcMHF9Xi6MSHnSzFjHuLGTdsEpAgm/SEQ32h9xN82Dl9eY1+U5k23SDq8 QOZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ax1QWtYQ218fJOwNsdt2BYpJPAzBTkxtS5ajeKXIWn4=; b=Eh3MYBIbBWKuRDYmdNcooX24vB6fHc9KMrtveRIeLCpHBdoH7R7k/50TQVcY/BW9G+ URO8Udg7nOg8pgfMMbwDAwWllhdKRbwYnfZswDH+G/mXC0cLtels9htlz5703NZFzzaa PyRLLf3xuuNU9Ja2OIa1LWsX0LeCONphQCyE1CkwnZj6LK6HdTEY+wVTk86b1e4kjoDi j8C/ivzwRFhNFJe/VQUY8MP3xnlxP1tPT2orOWNULfk1QvCNg/J8RgmgovzhxxsHxaEC LG9HnNFmkItmVBCip59kd8s/N2eJZ/tU8jyxYMBlNLp0kHEb8EycZp02jPJ0sYL1jWdR JF+g== X-Gm-Message-State: AFqh2kpzO3/z7ikqNMR3ldqjWMArlYPIq0aW02tNWw+QJMnu9VRIOAvR ckfJ72mrsP+ucVu5jULCXrc= X-Google-Smtp-Source: AMrXdXtXtfP5inSSUgTYx+gn6W9vNt0Y9Qon7kUFhaoP8rFNuyYgbIss3gb1RHqlzrPzcWHao2VcsA== X-Received: by 2002:a17:907:8a1e:b0:81b:f617:eb99 with SMTP id sc30-20020a1709078a1e00b0081bf617eb99mr10504885ejc.67.1671544027623; Tue, 20 Dec 2022 05:47:07 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id d6-20020a170906304600b007c1a6692aeesm5673416ejd.189.2022.12.20.05.47.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Dec 2022 05:47:06 -0800 (PST) Message-ID: Date: Tue, 20 Dec 2022 15:47:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Content-Language: en-US To: Sean Whitton References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> From: Dmitry Gutov In-Reply-To: <87zgbih8wv.fsf@melete.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 20/12/2022 08:43, Sean Whitton wrote: > In addition, you can't stash just the content of the staging area, and > not also the working tree, without hacks I think git stash push --staged -- file1 file2 ... does that. From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 20 10:13:21 2022 Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 15:13:21 +0000 Received: from localhost ([127.0.0.1]:45421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7eIy-0005fJ-LY for submit@debbugs.gnu.org; Tue, 20 Dec 2022 10:13:20 -0500 Received: from mail-wr1-f45.google.com ([209.85.221.45]:45850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7eIx-0005fD-01 for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 10:13:19 -0500 Received: by mail-wr1-f45.google.com with SMTP id h16so11991692wrz.12 for <60126@debbugs.gnu.org>; Tue, 20 Dec 2022 07:13:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=5xeEHCXHF8b3bmkoajZUd97vcKCCKxBLzASn7HoI49c=; b=gEmk9PCqTtHc2SgRqq242/bPSPOGYucXOGC3NEoiA2J/Rjdj6RLiyQhbGhXyQs1Cts d1uZ7F603KzEdpK4dU7orl/CXcaRLKBSR6gkVLiDC9IjIUgPbt2+4bYhBwa1AfPKb79L sjtT5IMiBd3SWgsphoH0Qw43ZyHju+B7j7CWSM55IKfrlRik1dxI/gmGuh4MaSv5vOUU +CZ6t5OoDAEZ8OaiE/Fy9oeCVQHdNDNy/jSQdsW+01PhRjILvoG428GzLqfmZNaHz4Wo z6pzMVuz20E4uA2lNBKhoQ03KCyGGjxtJUlNVkDjh194beMgTHFVWQKYxYt6mwNHaPTn +U3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5xeEHCXHF8b3bmkoajZUd97vcKCCKxBLzASn7HoI49c=; b=l5fMA4O5LiTzWsAba9XHT7fvuIknX/fC0oJTisS3qzCzDGMJ4zQ1x7gSBdxoVVrB4h kxhhcOnviidcR7/yYnuBsz6O5ux4HemrppfLCZ3EHlyM5GeXdauRA39exleadHh3I3sf 3YhBPRs3SK+TYJNPnoEOD7xO/8XdohEvGxToOp2tbHr4PkMxuAsfkuhVzYIDqa/rk0Bh ggBphuq1HIEXFBKd9AIiItDpzNAwjaolozHHE5fiquLQPbp4wJullW91G63cQ7fTNav5 6ApFHiswd7Nyc5gFTYWaTDtYbVyUNbhPrcHEd172a3IFb5GhHxhNNtBcZqr5oB9iqlZh ShCg== X-Gm-Message-State: ANoB5pnG0lkYPVs+YNpLwp2fqfL2Df4Yr1V5xZ8kSs7rCroXSLv7YfwK 6Qbg8al9RiBSS75kQN4HxJM= X-Google-Smtp-Source: AA0mqf4OxzyTaYM0V17X9JeKRV0nIEVy0/vgR9nMKGyRHeQDCPZ4CqIrPtRwDeyOpOeNXqfsoNsuMg== X-Received: by 2002:a05:6000:12d0:b0:242:14f5:7a96 with SMTP id l16-20020a05600012d000b0024214f57a96mr30116762wrx.47.1671549193027; Tue, 20 Dec 2022 07:13:13 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id r2-20020adfe682000000b0022cc3e67fc5sm12751156wrm.65.2022.12.20.07.13.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Dec 2022 07:13:12 -0800 (PST) Message-ID: <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> Date: Tue, 20 Dec 2022 17:13:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Content-Language: en-US To: Sean Whitton References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> From: Dmitry Gutov In-Reply-To: <87zgbih8wv.fsf@melete.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 20/12/2022 08:43, Sean Whitton wrote: > So, I'm now thinking: > > - automatically stash index+worktree for any files with changes staged > that are*not* modified by the patch to be committed I think it's possible to just skip those when checking the index area. And then, when committing, specify individual files to commit from the index. E.g. this way: diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index b5959d535c0..dee102d8586 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1052,7 +1052,7 @@ vc-git-checkin (lambda (value) (when (equal value "yes") (list argument))))) ;; When operating on the whole tree, better pass "-a" than ".", since "." ;; fails when we're committing a merge. - (apply #'vc-git-command nil 0 (if (and only (not vc-git-patch-string)) files) + (apply #'vc-git-command nil 0 (if only files) (nconc (if msg-file (list "commit" "-F" (file-local-name msg-file)) (list "commit" "-m")) (I'm not sure if the list of files is passed to this function correctly when committing a patch; if not, fixing that would also be needed.) > - offer to unstage any files with changes staged that*are* modified by > the patch to be committed. Or we could just abort, like we do now. Up to you (do you encounter this particular situation often?). These could be two separate changes anyway. From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 20 11:47:53 2022 Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 16:47:54 +0000 Received: from localhost ([127.0.0.1]:45896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7fmT-0006js-Mt for submit@debbugs.gnu.org; Tue, 20 Dec 2022 11:47:53 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:53203) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7fmL-0006iW-2d for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 11:47:52 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 485135C00B4; Tue, 20 Dec 2022 11:47:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 20 Dec 2022 11:47:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671554850; x=1671641250; bh=Ro GmqhLoqqqr6aBnZysBn3cBh8IhFeXwhYroMbitk0U=; b=XU62s3eyxHn3CQ0zmL v3BqHn4FvAH8f6qCBKU/MTrl2oG2Kh7PWZE9jkl1rY0gk/W4YltXVk/zB5SWoy6M pzZZ/jwcEIa+5XvVtlGsdNM7jnkPk4y61LtNc/5J4aPN6OvUR3RpE0fs7UFK4ka1 2DNDUsAJ8p4ZqQmfC3Erz90cbPtvsSCVuLmMHGvkF65+qtOp6/wCm0n4U4pB9eyq mXyXVOkp/Xi9SWCzFvPtIDE6+Dbye4cX5nzKQgDXcKuzgSF8AVkDkrAC/NS3xbG9 n9e+TsRYjsggFKWH2dnZQG6ltPMWnEvkyvvvxgtwE/KUA+nMY/iEVJXguipzpu/F bZyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671554850; x=1671641250; bh=RoGmqhLoqqqr6aBnZysBn3cBh8Ih FeXwhYroMbitk0U=; b=MdWnze0zlb7aFITPeiNmkdTEY+pqPuxGHmLIIGWoMYuS OkUGdUjnX1YDFg8c1/UrjJqkh5/UpDeCPzI8rDS9kpb3++0jizdCLJhPGcqaL6/y +dqelwuU4h+n1bmxBv9/ZJ8Ic5SJZllSwSTgxbSkbL4OUkVI0otu/3SQrpPYsUD3 XbW9YOLQsvCHfbfmKiFVmQ8kRd64V00x2QN1otES9LAwpN3oHDpBepIl72//5KfK Z1CEM9bv+qmcbkq9VJ7ewrwVWAqCM32KRxSPSsMt01TCjCFooUZ6QsVGkQYSMuDM xkBJtk5NjZDXQeERw/eO+z5zQOIdluAGK3bMOtxVfg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeeigdeiiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Dec 2022 11:47:28 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id A441A7EFD5C; Tue, 20 Dec 2022 09:47:26 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: (Dmitry Gutov's message of "Tue, 20 Dec 2022 15:47:04 +0200") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> Date: Tue, 20 Dec 2022 09:47:26 -0700 Message-ID: <87v8m6ggyp.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Tue 20 Dec 2022 at 03:47PM +02, Dmitry Gutov wrote: > On 20/12/2022 08:43, Sean Whitton wrote: >> In addition, you can't stash just the content of the staging area, and >> not also the working tree, without hacks > > I think > > git stash push --staged -- file1 file2 ... > > does that. Ah nice, though, my git doesn't have that option (Debian stable). -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 20 12:08:16 2022 Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 17:08:17 +0000 Received: from localhost ([127.0.0.1]:46029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7g69-000738-5K for submit@debbugs.gnu.org; Tue, 20 Dec 2022 12:08:16 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:57773) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7g2n-00070J-GF for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 12:08:11 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 209F65C0143; Tue, 20 Dec 2022 12:04:36 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 20 Dec 2022 12:04:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671555876; x=1671642276; bh=qQ TymcIEF1MhZEZaWAvKs8KRGjcDqp7Zicp4M6CFRfA=; b=gbZrWtpiALP5/rhgfZ RGxa4S/aD1esd7LzCQP3F5+acZBWyyUA5AEZF/ocyKr5W6g9WRC1MaTo7/iLsLWm Je1B3OQUHNeRTAikqVUPfWxcVm1qsZ2BujAQUgqS/lZmIM9lAdIuFUYkhaFPsc1e qi+Ljca3y43ZrSOVGpHCzPGZbSPtWYv4XKpCFrGWcI8hA/Z36k+PiF6CZ22OqFbg cFuD+mSzPjIDY1zzockn/rb1OyYfWc7hqccLST+hjAkRx7YpubEQKykFsbiaTZHW stJ2WVudt5Cpoz0XySTJ2enDvq4WmfAdYF5nmIKUDbT3cvxtQuWTzSNbXzXeVMZE F8zw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671555876; x=1671642276; bh=qQTymcIEF1MhZEZaWAvKs8KRGjcD qp7Zicp4M6CFRfA=; b=VAKvnAUDBb6IrJtdGYwkkc5xt4+koPweup8ttVtVxz+P ZN++aHsSiLGLpDIzSXEG6RlpnWupmEWmtwvmveqlWBxU9Nu8Q4p6ztpBiRYdVpBo 53emRbwX3R27E5t1qxxaHj6l/KTrw3HKeoJzbG60kD1pEQzHKvmhkykmMmiu1oZU xbx4LcUAj15v2OUT51JZS/zGjO/Bb2WNz8GPbURAmuujIyTK5SYod9ishBY8DcV7 J7mJnQSaH/R/s5dsEuO8vI3tAwWHYsAcFXeMrNCo+xl3PsmeJe+dnqC9rR52+7nJ PTcoj9Kid9OAwqKHUmZf5Sm9EnHClPWzi4hF+Z5/Kg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeeigdeilecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Dec 2022 12:04:35 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 67FA67EFFB9; Tue, 20 Dec 2022 10:04:34 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> (Dmitry Gutov's message of "Tue, 20 Dec 2022 17:13:10 +0200") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> Date: Tue, 20 Dec 2022 10:04:34 -0700 Message-ID: <87h6xqgg65.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Tue 20 Dec 2022 at 05:13PM +02, Dmitry Gutov wrote: > On 20/12/2022 08:43, Sean Whitton wrote: >> So, I'm now thinking: >> - automatically stash index+worktree for any files with changes staged >> that are*not* modified by the patch to be committed > > I think it's possible to just skip those when checking the index area. And > then, when committing, specify individual files to commit from the index. Ah, so it is! > E.g. this way: > > diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el > index b5959d535c0..dee102d8586 100644 > --- a/lisp/vc/vc-git.el > +++ b/lisp/vc/vc-git.el > @@ -1052,7 +1052,7 @@ vc-git-checkin > (lambda (value) (when (equal value "yes") (list argument))))) > ;; When operating on the whole tree, better pass "-a" than ".", since > "." > ;; fails when we're committing a merge. > - (apply #'vc-git-command nil 0 (if (and only (not vc-git-patch-string)) > files) > + (apply #'vc-git-command nil 0 (if only files) > (nconc (if msg-file (list "commit" "-F" > (file-local-name msg-file)) > (list "commit" "-m")) > > (I'm not sure if the list of files is passed to this function correctly when > committing a patch; if not, fixing that would also be needed.) It's not usually passed, but it could be. So I think I need to clear out files and populate it again during the loop through vc-git-patch-string. We'll want this always to happen, so in the commit command we'll want (and (or only vc-git-patch-string) files). >> - offer to unstage any files with changes staged that*are* modified by >> the patch to be committed. > > Or we could just abort, like we do now. Up to you (do you encounter this > particular situation often?). I feel like I do, yes, though I'm not completely sure which of the two situations I keep finding myself in. It does no harm to have the feature, at least. Thank you for the input. -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 20 12:16:09 2022 Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 17:16:09 +0000 Received: from localhost ([127.0.0.1]:46063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7gDp-00077V-JB for submit@debbugs.gnu.org; Tue, 20 Dec 2022 12:16:09 -0500 Received: from relay11.mail.gandi.net ([217.70.178.231]:40225) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7gDj-000775-LE for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 12:16:08 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 554FD10000A; Tue, 20 Dec 2022 17:15:45 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> (Dmitry Gutov's message of "Tue, 20 Dec 2022 17:13:10 +0200") Organization: LINKOV.NET References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> Date: Tue, 20 Dec 2022 19:13:30 +0200 Message-ID: <86v8m6m2y5.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, Sean Whitton X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > (I'm not sure if the list of files is passed to this function correctly > when committing a patch; if not, fixing that would also be needed.) A list of files should be correct, but needs more testing to confirm. From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 20 18:10:10 2022 Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 23:10:10 +0000 Received: from localhost ([127.0.0.1]:47672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7lkQ-0005az-3i for submit@debbugs.gnu.org; Tue, 20 Dec 2022 18:10:10 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:41745) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7lkO-0005ar-Hv for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 18:10:09 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 84E9B3200981; Tue, 20 Dec 2022 18:10:02 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 20 Dec 2022 18:10:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671577802; x=1671664202; bh=6s 968GB7lSxxYrSEEdZj+6GBK9zJVN8joONme0MhH20=; b=osG5pOTKZkhPgR599R 2M2baC5I7CMYwgkq5/QM8G/3u/sElGz4d/rofIMNBa1RaSMU5GN+QcPxLqdDDMWf oqnEmwmydk/aVFIowKUU7IS+KciUmxZUNheEivnWw94XXwzP1EFRw3PeaM7MTjd/ xf1fQkm6iv/+TRz6X0d4UjsgXZA3fYtZoNegePW0YqMD6XjN6kBwOejZBIal+3K8 DGY/JUIqsDVWu+f6oWaCkjuOxeOgiRlaYwqdrTQVNKMhRhTB30sPMsQPgYu/Vcvp 72swhM458wDaCbllnSdNjEfWYTi0PXtjkZPBWYwJp0kbOxEcnJXpsLr30ZplA39S +syQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671577802; x=1671664202; bh=6s968GB7lSxxYrSEEdZj+6GBK9zJ VN8joONme0MhH20=; b=Ea3XpZm6pRJfv+39Dvue4Mf9FxeheQIrvpmC/3i5EUeN PVmkRjdp2yW8B9QVx9HPunxXL5aM0E3Eihn15+UZe9lvSONreygmx2rpFcDkBKnc UfqOPOq285G/bzb/paCaN/TggGde70H2RIUdFuavskDpYQpC6sxTQgctxCbsWKu7 GXHuuim+BJzq9H3yZSI8kjSScQlA7JN8SAHWbeETiBexPAA0+s5EOkD8PkGh5+Js Cb04b+czsmlMWuexuVUgdNnDV4KLZ1COtKH7ThRvaiL+34iK1JYeUX+Lyyj9h/21 ctHRiq4zwuFU5bh0W6e4nd4ObBW/NmZhAzLEO6u/FA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeejgddtiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Dec 2022 18:10:01 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 145087EEB39; Tue, 20 Dec 2022 16:10:00 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <87h6xqgg65.fsf@melete.silentflame.com> (Sean Whitton's message of "Tue, 20 Dec 2022 10:04:34 -0700") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> Date: Tue, 20 Dec 2022 16:10:00 -0700 Message-ID: <87zgbh1xkn.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Tue 20 Dec 2022 at 10:04AM -07, Sean Whitton wrote: > On Tue 20 Dec 2022 at 05:13PM +02, Dmitry Gutov wrote: > >> On 20/12/2022 08:43, Sean Whitton wrote: >>> So, I'm now thinking: >>> - automatically stash index+worktree for any files with changes staged >>> that are*not* modified by the patch to be committed >> >> I think it's possible to just skip those when checking the index area. And >> then, when committing, specify individual files to commit from the index. > > Ah, so it is! It turns out this doesn't work: if you specify individual files to commit from the index, then git also includes any changes to those files in the worktree too, and you can't ask it not to, because --only is implied whenever files are supplied on the command line. In other words, when vc-git-patch-string is non-nil, we mustn't pass a list of files to git. So if there are files not involved in the commit with staged changes, we need to stash those. I tried implementing that, which is not hard, but then we pop that stash, the staged changes aren't restored to the index. The result is that if the user has a mixture of staged and unstaged changes to a file which is not part of the commit, then afterwards the unstaged changes will have been unstaged, mixed in with the staged changes again. In some circumstances this could constitute a loss of work. There are a few ways to overcome this. We can use the --staged option, but that's only available in very recent versions of git. We could perform a complex double-stash: - git stash push -k -- foo - git reset -- foo - git stash push -k -- foo - [commit] - git stash pop - git add -- foo - git stash pop Or we could do something like what Magit does to stash only the index. Any thoughts on what would be best? In the meantime, I've pushed a version of my previous patch, as I think it makes sense to implement the stashing, if we do, as a second change. -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 20 18:41:39 2022 Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 23:41:39 +0000 Received: from localhost ([127.0.0.1]:47799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7mEt-0005xf-Ey for submit@debbugs.gnu.org; Tue, 20 Dec 2022 18:41:39 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:47531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7mEr-0005xU-Ch for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 18:41:37 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id EF6B53200392; Tue, 20 Dec 2022 18:41:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 20 Dec 2022 18:41:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671579690; x=1671666090; bh=x2 NZYPjaSq32noLoHv2LsQhY97P06iPPuV8/2SsEvfw=; b=mi/DbsOAlMW1epLWuz MCz/7rq1iXmJ/DRCbUlfXbuwLaCHXu6d1DBtUza1Nj4sMw9iv3g6crOxeq4/CQA+ D3GKb/iIKG2IVEYxANuEvKywfYIj3scSyAxQxCq8NK/7lhzvwU1ynZ8J/jS6yyVi C+c3dzbObjqytCiB18vsCu00X+mjPBcHYtbqt9H8+TZsyikTd0qVEfvBRcKAUpAH gpkuQev5uPbf0/cFM5bEFzLd1PTNsyiGgCcc/OfZ/1DQa+Ng6ta+/oM30qNje2FI qAFkK1PswfDjBlX8fkkfp6psINyr/nsVUAgfGF/rOXXFIJTBBLGolHVIoQM7IKg3 5RWw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671579690; x=1671666090; bh=x2NZYPjaSq32noLoHv2LsQhY97P0 6iPPuV8/2SsEvfw=; b=UFnlHSJVsOM5dJCcu615aM+DXRMa4YoUgueH+ZlQUlJh 3fZ2talpAJSOy3un6ZED1/MlftGttBBl1IA9cR4nMGY0ds6Vnzv+QzNwpEO8mhuL YPGNTEuGw2Hko+H1aQmU8jM9W7xlewJbXPdPEkRtA3my5Ogn7UD+alXb95Ldoc/J Cwae+k7jnE/Y98lVNU55S2p/BfPMHSF4GHhQad4GoEi/VJxaBZC92oYfO6KXI0iM SW0odGMbESt1f9L6OR6VMJX+/u5Ze/Gf6i26FCAkIQE13XH/bTS9C3S0a6r0aKr1 XP/i8P4nHRRtFS9KDJiwL8Kb7f6pLb1vTQJ2lTPfaA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeejgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Dec 2022 18:41:30 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 546B67EFAEE; Tue, 20 Dec 2022 16:41:29 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <87zgbh1xkn.fsf@melete.silentflame.com> (Sean Whitton's message of "Tue, 20 Dec 2022 16:10:00 -0700") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> Date: Tue, 20 Dec 2022 16:41:29 -0700 Message-ID: <87wn6lzlqu.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Tue 20 Dec 2022 at 04:10PM -07, Sean Whitton wrote: > ... afterwards the unstaged changes > will have been unstaged, mixed in with the staged changes again. afterwards the staged changes will have been unstaged, mixed in with the unstaged changes again* -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 20 18:45:48 2022 Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 23:45:48 +0000 Received: from localhost ([127.0.0.1]:47819 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7mIu-000613-2G for submit@debbugs.gnu.org; Tue, 20 Dec 2022 18:45:48 -0500 Received: from mail-wr1-f48.google.com ([209.85.221.48]:40487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7mIs-00060t-2j for 60126@debbugs.gnu.org; Tue, 20 Dec 2022 18:45:46 -0500 Received: by mail-wr1-f48.google.com with SMTP id m14so13393842wrh.7 for <60126@debbugs.gnu.org>; Tue, 20 Dec 2022 15:45:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=yd/y/aiX1bj7MXApwBWW+1uQA2wxLfM8N/eujtzb4vs=; b=M6bN1c/CCcQNMvbVaxjJTLolH3naDKaybdomXX4QBxa2kqRSkPms+jOZSsnZ6mc1cA CZ5JlQQo+DTUIrQK799KSi+TARz0LDp2PdeiiQNo4yPXkxeehTMbjCWzIGzSeRjrK+Xn JEZXeRwDUKJezu1O+uErzaT+YUktItOUTfEptQeAxv0W4594JcsdiqiwdTAwUW5ZsHD2 O8B+UWjYKNpTkgZmlZ4GwPE9o/TW3ry5Mz9F+yceoCrhOjyqiYeDcvZyb7kQKHP6v6T9 3zo4hnbRXWxFAwOIKMl5LzZbJPwMtABElZb2PPtVBok9v7959erBGkN1Gs3TbNAcgnOJ lNcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yd/y/aiX1bj7MXApwBWW+1uQA2wxLfM8N/eujtzb4vs=; b=j1CfsGc1/aHh0ZRLnDy49Vq7S7mguHZW0X/My6bAMnG3rp2SxkHFLIzEm+BFRmaTHH 10u1IEvy35M5Fturn5LlXfHcdHN5xwaiuRqVgOlfmF1C2vorvChPLrI49/0wg1B/UTIM csFMkBv6u+a9/277jyh04+t+3GJ351iMl0Z5tgyCm+YjiRo8c6grU6wwCdtlJqoZ7O4Q Y6fUFDSiR8CryifFKnlBdZz5eIy31hPGSWdTdxhQEWA4IPf29RFwthRgXMnkZHEzqdbF poklFRcbIMdwoMqqtlfp53bnCHsAT+bXSF+dgBe/s78SrVACi/lE9BdrhTcyJ7eDlrdy TUQg== X-Gm-Message-State: ANoB5pm+owyHquUKiJMtKKWgHUeZ1HFegZay6h114CJXzwuHwhCADn6x /uAqpYxhFdtiTkyrQJVmeL4= X-Google-Smtp-Source: AA0mqf7rQZhtYQCTbyyv4Q+erey/tnbj6ZraaoBTSIJjAYbthlXrABa+huhfEwczI/c6MRA5FrI6ug== X-Received: by 2002:adf:f451:0:b0:24f:a289:b422 with SMTP id f17-20020adff451000000b0024fa289b422mr23252903wrp.16.1671579940194; Tue, 20 Dec 2022 15:45:40 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id z1-20020a5d6541000000b00241f029e672sm13674702wrv.107.2022.12.20.15.45.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Dec 2022 15:45:39 -0800 (PST) Message-ID: <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> Date: Wed, 21 Dec 2022 01:45:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Content-Language: en-US To: Sean Whitton References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> From: Dmitry Gutov In-Reply-To: <87zgbh1xkn.fsf@melete.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 21/12/2022 01:10, Sean Whitton wrote: > I tried implementing that, which is not hard, but then we pop that > stash, the staged changes aren't restored to the index. The result is > that if the user has a mixture of staged and unstaged changes to a file > which is not part of the commit, then afterwards the unstaged changes > will have been unstaged, mixed in with the staged changes again. In > some circumstances this could constitute a loss of work. > > There are a few ways to overcome this. We can use the --staged option, > but that's only available in very recent versions of git. IIUC the --staged option is indeed limited to the very new Git, but that option is used when creating a stash (when we want to stash the staging area only). When restoring a stash, to reinstate the stashed index, you would use the option --index. It's older than --staged (e.g. it's available in Git 2.22.0, and that's as far back as the docs at git-scm.com/docs go). Not sure if it's in Debian Stable or not. Regarding the alternatives -- double stashing, or the Magit way, it's hard to form a strong opinion before examining them in detail (I trust you can make a good choice). For completeness, though, here's a way to implement 'git push --staged' with Git plumbing manually: https://stackoverflow.com/a/72582276/615245 And as for a 'git pop --index' substitute, if the stash contains only the index area stuff, it might be as easy as git diff stash@{0}^..stash@{0} > patch.diff git apply --cached patch.diff git stash drop From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 22 19:12:35 2022 Received: (at 60126) by debbugs.gnu.org; 23 Dec 2022 00:12:35 +0000 Received: from localhost ([127.0.0.1]:36422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8Vfv-0007rW-EI for submit@debbugs.gnu.org; Thu, 22 Dec 2022 19:12:35 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:50661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8Vfr-0007rO-Qf for 60126@debbugs.gnu.org; Thu, 22 Dec 2022 19:12:33 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 885B05C004B; Thu, 22 Dec 2022 19:12:26 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 22 Dec 2022 19:12:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671754346; x=1671840746; bh=dP QLm1eNUGqHlCQSB7BFq+myIxGrzQzgZfKxKoCSVNE=; b=fVS5KKdhcvyKLfgYdf bJHcmyf7Re3ahyZtvuICX89f4RS6iJnKqEMqxAkamxqhhJuwDy7XXwYpv/BopBD1 M8jMGd3b+00StPP0AVkLZCkBaeHorobWO+nzi8A+hZEFfO6Zmr76q3oXqTte+UIp FgarEFA2puCAP2MtKwuW//GgmzU/I4AhK9+xIVUesZ9tPynsEqagTPps/Dejq2Xh XD16wxtG7u/1FA8u4sNgOMyEGrg/e20uItFTLZsjCCrBQP4R/HuCxPkaUCxhU2Wl qxZn10mm8+r05CAgexPk0iZO7RjOF8c5mM/w+4Smg28P8iNoD78kr1IshJ64206K 3n2g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671754346; x=1671840746; bh=dPQLm1eNUGqHlCQSB7BFq+myIxGr zQzgZfKxKoCSVNE=; b=QGeAvpxCtgaNVh5il2tr9ufO1jxGybDlgJRhKp0wZVVj TItWwczYS/zPP4dbQf+GWyYStJEg7McHDSUSNF3lxQ0YDHbHLHuw4Yg5RuqRGf3q DwhNt4WMpkBPRlfnVqKF38hh0r6/mp30VtltwkeAxBIFBsLI2R8L4PrvU1YY8vak JdqYq5LMyLv3kltDM7v4RRmNmmYhdCDJf7MOg0Z+X2wBXRHlDk9plK1i2WxKQWBG 9RAdIVst++gDfB5jPo+pjMBnaocmMXkDmtnpU1gcMMUMrHzP0clqyeLURJjCDYC2 5BPj9sTXHbVYaD8eHZm8OPJ0QwsMsHldtHJ2ps0BKw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrhedugddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnhepheetieeffeefvdegieejkefghfdvveeltddttdetgeetjefg keffkeeujeffvdehnecuffhomhgrihhnpehgihhtqdhstghmrdgtohhmpdhsthgrtghkoh hvvghrfhhlohifrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 22 Dec 2022 19:12:25 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id B5FA37ED1CC; Thu, 22 Dec 2022 17:12:24 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> (Dmitry Gutov's message of "Wed, 21 Dec 2022 01:45:37 +0200") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> Date: Thu, 22 Dec 2022 17:12:24 -0700 Message-ID: <87h6xnasgn.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Wed 21 Dec 2022 at 01:45AM +02, Dmitry Gutov wrote: > IIUC the --staged option is indeed limited to the very new Git, but that > option is used when creating a stash (when we want to stash the staging area > only). > > When restoring a stash, to reinstate the stashed index, you would use the > option --index. It's older than --staged (e.g. it's available in Git 2.22.0, > and that's as far back as the docs at git-scm.com/docs go). Not sure if it's > in Debian Stable or not. Ah, thanks for reminding me, I was getting mixed up. Unfortunately it's probably not much use, because 'git stash push -- x' stashes all staged changes, it turns out, not just those in x. > Regarding the alternatives -- double stashing, or the Magit way, it's > hard to form a strong opinion before examining them in detail (I trust > you can make a good choice). > > For completeness, though, here's a way to implement 'git push --staged' with > Git plumbing manually: https://stackoverflow.com/a/72582276/615245 > > And as for a 'git pop --index' substitute, if the stash contains only the > index area stuff, it might be as easy as > > git diff stash@{0}^..stash@{0} > patch.diff > git apply --cached patch.diff > git stash drop These references are helpful. I'll investigate further. -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 22 23:00:05 2022 Received: (at 60126) by debbugs.gnu.org; 23 Dec 2022 04:00:05 +0000 Received: from localhost ([127.0.0.1]:36539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8ZE4-0001nk-UI for submit@debbugs.gnu.org; Thu, 22 Dec 2022 23:00:05 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:36373) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8ZE2-0001mq-0M for 60126@debbugs.gnu.org; Thu, 22 Dec 2022 23:00:03 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 65EBA5C00A1; Thu, 22 Dec 2022 22:59:55 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 22 Dec 2022 22:59:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671767995; x=1671854395; bh=pl EhrB70fdKh+oIqRG6XfIe/hR2whPwVp3dmduWiT0c=; b=AeKpDozc65+TMPux+3 EMMtF3ITwamdS4rjfr8xlMj/TtTZSUnG5ifOIpknJxgTTlPd9jZBTEA2XHAOtSk3 ZKAn2bb7jm5Sfry1t07bMWvIsUJEM9rFv4ZHKYok745f8/zDZI8eu5qbBdgcDcTf hDJ+4M+oOYE4Zd3GM49Qi3iQFcIG8uMcE5XfKOWvIvS8adFzNNTKo7VCFxQtEc8j YEmYFuy8GINxVCPt+KT2GVCepMnA4N/YTSBL+OKOAe69Z24RuCwsyduLcyxy2WHg 1FUZY4ceizHu/ikYTvc3T98NKGZuUHVMxCeHuYFkFpmdunR+cGI+eLMhsTHErDTl lyEg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671767995; x=1671854395; bh=plEhrB70fdKh+oIqRG6XfIe/hR2w hPwVp3dmduWiT0c=; b=SK8DDSIEI+/VHEyn56qrkXCYNxjU4bxTlZmEbgSgg3pq bBt4Uxx3T58wiChM/QE++M4zRpCamTawjSCJjezQlUOJ/AvOLuoyawtOZ/Uj6kKP mfBOaUDTfpe91qrPt2rlPlMBH5iVfbMNw63zXkM4SrJtMC4l3obMTnCc8TPU9OvL XsVm7drclq/WE0Qf42gZpKu8CFS440YSr+JRQKf4yUFYbmR8QbH/asmhjS3IXUgS sr+faIJHgEqtqMys0CJi5PM8NT6RvcQuvwjawIYayg1DcXB56cFHZAxs8qa/eovw xCPOovnMJBWQRIJikjxJzStBovh9ha3c2RUTP+gATA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrhedugdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehmtddtredtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnhepuedujefhjeekjeffieekgfffjeegvdegvdevkeduheeuvdej udevveffkedttedunecuffhomhgrihhnpehsthgrtghkohhvvghrfhhlohifrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhpfihh ihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 22 Dec 2022 22:59:54 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 85AE27ED1FC; Thu, 22 Dec 2022 20:59:53 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <87h6xnasgn.fsf@melete.silentflame.com> (Sean Whitton's message of "Thu, 22 Dec 2022 17:12:24 -0700") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> Date: Thu, 22 Dec 2022 20:59:53 -0700 Message-ID: <878riybwhy.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain Hello, On Thu 22 Dec 2022 at 05:12PM -07, Sean Whitton wrote: >> For completeness, though, here's a way to implement 'git push --staged' with >> Git plumbing manually: https://stackoverflow.com/a/72582276/615245 >> >> And as for a 'git pop --index' substitute, if the stash contains only the >> index area stuff, it might be as easy as >> >> git diff stash@{0}^..stash@{0} > patch.diff >> git apply --cached patch.diff >> git stash drop > > These references are helpful. I'll investigate further. Here is my patch. It works, except that sometimes the let-binding of process-environment fails, such that the commands affect the normal index rather than the temporary index. Can you see what I'm doing wrong there? Thanks. -- Sean Whitton --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-vc-git-checkin-Stash-other-staged-changes.patch >From acea3dcd080c1cfacbddeb257683438de8a9b325 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 22 Dec 2022 20:54:08 -0700 Subject: [PATCH] vc-git-checkin: Stash other staged changes * lisp/vc/vc-git.el (vc-git--stash-staged-changes): New function. (vc-git-checkin): Use new function to avoid needing to unstage changes unrelated to the patch we want to commit (bug#60126). --- lisp/vc/vc-git.el | 97 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 83 insertions(+), 14 deletions(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 0a4e9caa614..86e8f5894df 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1020,22 +1020,36 @@ vc-git-checkin ;; message. Handle also remote files. (if (eq system-type 'windows-nt) (let ((default-directory (file-name-directory file1))) - (make-nearby-temp-file "git-msg"))))) + (make-nearby-temp-file "git-msg")))) + to-stash) (when vc-git-patch-string (unless (zerop (vc-git-command nil t nil "diff" "--cached" "--quiet")) - ;; Check that all staged changes also exist in the patch. - ;; This is needed to allow adding/removing files that are - ;; currently staged to the index. So remove the whole file diff - ;; from the patch because commit will take it from the index. + ;; Check that what's already staged is compatible with what + ;; we want to commit (bug#60126). + ;; + ;; 1. If the changes to a file in the index are identical to + ;; the changes to that file we want to commit, remove the + ;; changes from our patch, and let the commit take them + ;; from the index. This is necessary for adding and + ;; removing files to work. + ;; + ;; 2. If the changes to a file in the index are different to + ;; changes to that file we want to commit, then we have to + ;; unstage the changes or abort. + ;; + ;; 3. If there are changes to a file in the index but we don't + ;; want to commit any changes to that file, we need to + ;; stash those changes before committing. (with-temp-buffer (vc-git-command (current-buffer) t nil "diff" "--cached") (goto-char (point-min)) - (let ((pos (point)) file-name file-diff file-beg) + (let ((pos (point)) file-name file-header file-diff file-beg) (while (not (eobp)) (when (and (looking-at "^diff --git a/\\(.+\\) b/\\(.+\\)") (string= (match-string 1) (match-string 2))) (setq file-name (match-string 1))) (forward-line 1) ; skip current "diff --git" line + (setq file-header (buffer-substring pos (point))) (search-forward "diff --git" nil 'move) (move-beginning-of-line 1) (setq file-diff (buffer-substring pos (point))) @@ -1049,12 +1063,15 @@ vc-git-checkin (+ file-beg (length file-diff))))) (setq vc-git-patch-string (string-replace file-diff "" vc-git-patch-string))) - ((and file-name - (yes-or-no-p - (format "Unstage already-staged changes to %s?" - file-name))) - (vc-git-command nil 0 file-name "reset" "-q" "--")) - (t (user-error "Index not empty"))) + ((string-match (format "^%s" (regexp-quote file-header)) + vc-git-patch-string) + (if (and file-name + (yes-or-no-p + (format "Unstage already-staged changes to %s?" + file-name))) + (vc-git-command nil 0 file-name "reset" "-q" "--") + (user-error "Index not empty"))) + (t (push file-name to-stash))) (setq pos (point)))))) (unless (string-empty-p vc-git-patch-string) (let ((patch-file (make-nearby-temp-file "git-patch"))) @@ -1062,7 +1079,8 @@ vc-git-checkin (insert vc-git-patch-string)) (unwind-protect (vc-git-command nil 0 patch-file "apply" "--cached") - (delete-file patch-file))))) + (delete-file patch-file)))) + (when to-stash (vc-git--stash-staged-changes files))) (cl-flet ((boolean-arg-fn (argument) (lambda (value) (when (equal value "yes") (list argument))))) @@ -1088,7 +1106,58 @@ vc-git-checkin args) (unless vc-git-patch-string (if only (list "--only" "--") '("-a")))))) - (if (and msg-file (file-exists-p msg-file)) (delete-file msg-file)))) + (if (and msg-file (file-exists-p msg-file)) (delete-file msg-file)) + (when to-stash + (let ((cached (make-nearby-temp-file "git-cached"))) + (unwind-protect + (progn (with-temp-file cached + (vc-git-command t 0 nil "stash" "show" "-p")) + (vc-git-command nil 0 cached "apply" "--cached")) + (delete-file cached)) + (vc-git-command nil 0 nil "stash" "drop"))))) + +(defun vc-git--stash-staged-changes (files &optional message) + "Stash only the staged changes to FILES with description MESSAGE." + ;; This is necessary because even if you pass a list of file names + ;; to git-stash(1), it will stash any and all staged changes. + (unless (zerop + (vc-git-command nil t files "diff" "--cached" "--quiet")) + (unless message (setq message "Previously staged changes")) + (cl-flet + ((git-string (&rest args) + (string-trim-right + (with-output-to-string + (apply #'vc-git-command standard-output 0 nil args))))) + (let ((cached (make-nearby-temp-file "git-cached")) + tree) + ;; Use a temporary index to create a tree object corresponding + ;; to the staged changes to FILES. + (unwind-protect + (progn + (with-temp-file cached + (vc-git-command t 0 files "diff" "--cached" "--")) + (let* ((index (make-nearby-temp-file "git-index")) + (process-environment + (cons (format "GIT_INDEX_FILE=%s" index) + process-environment))) + (unwind-protect + (progn + (vc-git-command nil 0 nil "read-tree" "HEAD") + (vc-git-command nil 0 cached "apply" "--cached") + (setq tree (git-string "write-tree"))) + (delete-file index)))) + (delete-file cached)) + ;; Prepare stash commit object, which has a special structure. + (let* ((tree-commit (git-string "commit-tree" "-m" message + "-p" "HEAD" tree)) + (stash-commit (git-string "commit-tree" "-m" message + "-p" "HEAD" "-p" tree-commit + tree))) + ;; Push the new stash entry. + (vc-git-command nil 0 nil "update-ref" "--create-reflog" + "-m" message "refs/stash" stash-commit) + ;; Unstage the changes we've now stashed. + (vc-git-command nil 0 files "reset" "--")))))) (defun vc-git-find-revision (file rev buffer) (let* (process-file-side-effects -- 2.30.2 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 23 03:17:19 2022 Received: (at 60126) by debbugs.gnu.org; 23 Dec 2022 08:17:19 +0000 Received: from localhost ([127.0.0.1]:36812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8dF0-0004YF-Rf for submit@debbugs.gnu.org; Fri, 23 Dec 2022 03:17:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8dEy-0004Y8-NE for 60126@debbugs.gnu.org; Fri, 23 Dec 2022 03:17:17 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8dEt-0006Jf-Ai; Fri, 23 Dec 2022 03:17:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=H655dicUYbgylajmepHiNj7WRjMRiXM0NuZxm7LEj9E=; b=F8opuXLtNhwv yauov0Vg/AKCfmD/gSTOsicFRejeFyfpOoojifdTXBYd5fVmrKw/46vMyMDkB1slJgf9v2HSpCTKc 63wJWMLKMml+pj6T6eL3eNHkrhNzw5dgvSXgNpnXZE1Z/Fdc/x+/IB1dP8eL1W7kzTDuZVQIukTAM sM2S72ggKebBLrHEDEeo/rrdxQoaPL6aDU+0iEke/PBhUHWgTws5/QAcDAXAUe1j+QSYeoBKgLY/j S2uMBnmvH5X68WVagHilQ0tsU3HCU+wm4FuavPh4DFKLhWlvBeBwGpKPjHmmACVeWacQ9xGcNOdkr yrMuuO4O9CFU1ykFC+FrHQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8dEs-0005aK-Lt; Fri, 23 Dec 2022 03:17:11 -0500 Date: Fri, 23 Dec 2022 10:16:57 +0200 Message-Id: <835ye28rgm.fsf@gnu.org> From: Eli Zaretskii To: Sean Whitton In-Reply-To: <878riybwhy.fsf@melete.silentflame.com> (message from Sean Whitton on Thu, 22 Dec 2022 20:59:53 -0700) Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> <878riybwhy.fsf@melete.silentflame.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60126 Cc: juri@linkov.net, 60126@debbugs.gnu.org, dgutov@yandex.ru X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 60126@debbugs.gnu.org, juri@linkov.net > From: Sean Whitton > Date: Thu, 22 Dec 2022 20:59:53 -0700 > > + ;; Prepare stash commit object, which has a special structure. > + (let* ((tree-commit (git-string "commit-tree" "-m" message Can 'message' include newlines? if so, we need to either convert the newlines to spaces, or invoke the command with -F instead, writing the message to a temporary file. Because otherwise this will fail on Windows. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 23 17:55:36 2022 Received: (at 60126) by debbugs.gnu.org; 23 Dec 2022 22:55:36 +0000 Received: from localhost ([127.0.0.1]:39299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8qwy-00031A-5G for submit@debbugs.gnu.org; Fri, 23 Dec 2022 17:55:36 -0500 Received: from mail-ej1-f47.google.com ([209.85.218.47]:33400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8qww-000313-Em for 60126@debbugs.gnu.org; Fri, 23 Dec 2022 17:55:34 -0500 Received: by mail-ej1-f47.google.com with SMTP id u9so14886655ejo.0 for <60126@debbugs.gnu.org>; Fri, 23 Dec 2022 14:55:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=AAtIrXFabKDCcKvNY+wybX2El1EF9z3oOfhmQyOYdj8=; b=dDwXitsz0RqEAv2ahTph9kQ8yofHhsjG/wsadRWtKllUhdjgqDUub0GZPmlmjnTtpQ 8RC9NQAzdA2MFkY7cC9Lj65bFnWjhyavi2bfk5HmFJiapdJclj7K716pKzPRqF1ErjZX DFHlxT19DrIE5z5xjMOdgKOtMMmqt0SylTYtPVHbEML+rXSA1YWo5LDN1GvwLqplJnCL weAEgvKP7YqazD7L4rbFAy/all9z+9z28R8CJT0EYOmRWPasavpIW0lNDWwT5VpScIQM jrbQZHdPAUhrJ2kArycNW+6ccf5NOd39RcU7cWYzawd5UZKJr7mBHFWJyPTsucSaameh cYWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AAtIrXFabKDCcKvNY+wybX2El1EF9z3oOfhmQyOYdj8=; b=JuIPXb2QyVWaWtTsyT7EPfXvBKCrorAwVh7nEqa/eyu/QiqRShSinWj2rvWfN/BU8+ mPVBEBwwi4fdsIEzdW9bAu8UZ2NeQAMFSWeYPh1NEFIGNrGkgy8axX7fZ1Q1fOp3Mceb A3HHeSsXUHOROEcxmlSAF0w22B1Fh+rZuXhaG2P5y+ACoB+E/3nS5cG5nuba6Qps6Cjd mE5tSmcz/N4KrLYP0IB0HmDZU/MowEvVYD8AQrW2ySrgRIS5HT0fzSkB8pHnOy9l4GwN jfJO6f/6DcJU7iPtbfw1cHJuuSeaoaJ7RxrMkifGFEk4FJY4w5hrHKksFT9/zPGiWw9d 4eeg== X-Gm-Message-State: AFqh2kpCjJOZnlV7VvatVXksLyy8iCLl5EDXlH3DrFFrcT+YIzsAgtdD aoDIqB7HSn1Epf/ZVVnuOWg= X-Google-Smtp-Source: AMrXdXuz8BZdpGawk2qjDU/JImsgcApXb2Zi5O7Z2HigQVHGHc+8FNbD7+t//6338A8Oa0028888HQ== X-Received: by 2002:a17:907:a64b:b0:7c1:13b7:a5a1 with SMTP id vu11-20020a170907a64b00b007c113b7a5a1mr10347827ejc.46.1671836128318; Fri, 23 Dec 2022 14:55:28 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id kw18-20020a170907771200b0077077c62cadsm1846904ejc.31.2022.12.23.14.55.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Dec 2022 14:55:27 -0800 (PST) Message-ID: <078567f2-ec43-7de4-ed13-1f5d203c3de7@yandex.ru> Date: Sat, 24 Dec 2022 00:55:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Content-Language: en-US To: Sean Whitton References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> From: Dmitry Gutov In-Reply-To: <87h6xnasgn.fsf@melete.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 23/12/2022 02:12, Sean Whitton wrote: > Unfortunately it's probably not much use, because 'git stash push -- x' > stashes all staged changes, it turns out, not just those in x. Seems to work fine over here. And the manual says: ... This option is only valid for push command. The new stash entry records the modified states only for the files that match the pathspec. The index entries and working tree files are then rolled back to the state in HEAD only for these files, too, leaving files that do not match the pathspec intact. For more details, see the pathspec entry in gitglossary(7). Check out 'man git stash', perhaps your version of Git just doesn't have that feature yet. Though I thought it came with the introduction of 'git stash push', as opposed to 'git stash save'. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 23 18:18:38 2022 Received: (at 60126) by debbugs.gnu.org; 23 Dec 2022 23:18:38 +0000 Received: from localhost ([127.0.0.1]:39398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8rJG-0003DA-Dq for submit@debbugs.gnu.org; Fri, 23 Dec 2022 18:18:38 -0500 Received: from mail-ej1-f53.google.com ([209.85.218.53]:35768) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8rJE-0003D4-ER for 60126@debbugs.gnu.org; Fri, 23 Dec 2022 18:18:36 -0500 Received: by mail-ej1-f53.google.com with SMTP id vm8so8013352ejc.2 for <60126@debbugs.gnu.org>; Fri, 23 Dec 2022 15:18:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=EF5uqvVPklUFMlTvU8/Icie/CRTFvlBYruu8MnDWP80=; b=S/TLx7deIT3x1OO7QxnxtKKyspE13Tc0nfZyoYz4WWW9IFpEKx/B/WZ8YTKjlLCkwt yFuvQzrhVnId36M5p/pOX9m/KelqZs2LRCdQwLsJ9HYuzhUZYIskm3tpEs16KfbWvuFz MERAQ+fcP6l45ba5xWDkjAQoIs1wes4mRpzAkLTHzHHBV1CVFglBDINIHFko0Xke5MSA FPoO+QHrlV7Pf1lD8mG/K3xI/M2osy0nQVYkIxbqldnh1CyO6PV2s7OLmQW89JbSJ7cL 2XQ2Rq1676V3VU/fnLDa+ox4CWwDFYbuWYzqP8cWL2hzV1VHb2/naRq1rfVaOdINfjqt x43w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EF5uqvVPklUFMlTvU8/Icie/CRTFvlBYruu8MnDWP80=; b=sLy0fkm15N6bES9PZMn9TaHPZA7qQi7PnV1Ibe9baN5krlG7mT/oHqccciWOVzk5Sl wRmFhU3xcgbHog9UCQEd/uWLWx2CqzFz+3lz82RQ+DGdubF2PY3quuGf1j6w/Bc+JD6W yBm/CcSPlwDTuiiXk/3X+NpvPpxVEzF3RtqtrLKSwsTSc93euyHSNs89cIR83pXN+h9K fLuu+dRo+UGPQlYxZQN+yRv+4crtbtj+UE2PEI18fnlXgIYkqKbETwKP0XW3Wiyfoqf/ SmDHiRSD6vVYm0snYtu2ujrlLHqI/4uakH0lJc52AC0qmwfDYkYxJkIoGgvCbz4Zh5rw hzVA== X-Gm-Message-State: AFqh2kpiqF6BpZTrYNugELkMi5eQoL2j8J49PccoLxEl0SvY6wb/A+mf 34MHDVB3of3kPOb+UELY+xU= X-Google-Smtp-Source: AMrXdXtplT2pHLyE72KjIoUFamVPkTtEqLC37/fDNrip63d3LJPpjg5UOFVNllzG5+DyNJ5RlcGWww== X-Received: by 2002:a17:906:a191:b0:7c0:d605:fe42 with SMTP id s17-20020a170906a19100b007c0d605fe42mr8989651ejy.18.1671837510533; Fri, 23 Dec 2022 15:18:30 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id ku2-20020a170907788200b007c0e23b5615sm1895614ejc.34.2022.12.23.15.18.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Dec 2022 15:18:30 -0800 (PST) Message-ID: Date: Sat, 24 Dec 2022 01:18:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Content-Language: en-US To: Sean Whitton References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> <878riybwhy.fsf@melete.silentflame.com> From: Dmitry Gutov In-Reply-To: <878riybwhy.fsf@melete.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 60126 Cc: 60126@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 23/12/2022 05:59, Sean Whitton wrote: > It works, except that sometimes the let-binding of process-environment > fails, such that the commands affect the normal index rather than the > temporary index. Can you see what I'm doing wrong there? Could you describe be "sometimes" occurrences? Does that happen through repeating a similar action several times? Or slightly different actions? The process-environment setup seems fine. We did corrupt it in 1-2 places in the past using 'setenv', but I don't see anything like that in the current codebase. And the effect would probably be different anyway. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 23 21:02:26 2022 Received: (at 60126-done) by debbugs.gnu.org; 24 Dec 2022 02:02:26 +0000 Received: from localhost ([127.0.0.1]:40046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8trm-0005Ef-7Y for submit@debbugs.gnu.org; Fri, 23 Dec 2022 21:02:26 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:57335) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8trj-0005EX-Ol for 60126-done@debbugs.gnu.org; Fri, 23 Dec 2022 21:02:24 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9F3A05C0372; Fri, 23 Dec 2022 21:02:16 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 23 Dec 2022 21:02:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671847336; x=1671933736; bh=NO OXPMibGXIV3KdtIWGBWyyeEhE6iU/tNksO54N0y8A=; b=hvY9zljb6lPKui+NRd xc1EIL6Sj36BiP166M6Wn7gt8TV9iKDWnuwUQtLDHKXqj4Q0Ao6Tf9zKOLbhyCJS CU70pBTD7jYU0kSOE9gw7KxqKRN7tgp7m7PwB4nt1Dgp8AgfsffHQfsIYR1fE7av D66KrwNrQYiuPkmCmA14AyqvyUKmYQAr3zrB9tsk/VzXTRVofISr81TtS2fjYr+b nKhEBBkkXHQfoe4gB85M4b3CMPOc1B1TVEmAYDFb+CBynsAeGJk3fNweh1zEWXiD 7SZ8dmAgIznmkda+5LEjAf5CDy1yGgiTz2JHMej6ieB2EOlqATSWzoE6jw1T/Wdh SYhg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671847336; x=1671933736; bh=NOOXPMibGXIV3KdtIWGBWyyeEhE6 iU/tNksO54N0y8A=; b=XK5mPgUsHrV65aV1yCTNCH4Gvj+BPYGQxr4PMLnPXciN F7aJsKanYuHP2i0xQrAFBnueC36yBfTVFE3pQ2H1EfOM19oNS3jOAYO+DnRj/D60 AspynqjJ1hk0tsq21CiScr7B+DyrSJQ1kw8X1F521RYrJm3LH8TVdV9w/g7hA2UY aKvNewaXzI5A6djtf4K4QKFbbvVkuAf4eXl96odk98BKX14nLY8fd6fhchUztcmW K4JkJIuz2opT0cqUTKYxxWnxXK4kpMJcdxvZZ+FHFBWlJmi4ifOhNQnAujV55+p2 4Zs9xd2tIcfZPWo0x6fWNDbqOAcfibGFMd67EnnHvg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrheefgdegvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 23 Dec 2022 21:02:16 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 988397ECE9A; Fri, 23 Dec 2022 19:02:14 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: (Dmitry Gutov's message of "Sat, 24 Dec 2022 01:18:28 +0200") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> <878riybwhy.fsf@melete.silentflame.com> Date: Fri, 23 Dec 2022 19:02:14 -0700 Message-ID: <8735958spl.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126-done Cc: 60126-done@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Sat 24 Dec 2022 at 01:18AM +02, Dmitry Gutov wrote: > On 23/12/2022 05:59, Sean Whitton wrote: >> It works, except that sometimes the let-binding of process-environment >> fails, such that the commands affect the normal index rather than the >> temporary index. Can you see what I'm doing wrong there? > > Could you describe be "sometimes" occurrences? Does that happen through > repeating a similar action several times? Or slightly different actions? > > The process-environment setup seems fine. We did corrupt it in 1-2 places in > the past using 'setenv', but I don't see anything like that in the current > codebase. And the effect would probably be different anyway. Thank you for looking. Slightly embarassingly, I can't reproduce the problem today. So I've gone ahead and pushed. I am pretty happy with this approach, in the end. Compared with other possible uses of 'git stash', it's quite clean: - it doesn't touch the worktree copies of the files not involved in the commit - it stashes a single diff, rather than two diffs (one for the worktree and one for the index), which is less for the user to deal with if manual recovery becomes required. Thanks again for the helpful discussion on this one. -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 23 21:03:20 2022 Received: (at 60126) by debbugs.gnu.org; 24 Dec 2022 02:03:20 +0000 Received: from localhost ([127.0.0.1]:40058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8tsd-0005Ft-Ke for submit@debbugs.gnu.org; Fri, 23 Dec 2022 21:03:19 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:41807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8tsb-0005Fn-AT for 60126@debbugs.gnu.org; Fri, 23 Dec 2022 21:03:17 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 463825C0374; Fri, 23 Dec 2022 21:03:12 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 23 Dec 2022 21:03:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671847392; x=1671933792; bh=1Z H785/T54CgWc+Hfe9swSyEhixnbXm/N0puO8Q2CEo=; b=OYPGjVTHqOIMxcz/1e dN+Li3lnHHgW/fRyQSW+6yOjfK0+vAWAh2z4b0etHpF6L8bRwQSSQ/S0aaOLnUdh nPp5f02SbHzXtivwb7aMTWvvvl7I8Zbvy/4+a3FFnR1vbBuFAB+sK9nkHk+2P6JF 8B7COvz+7jdvak++MZVT+Ay0WxrBlNbex+/VNB+JQI1ucZ/X+q/Vp/ZAIfiCsiTj FhJz1KqkeD41OA/p05i+g9VBw2H1BSgEBgcdz8IfQFGXHnQtD60yU08wI7HYqcka VMN1qiW2Gf9J6sblTi7gICwbsN6SRCQmmcghAx9qH2REJLBNQ5szIembBINzvZ/s h8Hg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671847392; x=1671933792; bh=1ZH785/T54CgWc+Hfe9swSyEhixn bXm/N0puO8Q2CEo=; b=wJGxFiiO1/HN9YpY/p6/vSG9GkCdmk1Kqbm9Y9G/wuju IbYBZmp+ojgBG9ilzbDJp5+t3zyZaKhr4A8HM0RXiNZI9m3WmHU5uJ73zC62BaDE 10dZn/vVA64MrpFH8+Pbk1anpHu3lp2W9HGXhJAOESnscs28/5VrU6qDNM0WLoUg 8ZHPI9w1NJutdwfK8zNXHeP+W64xukQXwT15X6GhTOi9wutnGFHNpe2tHz+qbdzu uvxX2luEWJIkjtCEpfd1O7X5HF4iM6a83k22sZc714RTyoLq89wnZ51E1pBNlV73 cTiMS9HbabXPSv0cFVgSvm5pc1b2hyh/kVSRolIBeA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrheefgdegvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggrnhcu hghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqne cuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedukeeg geelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 23 Dec 2022 21:03:11 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 4456C7ECE9A; Fri, 23 Dec 2022 19:03:11 -0700 (MST) From: Sean Whitton To: Eli Zaretskii Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <835ye28rgm.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 23 Dec 2022 10:16:57 +0200") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> <878riybwhy.fsf@melete.silentflame.com> <835ye28rgm.fsf@gnu.org> Date: Fri, 23 Dec 2022 19:03:11 -0700 Message-ID: <87v8m17e3k.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126 Cc: juri@linkov.net, 60126@debbugs.gnu.org, dgutov@yandex.ru X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Fri 23 Dec 2022 at 10:16AM +02, Eli Zaretskii wrote: >> Cc: 60126@debbugs.gnu.org, juri@linkov.net >> From: Sean Whitton >> Date: Thu, 22 Dec 2022 20:59:53 -0700 >> >> + ;; Prepare stash commit object, which has a special structure. >> + (let* ((tree-commit (git-string "commit-tree" "-m" message > > Can 'message' include newlines? if so, we need to either convert the > newlines to spaces, or invoke the command with -F instead, writing the > message to a temporary file. Because otherwise this will fail on > Windows. Ah, thank you. These "messages" are more like labels, or names, than commit messages. I've gone ahead and hard coded it for the time being. -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 24 09:51:10 2022 Received: (at 60126-done) by debbugs.gnu.org; 24 Dec 2022 14:51:10 +0000 Received: from localhost ([127.0.0.1]:43334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p95ri-0004uH-C8 for submit@debbugs.gnu.org; Sat, 24 Dec 2022 09:51:10 -0500 Received: from mail-wm1-f45.google.com ([209.85.128.45]:33611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p95rb-0004tp-Sd for 60126-done@debbugs.gnu.org; Sat, 24 Dec 2022 09:51:08 -0500 Received: by mail-wm1-f45.google.com with SMTP id z8-20020a05600c220800b003d33b0bda11so6475498wml.0 for <60126-done@debbugs.gnu.org>; Sat, 24 Dec 2022 06:51:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=Hh+JMfAx0dhfBVIeIQ8u1fucbAz/sLGH+dki2oaHxj4=; b=BStD2hxnBv99QmeFGn9brg98ThRf+rIZRRDvT6vWECccXioTfJtbsJ2K87iCYUA9xD iN8wXCRNQz3AZl9vwwlq8hvJleQkkFF2Vcz7lXQmkzqktVxQdTp9okz9WU6f1G4lTh4B ayTCHr0fdA085vpZJEnyGZm8VZwWAwSu2Ji+q+z5HRrnNyTxJyasvh6oVqYG1rNCGH1h cuSdO/ezVU2I4TFB5AW2BjSCf4H3v4fsrWd92Cent3DQzfFFGiqbJ92/h4W55nmkDIUw EV7+DOBDKzZC/To8eylry9wX9VQyo9UOAHzlkwMsTbv5hrfqZ7SlGyhCeGdsei/GDj3v Jb5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Hh+JMfAx0dhfBVIeIQ8u1fucbAz/sLGH+dki2oaHxj4=; b=vJoiqBbWV7fSi1hCJuDqjRKc6bP2X8E4pLZum5D/ufxasiHgKnuEx2Y34cQ6pCWEAA nuF/bTh/8VK9VMZukqhuBBzuadF3uLcUrs5XxbQem9QmAYgHmpMEoqxY76QGSkdyBudI oqvZQz4m2BqWIKzsYIRCXMcHXrbjZydR+H3xQfyh+MkaQCsR0HLCwbw6XWheZZel91zh kimdcwyxMKIakDdRri3QObJ8I1OhLNWgN97CMQ9YG3TQN6bdLpr8h2mMUz8b3Wjva2BB 04ts+VPkgf0gxxs2IecfiF2stYQHVGlcI9q9F/2fI6UT2T4ZCXEQVQt0PD7QrbiK0ytB /w/g== X-Gm-Message-State: AFqh2krfMICBXkCUEykQTaM9dMvM3nTZ2QFinKWOuJDZrzin5RgjqWOZ mO9pmfNdmZ+60X6wtYChixc= X-Google-Smtp-Source: AMrXdXuS1dr37PY/4NTLCO37dWUAO/rYQJYhshgjEcGpeEAK7LtPhF2WB+QkGK1NpjzHXIUrW7PeHA== X-Received: by 2002:a05:600c:22d4:b0:3cf:82b9:2fe6 with SMTP id 20-20020a05600c22d400b003cf82b92fe6mr11163204wmg.8.1671893457756; Sat, 24 Dec 2022 06:50:57 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id bd25-20020a05600c1f1900b003cfd4cf0761sm12839538wmb.1.2022.12.24.06.50.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 24 Dec 2022 06:50:57 -0800 (PST) Message-ID: Date: Sat, 24 Dec 2022 16:50:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Content-Language: en-US To: Sean Whitton References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> <878riybwhy.fsf@melete.silentflame.com> <8735958spl.fsf@melete.silentflame.com> From: Dmitry Gutov In-Reply-To: <8735958spl.fsf@melete.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 60126-done Cc: 60126-done@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 24/12/2022 04:02, Sean Whitton wrote: > Hello, > > On Sat 24 Dec 2022 at 01:18AM +02, Dmitry Gutov wrote: > >> On 23/12/2022 05:59, Sean Whitton wrote: >>> It works, except that sometimes the let-binding of process-environment >>> fails, such that the commands affect the normal index rather than the >>> temporary index. Can you see what I'm doing wrong there? >> Could you describe be "sometimes" occurrences? Does that happen through >> repeating a similar action several times? Or slightly different actions? >> >> The process-environment setup seems fine. We did corrupt it in 1-2 places in >> the past using 'setenv', but I don't see anything like that in the current >> codebase. And the effect would probably be different anyway. > Thank you for looking. Slightly embarassingly, I can't reproduce the > problem today. So I've gone ahead and pushed. Thanks! > I am pretty happy with this approach, in the end. Compared with other > possible uses of 'git stash', it's quite clean: > > - it doesn't touch the worktree copies of the files not involved in the > commit > > - it stashes a single diff, rather than two diffs (one for the worktree > and one for the index), which is less for the user to deal with if > manual recovery becomes required. It does indeed feel like we ended up in a good place. The code was pretty complex, though, and got more so. We don't have tests covering vc-git-checkin-patch at all. Any chance you'll fancy working on adding those? Even if you only cover the scenarios where the user doesn't get prompted at all (either there's nothing staged, or the staged contents match the committed patch). Writing (and debugging) a test could also help sort out fiddly behaviors, like the one you may have seen yesterday. We have a default implementation for checkin-patch, so adding generic test for all major backends could work (in vc-tests.el). One or two extra tests could be also predicated on (eq backend 'Git), so that we don't yet need to copy the repository setup/teardown code to vc-git.el. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 24 13:22:55 2022 Received: (at 60126-done) by debbugs.gnu.org; 24 Dec 2022 18:22:55 +0000 Received: from localhost ([127.0.0.1]:47130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p99Ac-0006Mb-Vw for submit@debbugs.gnu.org; Sat, 24 Dec 2022 13:22:55 -0500 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:58931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p99Aa-0006MP-Tw for 60126-done@debbugs.gnu.org; Sat, 24 Dec 2022 13:22:54 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 111DA32004E7; Sat, 24 Dec 2022 13:22:46 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 24 Dec 2022 13:22:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671906166; x=1671992566; bh=55 w/CWlg3DlZd0NLPqqUtPr16dDOGUMkM1NqHreIU8I=; b=OfVUuxzMKxBkbYcZ5O dCJXrjSc8y7JWAGXWJfn3M8Hfuz9tWluzAS+XVuO1tSNK5xJPseMzPrmVuiaD9LJ WgAlPTIlEAy5cZtBk61jGE+hb9kBcNgymOx5O3kwPiVIrvrm1P3pwUXf9OI2jmfw OOATyC6tSVXnvc0K9IeKF0jHj7/rqKMR6mwADpWM3A4jbk8nEIKhMcDEYVke7vkt zk8PBJIGv0jC4edYtJZZ90wxg1DYFUKp8y18Ijrj8AeUfaRy73GRN66nr81rOqc4 EJ2ksCKJ+o9Jf1LASOT8E1FnpssjhMGVjOPMAdFgmkyDuHxOwdtYtH6BPLIIcYAw sUDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671906166; x=1671992566; bh=55w/CWlg3DlZd0NLPqqUtPr16dDO GUMkM1NqHreIU8I=; b=XW3XueeZslEeT1fR5rruC4kk880bEQ/QdSdNEvBj/w/e UJil8mTET/PlhRYatfNpAeQXWeAwJ0tbRniwDStGgVKPm6k4LtWZwkBl9ZLVj342 ax/nxeeGlYQrrc7YZzvXES4BhcP8q4t9SJAnJcX+CsI3VuKRunRHLIDZnEnLcR70 EmojJIPQ7WD1usNC9l/9zaPIrBCHW2XdXIlJglKlD2TT0egAdNgmAmBvO6dALvTJ F8meNcLrddUw695Ym3Zng46FxtVBGM5arwtXng9uuGILriUiKsYSPaub/p4hiWQI YMBAwUqSyX9jag+jnldECRdFWCLn6YaDpsp+HuPcbQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrheeggdduudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffffkfgggtgesthdttddttdertdenucfhrhhomhepufgvrghn ucghhhhithhtohhnuceoshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpeejtdejgfehleeghfevffefhfejffeuteegfefhiedtgeej ffefkeevlefhgfefieenucffohhmrghinhepvghlrdhonhgvpdgvlhdrnhhofienucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsphifhhhithht ohhnsehsphifhhhithhtohhnrdhnrghmvg X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 24 Dec 2022 13:22:46 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 7B0D87F04CD; Sat, 24 Dec 2022 11:22:45 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: (Dmitry Gutov's message of "Sat, 24 Dec 2022 16:50:55 +0200") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> <878riybwhy.fsf@melete.silentflame.com> <8735958spl.fsf@melete.silentflame.com> Date: Sat, 24 Dec 2022 11:22:45 -0700 Message-ID: <87fsd47jbe.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126-done Cc: 60126-done@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Sat 24 Dec 2022 at 04:50PM +02, Dmitry Gutov wrote: > It does indeed feel like we ended up in a good place. The code was pretty > complex, though, and got more so. > > We don't have tests covering vc-git-checkin-patch at all. Any chance you'll > fancy working on adding those? Even if you only cover the scenarios where the > user doesn't get prompted at all (either there's nothing staged, or the staged > contents match the committed patch). > > Writing (and debugging) a test could also help sort out fiddly behaviors, like > the one you may have seen yesterday. > > We have a default implementation for checkin-patch, so adding generic test for > all major backends could work (in vc-tests.el). One or two extra tests could > be also predicated on (eq backend 'Git), so that we don't yet need to copy the > repository setup/teardown code to vc-git.el. Now that we understand clearly what we want it to do, I bet the code in vc-checkin-git could be simplified (vc-git--stash-staged-changes is fine). So I'll see about doing that, with some tests, as you suggest. Let me ask you about the parsing of the 'diff --git' lines. I wasn't happy with my regexp approach to extracting the filename. I'm not sure it can actually fail, but the current codes assumes it can, and that adds complexity. The --src-prefix, --dst-prefix and --no-prefix options to git-diff(1) might be relevant, but then we couldn't use a simple string-match to find hunks in vc-git-patch-string. Do you have any better ideas of how to extract the filename from the git --diff line, or perhaps a proof that my approach can't fail? :) -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 24 14:26:50 2022 Received: (at 60126-done) by debbugs.gnu.org; 24 Dec 2022 19:26:50 +0000 Received: from localhost ([127.0.0.1]:47177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9AAU-0008Tl-41 for submit@debbugs.gnu.org; Sat, 24 Dec 2022 14:26:50 -0500 Received: from mail-ej1-f53.google.com ([209.85.218.53]:46782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9AAS-0008TV-La for 60126-done@debbugs.gnu.org; Sat, 24 Dec 2022 14:26:49 -0500 Received: by mail-ej1-f53.google.com with SMTP id bj12so18764544ejb.13 for <60126-done@debbugs.gnu.org>; Sat, 24 Dec 2022 11:26:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=oAY5US9I4N5zGaHCWYs+odrKGsa61QAbu2rnL/Yr8r4=; b=hzPzWMaVJUPHFy2wvgwTqUwOuAQqkVaheRKcdBGdvN1QQSi0qwqr2vilckxz4q1Au6 hVGH0KmYh3ZXhBuEX7ksm8S69/5sG7GmvAlw5BbY3/0lb7YEBRdcMRBta5fxLhrBYcKe aNwRjh8jCJFUo3CD7FoqSsoXpuPFvJ9IwyRnMfImMZL8bcjxNZZRmHhGErEckBsTsn7m cazuBtE9An2txGwORwpRh9l3GUmGaombUDWJ8V6GskCWLq/kDdhfg/Q6+rIsZO3uVcfa +QHdpDZm7uS7l1G2qF7OyZKQpf8zw6/jmA6Fd9bS8zStsx2wuYvqmeiz/0akUKSBWKcm SwwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oAY5US9I4N5zGaHCWYs+odrKGsa61QAbu2rnL/Yr8r4=; b=5o6DSEe24oNUkLLRex0D/hVewhNkWoD3ui659bZ0AqoxLzpCNZzO8G9ScuNmDPzVCt KXRnHgWF6DwKZM/S8VpFRZXVM+US90Kkz0vantSRvEJE/GmUSqroFeZM3lfc9NcZnBea cpMlRbmIk/L+nACH/vBjVUjb8cocJD/MKhTZP3VB6VBTfLD1q8GcXg4Q7NXhCJE0P6gc Hgbt4stquwIidakcMrKXxdF2e7N0XS+JAxDvumxzkozDt5OEhI26cecmKwLIdSsEe18r O82JhE8aZKrTKQdAFbJ3CLW+MOyWS+Cl0TxfmMRkIWSqdT/lBZqn7pnGiLTQDxP/blty DE4w== X-Gm-Message-State: AFqh2kpK9go0zEJC0T7WLhQ63l5735B1OwSiI3OMLZ26GHUg3mas3jj4 0B6SQ0mEtAp5kghu50L0Jd0= X-Google-Smtp-Source: AMrXdXtQTQeEuwf0jA61IXX1GdM9sBPJcQrAZVSnVpl4PBPboUpkaoNDkJa5qlFXI/AQRmvgP4cxFQ== X-Received: by 2002:a17:907:7094:b0:844:1d1d:1fa with SMTP id yj20-20020a170907709400b008441d1d01famr10428660ejb.23.1671910002742; Sat, 24 Dec 2022 11:26:42 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id x3-20020a170906804300b008413803baaesm2851378ejw.58.2022.12.24.11.26.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 24 Dec 2022 11:26:42 -0800 (PST) Message-ID: <31848fd3-db85-f1cc-e70b-eae71d854964@yandex.ru> Date: Sat, 24 Dec 2022 21:26:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Content-Language: en-US To: Sean Whitton References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> <878riybwhy.fsf@melete.silentflame.com> <8735958spl.fsf@melete.silentflame.com> <87fsd47jbe.fsf@melete.silentflame.com> From: Dmitry Gutov In-Reply-To: <87fsd47jbe.fsf@melete.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 60126-done Cc: 60126-done@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 24/12/2022 20:22, Sean Whitton wrote: > Now that we understand clearly what we want it to do, I bet the code in > vc-checkin-git could be simplified (vc-git--stash-staged-changes is > fine). So I'll see about doing that, with some tests, as you suggest. > > Let me ask you about the parsing of the 'diff --git' lines. ... > Do you have any better ideas of how to extract the filename from the git > --diff line, or perhaps a proof that my approach can't fail? :) I don't know. You could try (and (looking-at diff-file-header-re) (match-string 1)) instead, but it matches a different line (one that starts with "---"). > I wasn't > happy with my regexp approach to extracting the filename. I'm not sure > it can actually fail, but the current codes assumes it can, and that > adds complexity. Not sure which failure you are referring to, but the process of removing already-staged hunks from vc-git-patch-string can indeed fail, because the hunks might be staged, or might be not. The idea was to support both situations. > The --src-prefix, --dst-prefix and --no-prefix options to git-diff(1) > might be relevant, but then we couldn't use a simple string-match to > find hunks in vc-git-patch-string. Right. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 24 15:10:54 2022 Received: (at 60126-done) by debbugs.gnu.org; 24 Dec 2022 20:10:54 +0000 Received: from localhost ([127.0.0.1]:47184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9Ar8-0001PR-0V for submit@debbugs.gnu.org; Sat, 24 Dec 2022 15:10:54 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:34601) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9Ar5-0001P5-Qj for 60126-done@debbugs.gnu.org; Sat, 24 Dec 2022 15:10:53 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 7F9D532005C1; Sat, 24 Dec 2022 15:10:41 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sat, 24 Dec 2022 15:10:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc: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=1671912641; x=1671999041; bh=au 1PtJjsI4uyu6TbMgyApbSTfrWB+bfD5YSgStEnP+0=; b=WnOrzUeeHpON1N8hVZ Fczwe0faD5q+QoMfC6YoB4IRbI8qhsHSe/sGakMRteiKvBIdu2YgY/oph0CyVY7Q ny/L2OMM/wK+bEVCphvPO2d+9CaIvPX11nnuvKpqrOx1QctTP0zL2EmSBk8qQl+h 1Eh6O/w4WEdOKtq9Jn1r5EpqJRJiQLjVkDvv5VMHzrpu3J/V2OOTXn1brPW5Ezeu mA/DHa616MzIxvuPtBrrwBj0Kki77eUFQsAcmR4Ytza1gQuLuyh5zqSTWq+Vd6/4 Qd1oE5YNYjEUJzryDmvplzpHJ4uJoF/rgiksUVY8bEEO/6cB8xnVN+5fQZkSa4eM /cQA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1671912641; x=1671999041; bh=au1PtJjsI4uyu6TbMgyApbSTfrWB +bfD5YSgStEnP+0=; b=dtuiCAYwJl5WfQvo7v0gifDgVvjkpPOpB/WV9MZhiW6n k7WyfhSMhCDn2QjwZqgWfCC1pbDKwVxJykyBG51RHD94BXeTsQCuQ5TYmrmCVXf8 Vok3tGbcD1ECaicaUdOYM15EP9u7SGNSzdFrHOcprHn30yu/hFX0dNfIAg7qUS2H 2bW4wC7MZy1TYwFSwJhxS69chwHR23WEHwetsMr1EGMJAaEpyKX9pfKPjQqesYVa slfsV3G32fRfxbyoYk11t1XtK+fuus/+49gRcgAKXGwaP40KWeHpkyE+vbP1pbDH mxsZXmyUHJYgFkeu8qNiGUwA/fghyfzdE3wPjGe4Vw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrheeggddufeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffffkfgggtgesthdttddttdertdenucfhrhhomhepufgvrghn ucghhhhithhtohhnuceoshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpedtffdvffeuleeuvdetkedvveehgfehvdegvefghfevudek geegleevgeejkeetkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvg X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 24 Dec 2022 15:10:40 -0500 (EST) Received: by melete.silentflame.com (Postfix, from userid 1000) id 37AC27EDCA1; Sat, 24 Dec 2022 13:10:39 -0700 (MST) From: Sean Whitton To: Dmitry Gutov Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes In-Reply-To: <31848fd3-db85-f1cc-e70b-eae71d854964@yandex.ru> (Dmitry Gutov's message of "Sat, 24 Dec 2022 21:26:40 +0200") References: <38d4d719-8f3c-9bb6-b141-f7e9ca66333c@yandex.ru> <871qovjabq.fsf@melete.silentflame.com> <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> <87zgbih8wv.fsf@melete.silentflame.com> <392bbde0-9d6e-83c4-0639-af406e279ef1@yandex.ru> <87h6xqgg65.fsf@melete.silentflame.com> <87zgbh1xkn.fsf@melete.silentflame.com> <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> <87h6xnasgn.fsf@melete.silentflame.com> <878riybwhy.fsf@melete.silentflame.com> <8735958spl.fsf@melete.silentflame.com> <87fsd47jbe.fsf@melete.silentflame.com> <31848fd3-db85-f1cc-e70b-eae71d854964@yandex.ru> Date: Sat, 24 Dec 2022 13:10:39 -0700 Message-ID: <87zgbc5zr4.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60126-done Cc: 60126-done@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Sat 24 Dec 2022 at 09:26PM +02, Dmitry Gutov wrote: > On 24/12/2022 20:22, Sean Whitton wrote: > >> Now that we understand clearly what we want it to do, I bet the code in >> vc-checkin-git could be simplified (vc-git--stash-staged-changes is >> fine). So I'll see about doing that, with some tests, as you suggest. >> Let me ask you about the parsing of the 'diff --git' lines. > ... >> Do you have any better ideas of how to extract the filename from the git >> --diff line, or perhaps a proof that my approach can't fail? :) > > I don't know. You could try > > (and (looking-at diff-file-header-re) (match-string 1)) > > instead, but it matches a different line (one that starts with "---"). That seems better, thank you. >> I wasn't happy with my regexp approach to extracting the filename. >> I'm not sure it can actually fail, but the current codes assumes it >> can, and that adds complexity. > > Not sure which failure you are referring to, but the process of removing > already-staged hunks from vc-git-patch-string can indeed fail, because the > hunks might be staged, or might be not. The idea was to support both > situations. I meant that my regexp might fail to correctly parse the 'diff --git' line, and then the code goes straight to "Index not empty." >> The --src-prefix, --dst-prefix and --no-prefix options to git-diff(1) >> might be relevant, but then we couldn't use a simple string-match to >> find hunks in vc-git-patch-string. > > Right. > -- Sean Whitton From unknown Fri Jun 20 19:54:55 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 22 Jan 2023 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator