all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 60126@debbugs.gnu.org, juri@linkov.net
Subject: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes
Date: Mon, 19 Dec 2022 23:43:44 -0700	[thread overview]
Message-ID: <87zgbih8wv.fsf@melete.silentflame.com> (raw)
In-Reply-To: <4513ac99-76d1-cdd6-fcc9-59208b5002f3@yandex.ru> (Dmitry Gutov's message of "Tue, 20 Dec 2022 02:53:28 +0200")

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





  reply	other threads:[~2022-12-20  6:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-16 18:32 bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Sean Whitton
2022-12-17 17:06 ` Juri Linkov
2022-12-18  0:20   ` Sean Whitton
2022-12-18  1:08 ` Dmitry Gutov
2022-12-19 22:30   ` Sean Whitton
2022-12-20  0:53     ` Dmitry Gutov
2022-12-20  6:43       ` Sean Whitton [this message]
2022-12-20 13:47         ` Dmitry Gutov
2022-12-20 16:47           ` Sean Whitton
2022-12-20 15:13         ` Dmitry Gutov
2022-12-20 17:04           ` Sean Whitton
2022-12-20 23:10             ` Sean Whitton
2022-12-20 23:41               ` Sean Whitton
2022-12-20 23:45               ` Dmitry Gutov
2022-12-23  0:12                 ` Sean Whitton
2022-12-23  3:59                   ` Sean Whitton
2022-12-23  8:16                     ` Eli Zaretskii
2022-12-24  2:03                       ` Sean Whitton
2022-12-23 23:18                     ` Dmitry Gutov
2022-12-24  2:02                       ` Sean Whitton
2022-12-24 14:50                         ` Dmitry Gutov
2022-12-24 18:22                           ` Sean Whitton
2022-12-24 19:26                             ` Dmitry Gutov
2022-12-24 20:10                               ` Sean Whitton
2022-12-23 22:55                   ` Dmitry Gutov
2022-12-20 17:13           ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgbih8wv.fsf@melete.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=60126@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.