git cherry-pick conflict error message is deceptive when cherry-picking multiple commits
- From
Stephen Morton <stephen.c.morton@gmail.com>
- Date
- Jul 26, 2016, 19:40 UTC
- Message-ID
- <CAH8BJxGZW8eNQogksZ416sVaBkpQ78uYkV7FtN6wxGafzNwjAg@mail.gmail.com>
When I cherry-pick n commits and one of the first (n-1), fails, what I should do is resolve the conflict, 'git add' it, and then run 'git cherry-pick --continue'. However git advises me to
error: could not apply d0fb756... Commit message for test commit hint: after resolving the conflicts, mark the corrected paths hint: with 'git add <paths>' or 'git rm <paths>' hint: and commit the result with 'git commit'
I suspect this is not just a little bit deceptive but actually a bit destructive, as doing a 'git commit' removes some of the sequencing information. If I do a 'git commit', while there is .git/sequencer information and 'git cherry-pick --continue' will work, there is no indication in 'git status' that a cherry-pick is in progress.
It would be extremely easy for somebody to follow cherry-pick's hints by running 'git commit' and think that they were done, not realizing that there were m more commits remaining to be cherry-picked.
Would it be possible to expand the hint message to tell users to run 'git cherry-pick --continue'
This patch is *not* meant as a serious patch for submission --I'm sure it's all wrong-- it's just a proof of concept and showing some goodwill on my part that I'm trying to help and I'm willing to put in some work if I can be pointed more in the right direction.
Regards, Stephen
diff --git a/sequencer.c b/sequencer.c index cdfac82..b8fa534 100644 --- a/sequencer.c +++ b/sequencer.c @@ -171,14 +171,21 @@ static void print_advice(int show_hint, struct replay_opts *opts) if (show_hint) { if (opts->no_commit) advise(_("after resolving the conflicts, mark the corrected paths\n" "with 'git add <paths>' or 'git rm <paths>'")); - else - advise(_("after resolving the conflicts, mark the corrected paths\n" - "with 'git add <paths>' or 'git rm <paths>'\n" - "and commit the result with 'git commit'")); + else if (! file_exists(git_path_seq_dir())) { + advise(_("SCM: after resolving the conflicts, mark the corrected paths\n" + "with 'git add <paths>' or 'git rm <paths>'\n" + "and commit the result with 'git commit'")); + } + else + { + advise(_("SCM: after resolving the conflicts, mark the corrected paths\n" + "with 'git add <paths>' or 'git rm <paths>'\n" + "and continue the %s with 'git %s --continue'"), action_name(opts), action_name(opts)); + } } }