{"thread":{"id":"42933","subject":"git cherry-pick conflict error message is deceptive when cherry-picking multiple commits","startedAt":"2016-07-26T19:42:34Z","lastAt":"2016-08-10T19:14:24Z","messageCount":9,"participants":["Stephen Morton","Stefan Beller","Jeff King","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"292250","messageId":"CAH8BJxGZW8eNQogksZ416sVaBkpQ78uYkV7FtN6wxGafzNwjAg@mail.gmail.com","threadId":"42933","inReplyTo":null,"subject":"git cherry-pick conflict error message is deceptive when cherry-picking multiple commits","fromName":"Stephen Morton","fromEmail":"stephen.c.morton@gmail.com","sentAt":"2016-07-26T19:40:51Z","receivedAt":"2016-07-26T19:42:34Z","isPatch":false,"sender":{"key":"stephen.c.morton@gmail.com","avatar":"https://gravatar.com/avatar/3b826f06cabc070cbd5d53071880caad8badc3b29e0789b510353faca59ffb7b?d=mp&s=160"},"body":"When I cherry-pick n commits and one of the first (n-1), fails, what I\nshould do is resolve the conflict, 'git add' it, and then run 'git\ncherry-pick --continue'. However git advises me to\n\nerror: could not apply d0fb756... Commit message for test commit\nhint: after resolving the conflicts, mark the corrected paths\nhint: with 'git add <paths>' or 'git rm <paths>'\nhint: and commit the result with 'git commit'\n\nI suspect this is not just a little bit deceptive but actually a bit\ndestructive, as doing a 'git commit' removes some of the sequencing\ninformation. If I do a 'git commit', while there is .git/sequencer\ninformation and 'git cherry-pick --continue' will work, there is no\nindication in 'git status' that a cherry-pick is in progress.\n\nIt would be extremely easy for somebody to follow cherry-pick's hints\nby running 'git commit' and think that they were done, not realizing\nthat there were m more commits remaining to be cherry-picked.\n\nWould it be possible to expand the hint message to tell users to run\n'git cherry-pick --continue'\n\nThis patch is *not* meant as a serious patch for submission --I'm sure\nit's all wrong-- it's just a proof of concept and showing some\ngoodwill on my part that I'm trying to help and I'm willing to put in\nsome work if I can be pointed more in the right direction.\n\nRegards,\nStephen\n\n\n\n\ndiff --git a/sequencer.c b/sequencer.c\nindex cdfac82..b8fa534 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -171,14 +171,21 @@ static void print_advice(int show_hint, struct\nreplay_opts *opts)\n\n        if (show_hint) {\n                if (opts->no_commit)\n                        advise(_(\"after resolving the conflicts, mark\nthe corrected paths\\n\"\n                                 \"with 'git add <paths>' or 'git rm <paths>'\"));\n-               else\n-                       advise(_(\"after resolving the conflicts, mark\nthe corrected paths\\n\"\n-                                \"with 'git add <paths>' or 'git rm <paths>'\\n\"\n-                                \"and commit the result with 'git commit'\"));\n+               else if  (! file_exists(git_path_seq_dir())) {\n+                       advise(_(\"SCM: after resolving the conflicts,\nmark the corrected paths\\n\"\n+                     \"with 'git add <paths>' or 'git rm <paths>'\\n\"\n+                     \"and commit the result with 'git commit'\"));\n+        }\n+        else\n+        {\n+            advise(_(\"SCM: after resolving the conflicts, mark the\ncorrected paths\\n\"\n+                     \"with 'git add <paths>' or 'git rm <paths>'\\n\"\n+                     \"and continue the %s with 'git %s --continue'\"),\naction_name(opts), action_name(opts));\n+        }\n        }\n }\n"},{"id":"292257","messageId":"CAGZ79kaop1HB4tQAKxOcq8ZNEc+6VMPB1suwA9jra2BoXc27cw@mail.gmail.com","threadId":"42933","inReplyTo":"CAH8BJxGZW8eNQogksZ416sVaBkpQ78uYkV7FtN6wxGafzNwjAg@mail.gmail.com","subject":"Re: git cherry-pick conflict error message is deceptive when cherry-picking multiple commits","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-07-26T20:18:55Z","receivedAt":"2016-07-26T20:19:33Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"> Would it be possible to expand the hint message to tell users to run\n> 'git cherry-pick --continue'\n\nInstead of expanding I'd go for replacing?\n\nI'd say the user is tempted for 2 choices,\na) aborting (for various reasons)\nb) fix and continue.\n\nSo we'd want to point out the way for those two ways and not\ngive an additional arbitrary way that is not quite (b) but goes that\ndirection?\n\nI realize this is what the patch does, but I wanted to point out the difference\non expanding vs replacing. I think a 4 line hint is \"enough\", so I'd object\nadding more lines, but changing existing lines is great!\n"},{"id":"292258","messageId":"20160726203041.GA4675@sigill.intra.peff.net","threadId":"42933","inReplyTo":"CAGZ79kaop1HB4tQAKxOcq8ZNEc+6VMPB1suwA9jra2BoXc27cw@mail.gmail.com","subject":"Re: git cherry-pick conflict error message is deceptive when cherry-picking multiple commits","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-07-26T20:30:41Z","receivedAt":"2016-07-26T20:32:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jul 26, 2016 at 01:18:55PM -0700, Stefan Beller wrote:\n\n> > Would it be possible to expand the hint message to tell users to run\n> > 'git cherry-pick --continue'\n> \n> Instead of expanding I'd go for replacing?\n> \n> I'd say the user is tempted for 2 choices,\n> a) aborting (for various reasons)\n> b) fix and continue.\n\nYeah, I'd agree with this.\n\nI think that advice comes from a time when you could only cherry-pick a\nsingle commit. These days you can do several in a single run, and that's\nwhy \"git cherry-pick --continue\" was invented.\n\nSo I think we would need to make sure that the \"cherry-pick --continue\"\nadvice applies in both cases (and that we do not need to give different\nadvice depending on whether we are in a single or multiple cherry-pick).\n\nI did some basic tests and it _seems_ to work to use --continue in\neither case. Probably due to 093a309 (revert: allow cherry-pick\n--continue to commit before resuming, 2011-12-10), but I didn't dig.\n\n-Peff\n"},{"id":"292263","messageId":"CAH8BJxH0_RhmDaHWBkFg6QP7WWucUtPSQfsAemdVWkTzN42MPw@mail.gmail.com","threadId":"42933","inReplyTo":"20160726203041.GA4675@sigill.intra.peff.net","subject":"Re: git cherry-pick conflict error message is deceptive when cherry-picking multiple commits","fromName":"Stephen Morton","fromEmail":"stephen.c.morton@gmail.com","sentAt":"2016-07-26T20:44:06Z","receivedAt":"2016-07-26T20:44:14Z","isPatch":false,"sender":{"key":"stephen.c.morton@gmail.com","avatar":"https://gravatar.com/avatar/3b826f06cabc070cbd5d53071880caad8badc3b29e0789b510353faca59ffb7b?d=mp&s=160"},"body":"On Tue, Jul 26, 2016 at 4:30 PM, Jeff King <peff@peff.net> wrote:\n> On Tue, Jul 26, 2016 at 01:18:55PM -0700, Stefan Beller wrote:\n>\n>> > Would it be possible to expand the hint message to tell users to run\n>> > 'git cherry-pick --continue'\n>>\n>> Instead of expanding I'd go for replacing?\n>>\n>> I'd say the user is tempted for 2 choices,\n>> a) aborting (for various reasons)\n>> b) fix and continue.\n>\n> Yeah, I'd agree with this.\n>\n> I think that advice comes from a time when you could only cherry-pick a\n> single commit. These days you can do several in a single run, and that's\n> why \"git cherry-pick --continue\" was invented.\n>\n> So I think we would need to make sure that the \"cherry-pick --continue\"\n> advice applies in both cases (and that we do not need to give different\n> advice depending on whether we are in a single or multiple cherry-pick).\n>\n> I did some basic tests and it _seems_ to work to use --continue in\n> either case. Probably due to 093a309 (revert: allow cherry-pick\n> --continue to commit before resuming, 2011-12-10), but I didn't dig.\n>\n> -Peff\n\nThe 'git status' text for a rebase/am/cherry-pick is\n\n    fix conflicts and then run \"git <op> --continue\"\n    use \"git <op> --skip\" to skip this patch\"\n    use \"git <op> --abort\" to cancel the <op> operation\n\n(The --cancel text varies a bit actually, but that's the gist of it.)\n\nThe rebase/cherry-pick conflict case should really indicate how to\nmark the conflict as resolved as that's the specific situation the\nuser is in. I don't know if there are guidelines to hint line length,\nor how many actions should be on one line but if the above text was\nchanged to have this as the \"fix\" text, possibly over two lines, I\nthink that would do it.\n\n    fix conflicts with 'git add <paths>' or 'git rm <paths>'\" and then\nrun \"git <op> --continue\"\n\nStephen\n"},{"id":"292316","messageId":"CAH8BJxFvyEDuj-mm=N=ca3kxysopaBpro-HsuL-HZehqE_nxDA@mail.gmail.com","threadId":"42933","inReplyTo":"CAH8BJxH0_RhmDaHWBkFg6QP7WWucUtPSQfsAemdVWkTzN42MPw@mail.gmail.com","subject":"Re: git cherry-pick conflict error message is deceptive when cherry-picking multiple commits","fromName":"Stephen Morton","fromEmail":"stephen.c.morton@gmail.com","sentAt":"2016-07-27T14:15:21Z","receivedAt":"2016-07-27T14:15:28Z","isPatch":false,"sender":{"key":"stephen.c.morton@gmail.com","avatar":"https://gravatar.com/avatar/3b826f06cabc070cbd5d53071880caad8badc3b29e0789b510353faca59ffb7b?d=mp&s=160"},"body":"Here is my patch then. (Personally, I would add some capitalization\nand punctuation, but I didn't see much of that in the existing code.)\nI'm not a regular pull-requester, do I do that, or can somebody else\nhandle that for me?\n\n\ndiff --git a/sequencer.c b/sequencer.c\nindex cdfac82..ce06876 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -176,7 +176,8 @@ static void print_advice(int show_hint, struct\nreplay_opts *opts)\n                else\n                        advise(_(\"after resolving the conflicts, mark\nthe corrected paths\\n\"\n                                 \"with 'git add <paths>' or 'git rm <paths>'\\n\"\n-                                \"and commit the result with 'git commit'\"));\n+                                \"then continue the %s with 'git %s\n--continue'\\n\"\n+                                \"or cancel the %s operation with 'git\n%s --abort'\" ),  action_name(opts), action_name(opts),\naction_name(opts), action_name(opts));\n        }\n }\n\n\nStephen\n\n\n\nOn Tue, Jul 26, 2016 at 4:44 PM, Stephen Morton\n<stephen.c.morton@gmail.com> wrote:\n> On Tue, Jul 26, 2016 at 4:30 PM, Jeff King <peff@peff.net> wrote:\n>> On Tue, Jul 26, 2016 at 01:18:55PM -0700, Stefan Beller wrote:\n>>\n>>> > Would it be possible to expand the hint message to tell users to run\n>>> > 'git cherry-pick --continue'\n>>>\n>>> Instead of expanding I'd go for replacing?\n>>>\n>>> I'd say the user is tempted for 2 choices,\n>>> a) aborting (for various reasons)\n>>> b) fix and continue.\n>>\n>> Yeah, I'd agree with this.\n>>\n>> I think that advice comes from a time when you could only cherry-pick a\n>> single commit. These days you can do several in a single run, and that's\n>> why \"git cherry-pick --continue\" was invented.\n>>\n>> So I think we would need to make sure that the \"cherry-pick --continue\"\n>> advice applies in both cases (and that we do not need to give different\n>> advice depending on whether we are in a single or multiple cherry-pick).\n>>\n>> I did some basic tests and it _seems_ to work to use --continue in\n>> either case. Probably due to 093a309 (revert: allow cherry-pick\n>> --continue to commit before resuming, 2011-12-10), but I didn't dig.\n>>\n>> -Peff\n>\n> The 'git status' text for a rebase/am/cherry-pick is\n>\n>     fix conflicts and then run \"git <op> --continue\"\n>     use \"git <op> --skip\" to skip this patch\"\n>     use \"git <op> --abort\" to cancel the <op> operation\n>\n> (The --cancel text varies a bit actually, but that's the gist of it.)\n>\n> The rebase/cherry-pick conflict case should really indicate how to\n> mark the conflict as resolved as that's the specific situation the\n> user is in. I don't know if there are guidelines to hint line length,\n> or how many actions should be on one line but if the above text was\n> changed to have this as the \"fix\" text, possibly over two lines, I\n> think that would do it.\n>\n>     fix conflicts with 'git add <paths>' or 'git rm <paths>'\" and then\n> run \"git <op> --continue\"\n>\n> Stephen\n"},{"id":"292321","messageId":"alpine.DEB.2.20.1607271649120.14111@virtualbox","threadId":"42933","inReplyTo":"CAH8BJxFvyEDuj-mm=N=ca3kxysopaBpro-HsuL-HZehqE_nxDA@mail.gmail.com","subject":"Re: git cherry-pick conflict error message is deceptive when cherry-picking multiple commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-07-27T15:03:38Z","receivedAt":"2016-07-27T15:04:14Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Stephen,\n\nOn Wed, 27 Jul 2016, Stephen Morton wrote:\n\n> Here is my patch then. (Personally, I would add some capitalization and\n> punctuation, but I didn't see much of that in the existing code.) I'm\n> not a regular pull-requester, do I do that, or can somebody else handle\n> that for me?\n\nThe process of the patch submission is described in\nDocumentation/SubmittingPatches (yes, it is a bit involved, and it is\nslightly easier when you use http://submitgit.herokuapp.com/, but please\nnote that this process has served us well over one decade).\n\nPlease also note that top-posting is highly discouraged on this list:\n\nA: Because it messes up the order in which people normally read text.\n>Q: Why is top-posting such a bad thing?\n>>A: Top-posting.\n>>>Q: What is the most annoying thing in e-mail?\n\nNow to your patch:\n\n> diff --git a/sequencer.c b/sequencer.c\n> index cdfac82..ce06876 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -176,7 +176,8 @@ static void print_advice(int show_hint, struct\n> replay_opts *opts)\n>                 else\n>                         advise(_(\"after resolving the conflicts, mark\n> the corrected paths\\n\"\n>                                  \"with 'git add <paths>' or 'git rm <paths>'\\n\"\n> -                                \"and commit the result with 'git commit'\"));\n> +                                \"then continue the %s with 'git %s\n> --continue'\\n\"\n> +                                \"or cancel the %s operation with 'git\n> %s --abort'\" ),  action_name(opts), action_name(opts),\n> action_name(opts), action_name(opts));\n\nThat is an awful lot of repetition right there, with an added\ninconsistency that the action is referred to by its name alone in the\n\"--continue\" case, but with \"operation\" added in the \"--abort\" case.\n\nAnd additionally, in the most common case (one commit to cherry-pick), the\nadvice now suggests a more complicated operation than necessary: a simply\n`git commit` would be enough, then.\n\nCan't we have a test whether this is the last of the commits to be\ncherry-picked, and if so, have the simpler advice again?\n\nCiao,\nJohannes\n"},{"id":"292323","messageId":"CAH8BJxGPzpymSWPpxXRcCCx-OPckm5bVgENUEjVM-+9sr1T+6A@mail.gmail.com","threadId":"42933","inReplyTo":"alpine.DEB.2.20.1607271649120.14111@virtualbox","subject":"Re: git cherry-pick conflict error message is deceptive when cherry-picking multiple commits","fromName":"Stephen Morton","fromEmail":"stephen.c.morton@gmail.com","sentAt":"2016-07-27T15:30:46Z","receivedAt":"2016-07-27T15:30:53Z","isPatch":false,"sender":{"key":"stephen.c.morton@gmail.com","avatar":"https://gravatar.com/avatar/3b826f06cabc070cbd5d53071880caad8badc3b29e0789b510353faca59ffb7b?d=mp&s=160"},"body":"On Wed, Jul 27, 2016 at 11:03 AM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Hi Stephen,\n>\n> On Wed, 27 Jul 2016, Stephen Morton wrote:\n>\n>> Here is my patch then. (Personally, I would add some capitalization and\n>> punctuation, but I didn't see much of that in the existing code.) I'm\n>> not a regular pull-requester, do I do that, or can somebody else handle\n>> that for me?\n>\n> The process of the patch submission is described in\n> Documentation/SubmittingPatches (yes, it is a bit involved, and it is\n> slightly easier when you use http://submitgit.herokuapp.com/, but please\n> note that this process has served us well over one decade).\n>\n> Please also note that top-posting is highly discouraged on this list:\n>\n> A: Because it messes up the order in which people normally read text.\n>>Q: Why is top-posting such a bad thing?\n>>>A: Top-posting.\n>>>>Q: What is the most annoying thing in e-mail?\n>\n> Now to your patch:\n>\n>> diff --git a/sequencer.c b/sequencer.c\n>> index cdfac82..ce06876 100644\n>> --- a/sequencer.c\n>> +++ b/sequencer.c\n>> @@ -176,7 +176,8 @@ static void print_advice(int show_hint, struct\n>> replay_opts *opts)\n>>                 else\n>>                         advise(_(\"after resolving the conflicts, mark\n>> the corrected paths\\n\"\n>>                                  \"with 'git add <paths>' or 'git rm <paths>'\\n\"\n>> -                                \"and commit the result with 'git commit'\"));\n>> +                                \"then continue the %s with 'git %s\n>> --continue'\\n\"\n>> +                                \"or cancel the %s operation with 'git\n>> %s --abort'\" ),  action_name(opts), action_name(opts),\n>> action_name(opts), action_name(opts));\n>\n> That is an awful lot of repetition right there, with an added\n> inconsistency that the action is referred to by its name alone in the\n> \"--continue\" case, but with \"operation\" added in the \"--abort\" case.\n>\n> And additionally, in the most common case (one commit to cherry-pick), the\n> advice now suggests a more complicated operation than necessary: a simply\n> `git commit` would be enough, then.\n>\n> Can't we have a test whether this is the last of the commits to be\n> cherry-picked, and if so, have the simpler advice again?\n>\n> Ciao,\n> Johannes\n\nOk, knowing that I'm not on the last element of the sequencer is\nbeyond my git code knowledge. I see that in do_pick_commit() , we do\nnot have a copy of the todo_list. I would assume that would be\nnecessary, but I'm not certain. I could\nfile_exists(git_path_seq_dir()). This works to determine if one or\nmany commits are being cherry-picked / reverted, although it will\nreturn true even on the last of n cherry-picks. I think that is still\nreasonable.\n\nI was trying to just take the same text as 'git status' already\ndisplays. It could indeed be made more concise.\n\nHappy to use the submission process, I just didn't know it. Thanks for\nletting me know.\n\n(Yup, sorry about the top-posting. I just wan't careful.)\n\nStephen\n"},{"id":"292710","messageId":"alpine.DEB.2.20.1608011107190.149069@virtualbox","threadId":"42933","inReplyTo":"CAH8BJxGPzpymSWPpxXRcCCx-OPckm5bVgENUEjVM-+9sr1T+6A@mail.gmail.com","subject":"Re: git cherry-pick conflict error message is deceptive when cherry-picking multiple commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-08-01T09:12:04Z","receivedAt":"2016-08-01T09:14:54Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Stephen,\n\nOn Wed, 27 Jul 2016, Stephen Morton wrote:\n\n> On Wed, Jul 27, 2016 at 11:03 AM, Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n> >\n> > On Wed, 27 Jul 2016, Stephen Morton wrote:\n> >\n> >> diff --git a/sequencer.c b/sequencer.c\n> >> index cdfac82..ce06876 100644\n> >> --- a/sequencer.c\n> >> +++ b/sequencer.c\n> >> @@ -176,7 +176,8 @@ static void print_advice(int show_hint, struct\n> >> replay_opts *opts)\n> >>                 else\n> >>                         advise(_(\"after resolving the conflicts, mark\n> >> the corrected paths\\n\"\n> >>                                  \"with 'git add <paths>' or 'git rm <paths>'\\n\"\n> >> -                                \"and commit the result with 'git commit'\"));\n> >> +                                \"then continue the %s with 'git %s\n> >> --continue'\\n\"\n> >> +                                \"or cancel the %s operation with 'git\n> >> %s --abort'\" ),  action_name(opts), action_name(opts),\n> >> action_name(opts), action_name(opts));\n> >\n> > That is an awful lot of repetition right there, with an added\n> > inconsistency that the action is referred to by its name alone in the\n> > \"--continue\" case, but with \"operation\" added in the \"--abort\" case.\n> >\n> > And additionally, in the most common case (one commit to cherry-pick), the\n> > advice now suggests a more complicated operation than necessary: a simply\n> > `git commit` would be enough, then.\n> >\n> > Can't we have a test whether this is the last of the commits to be\n> > cherry-picked, and if so, have the simpler advice again?\n> \n> Ok, knowing that I'm not on the last element of the sequencer is\n> beyond my git code knowledge.\n\nOh, my mistake: I meant to say that this information could be easily\nprovided by `pick_commits()` if it passed it to `print_advice()` via\n`do_pick_commit()`.\n\nCiao,\nJohannes\n"},{"id":"293604","messageId":"CAH8BJxE3f3HFVz5BSt_3mrcDPw0dhujNS9cS7iD0bbz_h=8dVA@mail.gmail.com","threadId":"42933","inReplyTo":"alpine.DEB.2.20.1608011107190.149069@virtualbox","subject":"Re: git cherry-pick conflict error message is deceptive when cherry-picking multiple commits","fromName":"Stephen Morton","fromEmail":"stephen.c.morton@gmail.com","sentAt":"2016-08-10T19:14:15Z","receivedAt":"2016-08-10T19:14:24Z","isPatch":false,"sender":{"key":"stephen.c.morton@gmail.com","avatar":"https://gravatar.com/avatar/3b826f06cabc070cbd5d53071880caad8badc3b29e0789b510353faca59ffb7b?d=mp&s=160"},"body":"On Mon, Aug 1, 2016 at 5:12 AM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Hi Stephen,\n>\n> On Wed, 27 Jul 2016, Stephen Morton wrote:\n>\n>> On Wed, Jul 27, 2016 at 11:03 AM, Johannes Schindelin\n>> <Johannes.Schindelin@gmx.de> wrote:\n>> >\n>> > On Wed, 27 Jul 2016, Stephen Morton wrote:\n>> >\n>> >> diff --git a/sequencer.c b/sequencer.c\n>> >> index cdfac82..ce06876 100644\n>> >> --- a/sequencer.c\n>> >> +++ b/sequencer.c\n>> >> @@ -176,7 +176,8 @@ static void print_advice(int show_hint, struct\n>> >> replay_opts *opts)\n>> >>                 else\n>> >>                         advise(_(\"after resolving the conflicts, mark\n>> >> the corrected paths\\n\"\n>> >>                                  \"with 'git add <paths>' or 'git rm <paths>'\\n\"\n>> >> -                                \"and commit the result with 'git commit'\"));\n>> >> +                                \"then continue the %s with 'git %s\n>> >> --continue'\\n\"\n>> >> +                                \"or cancel the %s operation with 'git\n>> >> %s --abort'\" ),  action_name(opts), action_name(opts),\n>> >> action_name(opts), action_name(opts));\n>> >\n>> > That is an awful lot of repetition right there, with an added\n>> > inconsistency that the action is referred to by its name alone in the\n>> > \"--continue\" case, but with \"operation\" added in the \"--abort\" case.\n>> >\n>> > And additionally, in the most common case (one commit to cherry-pick), the\n>> > advice now suggests a more complicated operation than necessary: a simply\n>> > `git commit` would be enough, then.\n>> >\n>> > Can't we have a test whether this is the last of the commits to be\n>> > cherry-picked, and if so, have the simpler advice again?\n>>\n>> Ok, knowing that I'm not on the last element of the sequencer is\n>> beyond my git code knowledge.\n>\n> Oh, my mistake: I meant to say that this information could be easily\n> provided by `pick_commits()` if it passed it to `print_advice()` via\n> `do_pick_commit()`.\n>\n> Ciao,\n> Johannes\n\n(Finally getting back to this.)\nSomething like this, then Johannes?\n(I intentionally print the '--continue' hint even in the case where\nit's last of n commits that fails.)\n\n~/ws/extern/git (maint *%>) > git diff\ndiff --git a/sequencer.c b/sequencer.c\nindex 617a3df..e0071aa 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -154,7 +154,7 @@ static void free_message(struct commit *commit,\nstruct commit_message *msg)\n        unuse_commit_buffer(commit, msg->message);\n }\n\n-static void print_advice(int show_hint, struct replay_opts *opts)\n+static void print_advice(int show_hint, int multiple_commits, struct\nreplay_opts *opts)\n {\n        char *msg = getenv(\"GIT_CHERRY_PICK_HELP\");\n\n@@ -174,14 +174,14 @@ static void print_advice(int show_hint, struct\nreplay_opts *opts)\n                        advise(_(\"after resolving the conflicts, mark\nthe corrected paths\\n\"\n                                 \"with 'git add <paths>' or 'git rm <paths>'\"));\n                else\n-                        if  (! file_exists(git_path_seq_dir()))\n-                                advise(_(\"after resolving the\nconflicts, mark the corrected paths\\n\"\n-                                        \"with 'git add <paths>' or\n'git rm <paths>'\\n\"\n-                                                 \"and commit the\nresult with 'git commit'\"));\n-                        else\n+                        if  (multiple_commits)\n                                advise(_(\"after resolving the\nconflicts, mark the corrected paths with 'git add <paths>' or 'git rm\n<paths>'\\n\"\n                                         \"then continue with 'git %s\n--continue'\\n\"\n                                         \"or cancel with 'git %s\n--abort'\" ), action_name(opts), action_name(opts));\n+                        else\n+                                advise(_(\"after resolving the\nconflicts, mark the corrected paths\\n\"\n+                                        \"with 'git add <paths>' or\n'git rm <paths>'\\n\"\n+                                        \"and commit the result with\n'git commit'\"));\n        }\n }\n\n@@ -445,7 +445,7 @@ static int allow_empty(struct replay_opts *opts,\nstruct commit *commit)\n                return 1;\n }\n\n-static int do_pick_commit(struct commit *commit, struct replay_opts *opts)\n+static int do_pick_commit(struct commit *commit, struct replay_opts\n*opts, int multiple_commits)\n {\n        unsigned char head[20];\n        struct commit *base, *next, *parent;\n@@ -600,7 +600,7 @@ static int do_pick_commit(struct commit *commit,\nstruct replay_opts *opts)\n                      : _(\"could not apply %s... %s\"),\n                      find_unique_abbrev(commit->object.oid.hash,\nDEFAULT_ABBREV),\n                      msg.subject);\n-               print_advice(res == 1, opts);\n+               print_advice(res == 1, multiple_commits, opts);\n                rerere(opts->allow_rerere_auto);\n                goto leave;\n        }\n@@ -964,6 +964,7 @@ static int pick_commits(struct commit_list\n*todo_list, struct replay_opts *opts)\n {\n        struct commit_list *cur;\n        int res;\n+    int multiple_commits = (todo_list->next) != NULL;\n\n        setenv(GIT_REFLOG_ACTION, action_name(opts), 0);\n        if (opts->allow_ff)\n@@ -973,7 +974,7 @@ static int pick_commits(struct commit_list\n*todo_list, struct replay_opts *opts)\n\n        for (cur = todo_list; cur; cur = cur->next) {\n                save_todo(cur, opts);\n-               res = do_pick_commit(cur->item, opts);\n+               res = do_pick_commit(cur->item, opts, multiple_commits);\n                if (res)\n                        return res;\n        }\n@@ -1021,7 +1022,7 @@ static int sequencer_continue(struct replay_opts *opts)\n static int single_pick(struct commit *cmit, struct replay_opts *opts)\n {\n        setenv(GIT_REFLOG_ACTION, action_name(opts), 0);\n-       return do_pick_commit(cmit, opts);\n+       return do_pick_commit(cmit, opts, 0);\n }\n\n int sequencer_pick_revisions(struct replay_opts *opts)\n~/ws/extern/git (maint *%>) > git diff @{u}\ndiff --git a/sequencer.c b/sequencer.c\nindex c6362d6..e0071aa 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -154,7 +154,7 @@ static void free_message(struct commit *commit,\nstruct commit_message *msg)\n        unuse_commit_buffer(commit, msg->message);\n }\n\n-static void print_advice(int show_hint, struct replay_opts *opts)\n+static void print_advice(int show_hint, int multiple_commits, struct\nreplay_opts *opts)\n {\n        char *msg = getenv(\"GIT_CHERRY_PICK_HELP\");\n\n@@ -174,9 +174,14 @@ static void print_advice(int show_hint, struct\nreplay_opts *opts)\n                        advise(_(\"after resolving the conflicts, mark\nthe corrected paths\\n\"\n                                 \"with 'git add <paths>' or 'git rm <paths>'\"));\n                else\n-                       advise(_(\"after resolving the conflicts, mark\nthe corrected paths\\n\"\n-                                \"with 'git add <paths>' or 'git rm <paths>'\\n\"\n-                                \"and commit the result with 'git commit'\"));\n+                        if  (multiple_commits)\n+                               advise(_(\"after resolving the\nconflicts, mark the corrected paths with 'git add <paths>' or 'git rm\n<paths>'\\n\"\n+                                        \"then continue with 'git %s\n--continue'\\n\"\n+                                        \"or cancel with 'git %s\n--abort'\" ), action_name(opts), action_name(opts));\n+                        else\n+                                advise(_(\"after resolving the\nconflicts, mark the corrected paths\\n\"\n+                                        \"with 'git add <paths>' or\n'git rm <paths>'\\n\"\n+                                        \"and commit the result with\n'git commit'\"));\n        }\n }\n\n@@ -440,7 +445,7 @@ static int allow_empty(struct replay_opts *opts,\nstruct commit *commit)\n                return 1;\n }\n\n-static int do_pick_commit(struct commit *commit, struct replay_opts *opts)\n+static int do_pick_commit(struct commit *commit, struct replay_opts\n*opts, int multiple_commits)\n {\n        unsigned char head[20];\n        struct commit *base, *next, *parent;\n@@ -595,7 +600,7 @@ static int do_pick_commit(struct commit *commit,\nstruct replay_opts *opts)\n                      : _(\"could not apply %s... %s\"),\n                      find_unique_abbrev(commit->object.oid.hash,\nDEFAULT_ABBREV),\n                      msg.subject);\n-               print_advice(res == 1, opts);\n+               print_advice(res == 1, multiple_commits, opts);\n                rerere(opts->allow_rerere_auto);\n                goto leave;\n        }\n@@ -959,6 +964,7 @@ static int pick_commits(struct commit_list\n*todo_list, struct replay_opts *opts)\n {\n        struct commit_list *cur;\n        int res;\n+    int multiple_commits = (todo_list->next) != NULL;\n\n        setenv(GIT_REFLOG_ACTION, action_name(opts), 0);\n        if (opts->allow_ff)\n@@ -968,7 +974,7 @@ static int pick_commits(struct commit_list\n*todo_list, struct replay_opts *opts)\n\n        for (cur = todo_list; cur; cur = cur->next) {\n                save_todo(cur, opts);\n-               res = do_pick_commit(cur->item, opts);\n+               res = do_pick_commit(cur->item, opts, multiple_commits);\n                if (res)\n                        return res;\n        }\n@@ -1016,7 +1022,7 @@ static int sequencer_continue(struct replay_opts *opts)\n static int single_pick(struct commit *cmit, struct replay_opts *opts)\n {\n        setenv(GIT_REFLOG_ACTION, action_name(opts), 0);\n-       return do_pick_commit(cmit, opts);\n+       return do_pick_commit(cmit, opts, 0);\n }\n\n int sequencer_pick_revisions(struct replay_opts *opts)\n\n\n------\n\nStephen\n"}]}