{"thread":{"id":"44631","subject":"BUG: \"cherry-pick A..B || git reset --hard OTHER\"","startedAt":"2016-12-06T18:58:49Z","lastAt":"2016-12-10T21:23:18Z","messageCount":15,"participants":["Junio C Hamano","Christian Couder","Stephan Beyer","Duy Nguyen","Nguyễn Thái Ngọc Duy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"307036","messageId":"xmqqlgvs28bh.fsf@gitster.mtv.corp.google.com","threadId":"44631","inReplyTo":null,"subject":"BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-12-06T18:58:42Z","receivedAt":"2016-12-06T18:58:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I was burned a few times with this in the past few years, but it did\nnot irritate me often enough that I didn't write it down.  But I\nthink this is serious enough that deserves attention from those who\nwere involved.\n\nA short reproduction recipe, using objects from git.git that are\npublicly available and stable, shows how bad it is.\n\n    $ git checkout v2.9.3^0\n\n    $ git cherry-pick 0582a34f52..a94bb68397\n    ... see conflict, decide to give up backporting to\n    ... such an old fork point.\n    ... the git-prompt gives \"|CHERRY-PICKING\" correctly.\n\n    $ git reset --hard v2.10.2^0\n    ... the git-prompt no longer says \"|CHERRY-PICKING\"\n\n    $ edit && git commit -m \"prelim work for backporting\"\n    [detached HEAD cc5a6a9219] prelim work for backporting\n\n    $ git cherry-pick 0582a34f52..a94bb68397\n    error: a cherry-pick or revert is already in progress\n    hint: try \"git cherry-pick (--continue | --quit | --abort)\"\n    fatal: cherry-pick failed\n\n    $ git cherry-pick --abort\n    ... we come back to v2.9.3^0, losing the new commit!\n\nThe above shows two bugs.\n\n (1) The third invocation of \"cherry-pick\" with \"--abort\" to get rid\n     of the state from the unfinished cherry-pick we did previously\n     is necessary, but the command does not notice that we resetted\n     to a new branch AND we even did some other work there.  This\n     loses end-user's work.  \n\n     \"git cherry-pick --abort\" should learn from \"git am --abort\"\n     that has an extra safety to deal with the above workflow.  The\n     state from the unfinished \"am\" is removed, but the head is not\n     rewound to avoid losing end-user's work.\n\n     You can try by replacing two instances of\n\n\t$ git cherry-pick 0582a34f52..a94bb68397\n\n     with\n\n\t$ git format-patch --stdout 0582a34f52..a94bb68397 | git am\n\n     in the above sequence, and conclude with \"git am--abort\" to see\n     how much more pleasant and safe \"git am --abort\" is.\n\n (2) The bug in \"cherry-pick --abort\" is made worse because the\n     git-completion script seems to be unaware of $GIT_DIR/sequencer\n     and stops saying \"|CHERRY-PICKING\" after the step to switch to\n     a different state with \"git reset --hard v2.10.2^0\".  If the\n     prompt showed it after \"git reset\", the end user would have\n     thought twice before starting the \"prelim work\".\n\nThanks.\n"},{"id":"307117","messageId":"CAP8UFD32PcT4XgnRFaP-St3i1D-6XG1wY6qKn3bgWPKn1Y4Qwg@mail.gmail.com","threadId":"44631","inReplyTo":"xmqqlgvs28bh.fsf@gitster.mtv.corp.google.com","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-12-07T14:31:32Z","receivedAt":"2016-12-07T14:31:38Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Tue, Dec 6, 2016 at 7:58 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> I was burned a few times with this in the past few years, but it did\n> not irritate me often enough that I didn't write it down.  But I\n> think this is serious enough that deserves attention from those who\n> were involved.\n\nYeah, I agree that we should do something about it.\n\n> A short reproduction recipe, using objects from git.git that are\n> publicly available and stable, shows how bad it is.\n>\n>     $ git checkout v2.9.3^0\n>\n>     $ git cherry-pick 0582a34f52..a94bb68397\n>     ... see conflict, decide to give up backporting to\n>     ... such an old fork point.\n>     ... the git-prompt gives \"|CHERRY-PICKING\" correctly.\n>\n>     $ git reset --hard v2.10.2^0\n>     ... the git-prompt no longer says \"|CHERRY-PICKING\"\n>\n>     $ edit && git commit -m \"prelim work for backporting\"\n>     [detached HEAD cc5a6a9219] prelim work for backporting\n>\n>     $ git cherry-pick 0582a34f52..a94bb68397\n>     error: a cherry-pick or revert is already in progress\n>     hint: try \"git cherry-pick (--continue | --quit | --abort)\"\n>     fatal: cherry-pick failed\n>\n>     $ git cherry-pick --abort\n>     ... we come back to v2.9.3^0, losing the new commit!\n>\n> The above shows two bugs.\n>\n>  (1) The third invocation of \"cherry-pick\" with \"--abort\" to get rid\n>      of the state from the unfinished cherry-pick we did previously\n>      is necessary, but the command does not notice that we resetted\n>      to a new branch AND we even did some other work there.  This\n>      loses end-user's work.\n>\n>      \"git cherry-pick --abort\" should learn from \"git am --abort\"\n>      that has an extra safety to deal with the above workflow.  The\n>      state from the unfinished \"am\" is removed, but the head is not\n>      rewound to avoid losing end-user's work.\n>\n>      You can try by replacing two instances of\n>\n>         $ git cherry-pick 0582a34f52..a94bb68397\n>\n>      with\n>\n>         $ git format-patch --stdout 0582a34f52..a94bb68397 | git am\n>\n>      in the above sequence, and conclude with \"git am--abort\" to see\n>      how much more pleasant and safe \"git am --abort\" is.\n\nOk I will try to take a look at that next week.\n\n>  (2) The bug in \"cherry-pick --abort\" is made worse because the\n>      git-completion script seems to be unaware of $GIT_DIR/sequencer\n>      and stops saying \"|CHERRY-PICKING\" after the step to switch to\n>      a different state with \"git reset --hard v2.10.2^0\".  If the\n>      prompt showed it after \"git reset\", the end user would have\n>      thought twice before starting the \"prelim work\".\n\nI am not used to hacking the prompt or completion scripts, so I would\nappreciate if someone else could do it.\n\nThanks,\nChristian.\n"},{"id":"307143","messageId":"6facca6e-622a-ea8f-89d8-a18b7faee3cc@gmx.net","threadId":"44631","inReplyTo":"xmqqlgvs28bh.fsf@gitster.mtv.corp.google.com","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2016-12-07T18:36:17Z","receivedAt":"2016-12-07T18:37:02Z","isPatch":false,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"Hi,\n\nOn 12/06/2016 07:58 PM, Junio C Hamano wrote:\n> I was burned a few times with this in the past few years, but it did\n> not irritate me often enough that I didn't write it down.  But I\n> think this is serious enough that deserves attention from those who\n> were involved.\n> \n> A short reproduction recipe, using objects from git.git that are\n> publicly available and stable, shows how bad it is.\n> \n>     $ git checkout v2.9.3^0\n> \n>     $ git cherry-pick 0582a34f52..a94bb68397\n>     ... see conflict, decide to give up backporting to\n>     ... such an old fork point.\n>     ... the git-prompt gives \"|CHERRY-PICKING\" correctly.\n> \n>     $ git reset --hard v2.10.2^0\n>     ... the git-prompt no longer says \"|CHERRY-PICKING\"\n> \n>     $ edit && git commit -m \"prelim work for backporting\"\n>     [detached HEAD cc5a6a9219] prelim work for backporting\n> \n>     $ git cherry-pick 0582a34f52..a94bb68397\n>     error: a cherry-pick or revert is already in progress\n>     hint: try \"git cherry-pick (--continue | --quit | --abort)\"\n>     fatal: cherry-pick failed\n> \n>     $ git cherry-pick --abort\n>     ... we come back to v2.9.3^0, losing the new commit!\n\nApart from the git-prompt bug: isn't this a user error? I think \"git\ncherry-pick --quit\"[1] would be the right thing to do, not --abort.\n\nOn the other hand, one (as a user) could also expect that \"git reset\n--hard\" also resets sequencer-related states (and that is what the\ngit-prompt suggests), but that would probably break a lot of scripts ;)\n\n[1] By the way: git cherry-pick --quit, git rebase --forget ...\ndifferent wording for the same thing makes things unintuitive.\n\n>  (1) The third invocation of \"cherry-pick\" with \"--abort\" to get rid\n>      of the state from the unfinished cherry-pick we did previously\n>      is necessary, but the command does not notice that we resetted\n>      to a new branch AND we even did some other work there.  This\n>      loses end-user's work.  \n> \n>      \"git cherry-pick --abort\" should learn from \"git am --abort\"\n>      that has an extra safety to deal with the above workflow.  The\n>      state from the unfinished \"am\" is removed, but the head is not\n>      rewound to avoid losing end-user's work.\n> \n>      You can try by replacing two instances of\n> \n> \t$ git cherry-pick 0582a34f52..a94bb68397\n> \n>      with\n> \n> \t$ git format-patch --stdout 0582a34f52..a94bb68397 | git am\n> \n>      in the above sequence, and conclude with \"git am--abort\" to see\n>      how much more pleasant and safe \"git am --abort\" is.\nDefinitely. I'd volunteer to add that safety guard. (But (2) remains.)\n\n~Stephan\n\n"},{"id":"307149","messageId":"xmqq8trry08k.fsf@gitster.mtv.corp.google.com","threadId":"44631","inReplyTo":"6facca6e-622a-ea8f-89d8-a18b7faee3cc@gmx.net","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-12-07T20:04:27Z","receivedAt":"2016-12-07T20:04:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephan Beyer <s-beyer@gmx.net> writes:\n\n> [1] By the way: git cherry-pick --quit, git rebase --forget ...\n> different wording for the same thing makes things unintuitive.\n\nIt is not too late to STOP \"--forget\" from getting added to \"rebase\"\nand give it a better name.\n\nHaving said that, I have a feeling that these options do not have to\nexist; isn't their presence just a symptom that the \"--abort\" for\nthe command misbehaves?  Isn't the reason why there is no need for\n\"am --quit\" because its \"--abort\" behaves more sensibly?\n\n"},{"id":"307155","messageId":"8d32c645-e850-5e7c-b01c-6e4d81e2d672@gmx.net","threadId":"44631","inReplyTo":"xmqq8trry08k.fsf@gitster.mtv.corp.google.com","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2016-12-07T20:35:23Z","receivedAt":"2016-12-07T20:35:34Z","isPatch":false,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"Hi,\n\nOn 12/07/2016 09:04 PM, Junio C Hamano wrote:\n> Stephan Beyer <s-beyer@gmx.net> writes:\n> \n>> [1] By the way: git cherry-pick --quit, git rebase --forget ...\n>> different wording for the same thing makes things unintuitive.\n> \n> It is not too late to STOP \"--forget\" from getting added to \"rebase\"\n> and give it a better name.\n\nOh. ;) I am not sure. I personally think that --forget is a better name\nthan --quit because when I hear --quit I tend to look into the manual\npage first to check if there are weird side effects (and then the manual\npage says that it \"forgets\" ;D).\nSo I'd rather favor adding --forget to cherry-pick/revert instead... or\nthis:\n\n> Having said that, I have a feeling that these options do not have to\n> exist; isn't their presence just a symptom that the \"--abort\" for\n> the command misbehaves?  Isn't the reason why there is no need for\n> \"am --quit\" because its \"--abort\" behaves more sensibly?\nYou're probably right. I have no other use-case in mind than \"oh I\nforgot that I was rebasing... now just abort that and don't bother me\nfurther (i.e. please don't bring me back)\"\n\n~Stephan\n"},{"id":"307193","messageId":"CACsJy8AP-N4BDyaXszvbh2k8fr7jO+YhVj=_0o0x1ooWrqkR4A@mail.gmail.com","threadId":"44631","inReplyTo":"8d32c645-e850-5e7c-b01c-6e4d81e2d672@gmx.net","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-12-07T23:21:00Z","receivedAt":"2016-12-07T23:21:40Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Dec 8, 2016 at 3:35 AM, Stephan Beyer <s-beyer@gmx.net> wrote:\n> Hi,\n>\n> On 12/07/2016 09:04 PM, Junio C Hamano wrote:\n>> Stephan Beyer <s-beyer@gmx.net> writes:\n>>\n>>> [1] By the way: git cherry-pick --quit, git rebase --forget ...\n>>> different wording for the same thing makes things unintuitive.\n>>\n>> It is not too late to STOP \"--forget\" from getting added to \"rebase\"\n>> and give it a better name.\n\nSorry I didn't know about --quit (and it has been there since 2011, I\nguess I'm just not big sequencer user).\n\n> Oh. ;) I am not sure. I personally think that --forget is a better name\n\nYeah, I was stuck with the name --destroy for many months and was very\nhappy the day I found --forget, which does not imply any destructive\nside effects and is distinct enough from --abort to not confuse\npeople.\n\n> than --quit because when I hear --quit I tend to look into the manual\n> page first to check if there are weird side effects (and then the manual\n> page says that it \"forgets\" ;D).\n> So I'd rather favor adding --forget to cherry-pick/revert instead... or\n> this:\n-- \nDuy\n"},{"id":"307220","messageId":"CAP8UFD0amsoo=QSZyc8rKcJqjO-o7P4TNDQjReXQK+m4hJCB6A@mail.gmail.com","threadId":"44631","inReplyTo":"6facca6e-622a-ea8f-89d8-a18b7faee3cc@gmx.net","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-12-08T07:50:30Z","receivedAt":"2016-12-08T07:50:37Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi,\n\nOn Wed, Dec 7, 2016 at 7:36 PM, Stephan Beyer <s-beyer@gmx.net> wrote:\n> Hi,\n>\n> On 12/06/2016 07:58 PM, Junio C Hamano wrote:\n>\n>>  (1) The third invocation of \"cherry-pick\" with \"--abort\" to get rid\n>>      of the state from the unfinished cherry-pick we did previously\n>>      is necessary, but the command does not notice that we resetted\n>>      to a new branch AND we even did some other work there.  This\n>>      loses end-user's work.\n>>\n>>      \"git cherry-pick --abort\" should learn from \"git am --abort\"\n>>      that has an extra safety to deal with the above workflow.  The\n>>      state from the unfinished \"am\" is removed, but the head is not\n>>      rewound to avoid losing end-user's work.\n>>\n>>      You can try by replacing two instances of\n>>\n>>       $ git cherry-pick 0582a34f52..a94bb68397\n>>\n>>      with\n>>\n>>       $ git format-patch --stdout 0582a34f52..a94bb68397 | git am\n>>\n>>      in the above sequence, and conclude with \"git am--abort\" to see\n>>      how much more pleasant and safe \"git am --abort\" is.\n> Definitely. I'd volunteer to add that safety guard. (But (2) remains.)\n\nThat would be great if you could take care of that!\n\nThanks,\nChristian.\n"},{"id":"307338","messageId":"CACsJy8CX0HO=LxcEK3K+pCecgFY=40R+gpFoy7CGeN5zEJFJVQ@mail.gmail.com","threadId":"44631","inReplyTo":"xmqq8trry08k.fsf@gitster.mtv.corp.google.com","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-12-09T11:33:08Z","receivedAt":"2016-12-09T11:33:44Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Dec 8, 2016 at 3:04 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Stephan Beyer <s-beyer@gmx.net> writes:\n>\n>> [1] By the way: git cherry-pick --quit, git rebase --forget ...\n>> different wording for the same thing makes things unintuitive.\n>\n> It is not too late to STOP \"--forget\" from getting added to \"rebase\"\n> and give it a better name.\n\nHaving the same operation with different names only increases git\nreputation of bad/inconsistent UI. Either forget is renamed to quit,\nor vice versa. I prefer forget, but the decision is yours and the\ncommunity's. So I'm sending two patches to rename in either direction.\nYou can pick one.\n-- \nDuy\n"},{"id":"307339","messageId":"20161209113427.6039-1-pclouds@gmail.com","threadId":"44631","inReplyTo":"CACsJy8CX0HO=LxcEK3K+pCecgFY=40R+gpFoy7CGeN5zEJFJVQ@mail.gmail.com","subject":"[PATCH] rebase: rename --forget to be consistent with sequencer","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2016-12-09T11:34:26Z","receivedAt":"2016-12-09T11:35:51Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Documentation/git-rebase.txt           | 4 ++--\n contrib/completion/git-completion.bash | 4 ++--\n git-rebase.sh                          | 6 +++---\n t/t3407-rebase-abort.sh                | 8 ++++----\n 4 files changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex e01d78e..f892458 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -12,7 +12,7 @@ SYNOPSIS\n \t[<upstream> [<branch>]]\n 'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]\n \t--root [<branch>]\n-'git rebase' --continue | --skip | --abort | --forget | --edit-todo\n+'git rebase' --continue | --skip | --abort | --quit | --edit-todo\n \n DESCRIPTION\n -----------\n@@ -252,7 +252,7 @@ leave out at most one of A and B, in which case it defaults to HEAD.\n \twill be reset to where it was when the rebase operation was\n \tstarted.\n \n---forget::\n+--quit::\n \tAbort the rebase operation but HEAD is not reset back to the\n \toriginal branch. The index and working tree are also left\n \tunchanged as a result.\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 8159f28..2c134f8 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1670,10 +1670,10 @@ _git_rebase ()\n {\n \tlocal dir=\"$(__gitdir)\"\n \tif [ -f \"$dir\"/rebase-merge/interactive ]; then\n-\t\t__gitcomp \"--continue --skip --abort --forget --edit-todo\"\n+\t\t__gitcomp \"--continue --skip --abort --quit --edit-todo\"\n \t\treturn\n \telif [ -d \"$dir\"/rebase-apply ] || [ -d \"$dir\"/rebase-merge ]; then\n-\t\t__gitcomp \"--continue --skip --abort --forget\"\n+\t\t__gitcomp \"--continue --skip --abort --quit\"\n \t\treturn\n \tfi\n \t__git_complete_strategy && return\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex f0de633..c62b178 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -43,7 +43,7 @@ continue!          continue\n abort!             abort and check out the original branch\n skip!              skip current patch and continue\n edit-todo!         edit the todo list during an interactive rebase\n-forget!            abort but keep HEAD where it is\n+quit!              abort but keep HEAD where it is\n \"\n . git-sh-setup\n . git-sh-i18n\n@@ -240,7 +240,7 @@ do\n \t--verify)\n \t\tok_to_skip_pre_rebase=\n \t\t;;\n-\t--continue|--skip|--abort|--forget|--edit-todo)\n+\t--continue|--skip|--abort|--quit|--edit-todo)\n \t\ttest $total_argc -eq 2 || usage\n \t\taction=${1##--}\n \t\t;;\n@@ -403,7 +403,7 @@ abort)\n \tfinish_rebase\n \texit\n \t;;\n-forget)\n+quit)\n \texec rm -rf \"$state_dir\"\n \t;;\n edit-todo)\ndiff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh\nindex 6bc5e71..910f218 100755\n--- a/t/t3407-rebase-abort.sh\n+++ b/t/t3407-rebase-abort.sh\n@@ -99,26 +99,26 @@ testrebase() {\n testrebase \"\" .git/rebase-apply\n testrebase \" --merge\" .git/rebase-merge\n \n-test_expect_success 'rebase --forget' '\n+test_expect_success 'rebase --quit' '\n \tcd \"$work_dir\" &&\n \t# Clean up the state from the previous one\n \tgit reset --hard pre-rebase &&\n \ttest_must_fail git rebase master &&\n \ttest_path_is_dir .git/rebase-apply &&\n \thead_before=$(git rev-parse HEAD) &&\n-\tgit rebase --forget &&\n+\tgit rebase --quit &&\n \ttest $(git rev-parse HEAD) = $head_before &&\n \ttest ! -d .git/rebase-apply\n '\n \n-test_expect_success 'rebase --merge --forget' '\n+test_expect_success 'rebase --merge --quit' '\n \tcd \"$work_dir\" &&\n \t# Clean up the state from the previous one\n \tgit reset --hard pre-rebase &&\n \ttest_must_fail git rebase --merge master &&\n \ttest_path_is_dir .git/rebase-merge &&\n \thead_before=$(git rev-parse HEAD) &&\n-\tgit rebase --forget &&\n+\tgit rebase --quit &&\n \ttest $(git rev-parse HEAD) = $head_before &&\n \ttest ! -d .git/rebase-merge\n '\n-- \n2.8.2.524.g6ff3d78\n\n"},{"id":"307340","messageId":"20161209113427.6039-2-pclouds@gmail.com","threadId":"44631","inReplyTo":"20161209113427.6039-1-pclouds@gmail.com","subject":"[PATCH] revert, cherry-pick: rename --quit to be consistent with rebase","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2016-12-09T11:34:27Z","receivedAt":"2016-12-09T11:35:56Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"The old --quit remains supported, just hidden away.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Documentation/git-cherry-pick.txt      |  2 +-\n Documentation/git-revert.txt           |  2 +-\n Documentation/sequencer.txt            |  2 +-\n builtin/revert.c                       |  7 +++++--\n contrib/completion/git-completion.bash |  4 ++--\n sequencer.c                            |  2 +-\n t/t3510-cherry-pick-sequence.sh        | 14 +++++++-------\n t/t3511-cherry-pick-x.sh               |  2 +-\n 8 files changed, 19 insertions(+), 16 deletions(-)\n\ndiff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\nindex 6154e57..de878ff 100644\n--- a/Documentation/git-cherry-pick.txt\n+++ b/Documentation/git-cherry-pick.txt\n@@ -11,7 +11,7 @@ SYNOPSIS\n 'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]\n \t\t  [-S[<keyid>]] <commit>...\n 'git cherry-pick' --continue\n-'git cherry-pick' --quit\n+'git cherry-pick' --forget\n 'git cherry-pick' --abort\n \n DESCRIPTION\ndiff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt\nindex 573616a..c21a43b 100644\n--- a/Documentation/git-revert.txt\n+++ b/Documentation/git-revert.txt\n@@ -10,7 +10,7 @@ SYNOPSIS\n [verse]\n 'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...\n 'git revert' --continue\n-'git revert' --quit\n+'git revert' --forget\n 'git revert' --abort\n \n DESCRIPTION\ndiff --git a/Documentation/sequencer.txt b/Documentation/sequencer.txt\nindex 5747f44..ddfaad6 100644\n--- a/Documentation/sequencer.txt\n+++ b/Documentation/sequencer.txt\n@@ -3,7 +3,7 @@\n \t'.git/sequencer'.  Can be used to continue after resolving\n \tconflicts in a failed cherry-pick or revert.\n \n---quit::\n+--forget::\n \tForget about the current operation in progress.  Can be used\n \tto clear the sequencer state after a failed cherry-pick or\n \trevert.\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 56a2c36..663eaf7 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -77,7 +77,10 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \tconst char *me = action_name(opts);\n \tint cmd = 0;\n \tstruct option options[] = {\n-\t\tOPT_CMDMODE(0, \"quit\", &cmd, N_(\"end revert or cherry-pick sequence\"), 'q'),\n+\t\tOPT_CMDMODE(0, \"forget\", &cmd, N_(\"end revert or cherry-pick sequence\"), 'q'),\n+\t\t{ OPTION_CMDMODE, 0, \"quit\", &cmd, NULL,\n+\t\t  N_(\"end revert or cherry-pick sequence\"),\n+\t\t  PARSE_OPT_NOARG|PARSE_OPT_NONEG|PARSE_OPT_HIDDEN, NULL, 'q' },\n \t\tOPT_CMDMODE(0, \"continue\", &cmd, N_(\"resume revert or cherry-pick sequence\"), 'c'),\n \t\tOPT_CMDMODE(0, \"abort\", &cmd, N_(\"cancel revert or cherry-pick sequence\"), 'a'),\n \t\tOPT_BOOL('n', \"no-commit\", &opts->no_commit, N_(\"don't automatically commit\")),\n@@ -134,7 +137,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \tif (opts->subcommand != REPLAY_NONE) {\n \t\tchar *this_operation;\n \t\tif (opts->subcommand == REPLAY_REMOVE_STATE)\n-\t\t\tthis_operation = \"--quit\";\n+\t\t\tthis_operation = \"--forget\";\n \t\telse if (opts->subcommand == REPLAY_CONTINUE)\n \t\t\tthis_operation = \"--continue\";\n \t\telse {\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 8159f28..d5c74e7 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1047,7 +1047,7 @@ _git_cherry_pick ()\n {\n \tlocal dir=\"$(__gitdir)\"\n \tif [ -f \"$dir\"/CHERRY_PICK_HEAD ]; then\n-\t\t__gitcomp \"--continue --quit --abort\"\n+\t\t__gitcomp \"--continue --forget --abort\"\n \t\treturn\n \tfi\n \tcase \"$cur\" in\n@@ -2303,7 +2303,7 @@ _git_revert ()\n {\n \tlocal dir=\"$(__gitdir)\"\n \tif [ -f \"$dir\"/REVERT_HEAD ]; then\n-\t\t__gitcomp \"--continue --quit --abort\"\n+\t\t__gitcomp \"--continue --forget --abort\"\n \t\treturn\n \tfi\n \tcase \"$cur\" in\ndiff --git a/sequencer.c b/sequencer.c\nindex e66f2fe..12d10d0 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -812,7 +812,7 @@ static int create_seq_dir(void)\n {\n \tif (file_exists(git_path_seq_dir())) {\n \t\terror(_(\"a cherry-pick or revert is already in progress\"));\n-\t\tadvise(_(\"try \\\"git cherry-pick (--continue | --quit | --abort)\\\"\"));\n+\t\tadvise(_(\"try \\\"git cherry-pick (--continue | --forget | --abort)\\\"\"));\n \t\treturn -1;\n \t}\n \telse if (mkdir(git_path_seq_dir(), 0777) < 0)\ndiff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh\nindex 7b7a89d..d84fafa 100755\n--- a/t/t3510-cherry-pick-sequence.sh\n+++ b/t/t3510-cherry-pick-sequence.sh\n@@ -18,7 +18,7 @@ test_description='Test cherry-pick continuation features\n _r10='\\1\\1\\1\\1\\1\\1\\1\\1\\1\\1'\n \n pristine_detach () {\n-\tgit cherry-pick --quit &&\n+\tgit cherry-pick --forget &&\n \tgit checkout -f \"$1^0\" &&\n \tgit read-tree -u --reset HEAD &&\n \tgit clean -d -f -f -q -x\n@@ -89,9 +89,9 @@ test_expect_success 'cherry-pick cleans up sequencer state upon success' '\n \ttest_path_is_missing .git/sequencer\n '\n \n-test_expect_success '--quit does not complain when no cherry-pick is in progress' '\n+test_expect_success '--forget does not complain when no cherry-pick is in progress' '\n \tpristine_detach initial &&\n-\tgit cherry-pick --quit\n+\tgit cherry-pick --forget\n '\n \n test_expect_success '--abort requires cherry-pick in progress' '\n@@ -99,14 +99,14 @@ test_expect_success '--abort requires cherry-pick in progress' '\n \ttest_must_fail git cherry-pick --abort\n '\n \n-test_expect_success '--quit cleans up sequencer state' '\n+test_expect_success '--forget cleans up sequencer state' '\n \tpristine_detach initial &&\n \ttest_expect_code 1 git cherry-pick base..picked &&\n-\tgit cherry-pick --quit &&\n+\tgit cherry-pick --forget &&\n \ttest_path_is_missing .git/sequencer\n '\n \n-test_expect_success '--quit keeps HEAD and conflicted index intact' '\n+test_expect_success '--forget keeps HEAD and conflicted index intact' '\n \tpristine_detach initial &&\n \tcat >expect <<-\\EOF &&\n \tOBJID\n@@ -116,7 +116,7 @@ test_expect_success '--quit keeps HEAD and conflicted index intact' '\n \t:000000 100644 OBJID OBJID A\tunrelated\n \tEOF\n \ttest_expect_code 1 git cherry-pick base..picked &&\n-\tgit cherry-pick --quit &&\n+\tgit cherry-pick --forget &&\n \ttest_path_is_missing .git/sequencer &&\n \ttest_must_fail git update-index --refresh &&\n \t{\ndiff --git a/t/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh\nindex 9cce5ae..a56d48e 100755\n--- a/t/t3511-cherry-pick-x.sh\n+++ b/t/t3511-cherry-pick-x.sh\n@@ -5,7 +5,7 @@ test_description='Test cherry-pick -x and -s'\n . ./test-lib.sh\n \n pristine_detach () {\n-\tgit cherry-pick --quit &&\n+\tgit cherry-pick --forget &&\n \tgit checkout -f \"$1^0\" &&\n \tgit read-tree -u --reset HEAD &&\n \tgit clean -d -f -f -q -x\n-- \n2.8.2.524.g6ff3d78\n\n"},{"id":"307373","messageId":"xmqq8trprn7f.fsf@gitster.mtv.corp.google.com","threadId":"44631","inReplyTo":"CACsJy8CX0HO=LxcEK3K+pCecgFY=40R+gpFoy7CGeN5zEJFJVQ@mail.gmail.com","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-12-09T18:07:00Z","receivedAt":"2016-12-09T18:07:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> On Thu, Dec 8, 2016 at 3:04 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Stephan Beyer <s-beyer@gmx.net> writes:\n>>\n>>> [1] By the way: git cherry-pick --quit, git rebase --forget ...\n>>> different wording for the same thing makes things unintuitive.\n>>\n>> It is not too late to STOP \"--forget\" from getting added to \"rebase\"\n>> and give it a better name.\n>\n> Having the same operation with different names only increases git\n> reputation of bad/inconsistent UI. Either forget is renamed to quit,\n> or vice versa. I prefer forget, but the decision is yours and the\n> community's. So I'm sending two patches to rename in either direction.\n> You can pick one.\n\nI actually was advocating to remove both by making --abort saner.\nWith an updated --abort that behaves saner, is \"rebase --forget\"\nstill necessary?\n\n"},{"id":"307388","messageId":"e0780f7c-ccb4-29fe-3d72-80e45a202f65@gmx.net","threadId":"44631","inReplyTo":"xmqq8trprn7f.fsf@gitster.mtv.corp.google.com","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2016-12-09T19:24:32Z","receivedAt":"2016-12-09T19:24:44Z","isPatch":false,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"Hi Junio,\n\nOn 12/09/2016 07:07 PM, Junio C Hamano wrote:\n> Duy Nguyen <pclouds@gmail.com> writes:\n>> Having the same operation with different names only increases git\n>> reputation of bad/inconsistent UI. Either forget is renamed to quit,\n>> or vice versa. I prefer forget, but the decision is yours and the\n>> community's. So I'm sending two patches to rename in either direction.\n>> You can pick one.\n> \n> I actually was advocating to remove both by making --abort saner.\n> With an updated --abort that behaves saner, is \"rebase --forget\"\n> still necessary?\n\nA quick change in t3407 of the \"rebase --forget\" test to use \"rebase\n--abort\" failed.  That's because it checks the use-case of\nforgetting/aborting without changing the HEAD.  So --abort makes a\nrollback, --forget just keeps the current head.  I am not sure if that\ntested use-case is a real use-case though.\n\nA quick change in the pristine_detach function in t3510 and t3511 from\n\"cherry-pick --quit\" to \"cherry-pick --abort\" works when one ignores the\nreturn value of \"cherry-pick --abort\". The \"--quit\" is used here to\nensure a clean cherry-pick state, and --quit always succeeds, even if no\ncherry-pick is in progress.  That may be a real use-case somehow that\ncould also be used for \"rebase --forget\"\n\nt3510 also shows another use-case for --quit: the title says it all:\n\"cherry-pick --quit\" to \"cherry-pick --abort\"\n\nWith this additional information, I'd vote to keep --quit/--forget and\njust make it consistent.\n\n~Stephan\n\n"},{"id":"307389","messageId":"6ee77e7d-b93e-107b-c3fb-519790453b59@gmx.net","threadId":"44631","inReplyTo":"e0780f7c-ccb4-29fe-3d72-80e45a202f65@gmx.net","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2016-12-09T19:28:00Z","receivedAt":"2016-12-09T19:28:10Z","isPatch":false,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"On 12/09/2016 08:24 PM, Stephan Beyer wrote:\n> t3510 also shows another use-case for --quit: the title says it all:\n> \"cherry-pick --quit\" to \"cherry-pick --abort\"\n\nI should've read what I actually pasted.\nI wanted to paste: '--quit keeps HEAD and conflicted index intact'\n\nSorry for making no sense ;)\n\n> With this additional information, I'd vote to keep --quit/--forget and\n> just make it consistent.\n\nNow!\n\n~Stephan\n"},{"id":"307434","messageId":"CACsJy8Div=Baenn7c-1wxgvrOh5PG=naeDrEYC8gs+AvJE7wZA@mail.gmail.com","threadId":"44631","inReplyTo":"e0780f7c-ccb4-29fe-3d72-80e45a202f65@gmx.net","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-12-10T11:00:56Z","receivedAt":"2016-12-10T11:01:32Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Dec 10, 2016 at 2:24 AM, Stephan Beyer <s-beyer@gmx.net> wrote:\n> Hi Junio,\n>\n> On 12/09/2016 07:07 PM, Junio C Hamano wrote:\n>> Duy Nguyen <pclouds@gmail.com> writes:\n>>> Having the same operation with different names only increases git\n>>> reputation of bad/inconsistent UI. Either forget is renamed to quit,\n>>> or vice versa. I prefer forget, but the decision is yours and the\n>>> community's. So I'm sending two patches to rename in either direction.\n>>> You can pick one.\n>>\n>> I actually was advocating to remove both by making --abort saner.\n>> With an updated --abort that behaves saner, is \"rebase --forget\"\n>> still necessary?\n>\n> A quick change in t3407 of the \"rebase --forget\" test to use \"rebase\n> --abort\" failed.  That's because it checks the use-case of\n> forgetting/aborting without changing the HEAD.  So --abort makes a\n> rollback, --forget just keeps the current head.  I am not sure if that\n> tested use-case is a real use-case though.\n\nIt is. I wanted something like this for years but \"rm -rf\n/path/to/.git/rebase*\" was not as bad when there were no linked\nworktrees.\n\nrebase and cherry-pick/revert are not exactly in the same situation.\nWhen cherry-pick/revert in \"continue/abort\" mode, there's usually some\nconflicted files and it's easy to notice.\n\nBut an interactive rebase could stop at some commit with clean\nworktree (the 'edit' command). Then I could even add some more commits\non top. I don't see how 'rebase --abort' can know my intention in this\ncase, whether I tried (with some new commits) and failed, and want to\nrevert/abort the whole thing, moving HEAD back to the original; or\nwhether I forgot I was in the middle of rebase and started to do\nsomething else, and --abort needs to keep HEAD where it is.\n-- \nDuy\n"},{"id":"307451","messageId":"xmqqfulvpjgh.fsf@gitster.mtv.corp.google.com","threadId":"44631","inReplyTo":"CACsJy8Div=Baenn7c-1wxgvrOh5PG=naeDrEYC8gs+AvJE7wZA@mail.gmail.com","subject":"Re: BUG: \"cherry-pick A..B || git reset --hard OTHER\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-12-10T21:23:10Z","receivedAt":"2016-12-10T21:23:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> rebase and cherry-pick/revert are not exactly in the same situation.\n> When cherry-pick/revert in \"continue/abort\" mode, there's usually some\n> conflicted files and it's easy to notice.\n>\n> But an interactive rebase could stop at some commit with clean\n> worktree (the 'edit' command). Then I could even add some more commits\n> on top. I don't see how 'rebase --abort' can know my intention in this\n> case, whether I tried (with some new commits) and failed, and want to\n> revert/abort the whole thing, moving HEAD back to the original; or\n> whether I forgot I was in the middle of rebase and started to do\n> something else, and --abort needs to keep HEAD where it is.\n\nOK.\n"}]}