Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Tao Klerks <tao@klerks.biz>
To: Tao Klerks via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] cherry-pick: refuse cherry-pick sequence if index is dirty
Date: Tue, 23 May 2023 18:01:25 +0200	[thread overview]
Message-ID: <CAPMMpojV1Ts=OKM0FbBHU6=EB5RKNxHucX-8VQmYoQBNefKpqQ@mail.gmail.com> (raw)
In-Reply-To: <pull.1535.git.1684830767336.gitgitgadget@gmail.com>

On Tue, May 23, 2023 at 10:32 AM Tao Klerks via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Tao Klerks <tao@klerks.biz>
>
> Cherry-pick, like merge or rebase, refuses to run when there are changes
> in the index. However, if a cherry-pick sequence is requested, this
> refusal happens "too late": when the cherry-pick sequence has already
> started, and an "--abort" or "--quit" is needed to resume normal
> operation.
>
> Normally, when an operation is "in-progress" and you want to go back to
> where you were before, "--abort" is the right thing to run. If you run
> "git cherry-pick --abort" in this specific situation, however, your
> staged changes are destroyed as part of the abort! Generally speaking,
> the abort process assumes any changes in the index are part of the
> operation to be aborted.
>
> Add an earlier check in the cherry-pick sequence process to ensure that
> the index is clean, reusing the already-generalized method used for
> rebase. Also add a test.
>
> Signed-off-by: Tao Klerks <tao@klerks.biz>
> ---

My apologies for the premature submission: I've now realized I used
the wrong existing check. "git rebase" checks for a clean *worktree*
(ignoring untracked files), and that is what I reused here. What git
merge and git cherry-pick check for, and what I should have added a
check for here, is a clean *index*.

The current implementation of this patch is far too restrictive. It
doesn't break any tests (and maybe I should add one now that I know),
but it's doing the wrong thing.

Tao

  reply	other threads:[~2023-05-23 16:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23  8:32 [PATCH] cherry-pick: refuse cherry-pick sequence if index is dirty Tao Klerks via GitGitGadget
2023-05-23 16:01 ` Tao Klerks [this message]
2023-05-24  0:06   ` Junio C Hamano
2023-05-24  9:33     ` Tao Klerks
2023-05-30 13:01       ` Phillip Wood
2023-05-28  9:08 ` [PATCH v2] " Tao Klerks via GitGitGadget
2023-05-30 14:16   ` Phillip Wood
2023-09-06  5:02     ` Tao Klerks

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='CAPMMpojV1Ts=OKM0FbBHU6=EB5RKNxHucX-8VQmYoQBNefKpqQ@mail.gmail.com' \
    --to=tao@klerks.biz \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).