From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#52349: 29.0.50; vc-git and diff-mode: stage hunks Date: Mon, 14 Feb 2022 00:51:54 +0200 Message-ID: <3e3269cc-6d88-a03c-8fa4-04f6b349e553@yandex.ru> References: <268cee0d-465d-b862-d1d6-f5da4d69e737@inventati.org> <9106387a-98cf-396f-bf45-ccb04581787b@yandex.ru> <864k7kfd56.fsf@mail.linkov.net> <86fsr3uen2.fsf@mail.linkov.net> <95d2d999-49ad-13c4-9f25-0935650a1e42@yandex.ru> <8635ktjfll.fsf@mail.linkov.net> <36b963e4-5af7-dd9e-af92-4404541b9f4d@yandex.ru> <86v8xjx45h.fsf@mail.linkov.net> <86h792ttqu.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24386"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Cc: 52349@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 13 23:53:12 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJNjz-0006Cf-SL for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Feb 2022 23:53:11 +0100 Original-Received: from localhost ([::1]:39858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJNjy-0007dn-6W for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Feb 2022 17:53:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJNjq-0007dc-TS for bug-gnu-emacs@gnu.org; Sun, 13 Feb 2022 17:53:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45228) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJNjq-0004xM-Ja for bug-gnu-emacs@gnu.org; Sun, 13 Feb 2022 17:53:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nJNjq-0006yJ-Gm for bug-gnu-emacs@gnu.org; Sun, 13 Feb 2022 17:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Feb 2022 22:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52349 X-GNU-PR-Package: emacs Original-Received: via spool by 52349-submit@debbugs.gnu.org id=B52349.164479272626729 (code B ref 52349); Sun, 13 Feb 2022 22:53:02 +0000 Original-Received: (at 52349) by debbugs.gnu.org; 13 Feb 2022 22:52:06 +0000 Original-Received: from localhost ([127.0.0.1]:39125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJNiv-0006x3-QI for submit@debbugs.gnu.org; Sun, 13 Feb 2022 17:52:05 -0500 Original-Received: from mail-wr1-f49.google.com ([209.85.221.49]:37725) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJNis-0006wW-Ca for 52349@debbugs.gnu.org; Sun, 13 Feb 2022 17:52:04 -0500 Original-Received: by mail-wr1-f49.google.com with SMTP id w11so24096103wra.4 for <52349@debbugs.gnu.org>; Sun, 13 Feb 2022 14:52:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=6lfjraDxsoDK/3p9CBJncdJNSp/cHgp0XyvfMy43+Zc=; b=gZu3egz22xBow1Fs794Atoq/5rQHb/EyqL/vaI5QP7RqnefJeGNQBdCkiH1O4Dx9LQ GbEWzzPYBupHhFn0tZPqBLjHflHPsi/GNXAlqi0ganqi11auxK6m5MqhhtyG+MD0Wrus 3mXYr7GFaN6PFN3XX8OikYyeYmSLyCbpVjMhJ3f20uByewinICtdbJrrVts8W9jwuJoz CsyyWEo7CID1ueZZ5PjFAyojD3ACn8AEN7zKO5eH9pTC2Mh+tX0qTrvtW5rHMrS63mWR ofEaWgFSwOMEGgpV0DOx9yjS+VPibt8Z6hO3YurWElwcpc51GXvhX6Et62y/LPjsarLE Hg6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=6lfjraDxsoDK/3p9CBJncdJNSp/cHgp0XyvfMy43+Zc=; b=Gki35WCLBwbXM8jZrKwYyw1ZxotAeQotFco3SGlS2qhyctlKwjX3h2vLEupKluVE2K uZHywYDA3Yrsun8S1PfWSlcvz5FGM9XWy4WD3gdFMf3Fg8LP4qqo5tm6aZpoj6TEMsqI zq7xxDH/aupbndiukphikpuMP1/5UPOnMSqoz7w0FC3tBO+e09PfeP64dYN1uMLCXm1K LSMNSzKGubiLOKG4aeba5pA/fLa54QW17RYuoos3RmJkOPwPYhsKmtzNA0dUidFjv/ZH /muVmpQzAe/xDeIroNhqS9YjCAD9Bs3CUo/bJR9TgLgOk456GqkukcUesQqs03BTsu47 GjUw== X-Gm-Message-State: AOAM531CxIEpqDOK6mMZUZQII67vY+t148Iefy0G31jixrdsUZ1fBqnA 79xR6adhCdTx7BXVAHwe5yc= X-Google-Smtp-Source: ABdhPJwtP9H6oZCduntloLic47GyKWRAFS52oI+rOT+rmiWDai9/zcRjoKYMo7FQUbs2qu/QMeYeCA== X-Received: by 2002:adf:d1c7:: with SMTP id b7mr3301030wrd.683.1644792716536; Sun, 13 Feb 2022 14:51:56 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id r2sm14505290wmq.0.2022.02.13.14.51.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 13 Feb 2022 14:51:56 -0800 (PST) Content-Language: en-US In-Reply-To: <86h792ttqu.fsf@mail.linkov.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:226846 Archived-At: On 13.02.2022 21:48, Juri Linkov wrote: > This is fine, so this patch does this: > > (if patch-string > (vc-call-backend backend 'checkin files comment rev patch-string) > (vc-call-backend backend 'checkin files comment rev)) Looks good, thanks! Sorry, I haven't noticed your emails today before I wrote my own. See if you like the suggestion in there, but this patch is also fine with me. Though we might try catching the wrong-number-of-arguments error to report a friendlier explanation to the user. > Also I added the new arg ‘patch-string’ to vc-checkin and vc-start-logentry. > These are not API calls, so they could use a buffer-local variables instead > of args, but I'm not sure about this less important technical detail. Since the new args are optional, should be fine. > + (when patch-string > + (let ((patch-file (make-temp-file "git-patch"))) > + (with-temp-file patch-file > + (insert patch-string)) > + (unwind-protect > + (apply #'vc-git-command nil 0 patch-file > + (list "apply" "--cached")) > + (delete-file patch-file)))) Perhaps we should also check that there are no existing staged changes for those files, and if so, abort? This way we won't commit anything else by accident.