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#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Date: Wed, 21 Dec 2022 01:45:37 +0200 Message-ID: <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22142"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: 60126@debbugs.gnu.org, juri@linkov.net To: Sean Whitton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 21 00:46:26 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 1p7mJW-0005Ty-Rp for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Dec 2022 00:46:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7mJ9-00068N-R9; Tue, 20 Dec 2022 18:46:03 -0500 Original-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 1p7mJ7-00068B-Va for bug-gnu-emacs@gnu.org; Tue, 20 Dec 2022 18:46:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7mJ7-0005r7-Mx for bug-gnu-emacs@gnu.org; Tue, 20 Dec 2022 18:46:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p7mJ7-00061L-IY for bug-gnu-emacs@gnu.org; Tue, 20 Dec 2022 18:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Dec 2022 23:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60126 X-GNU-PR-Package: emacs Original-Received: via spool by 60126-submit@debbugs.gnu.org id=B60126.167157994823133 (code B ref 60126); Tue, 20 Dec 2022 23:46:01 +0000 Original-Received: (at 60126) by debbugs.gnu.org; 20 Dec 2022 23:45:48 +0000 Original-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 Original-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 Original-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) Original-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) Content-Language: en-US In-Reply-To: <87zgbh1xkn.fsf@melete.silentflame.com> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251545 Archived-At: 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