git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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));
+        }
        }
 }
Next: Stefan Beller
Message 1 of 9 in “git cherry-pick conflict error message is deceptive when cherry-picking multiple commits”
  1. Stephen MortonJul 26, 2016
  2. Stefan BellerJul 26, 2016
  3. Jeff KingJul 26, 2016
  4. Stephen MortonJul 26, 2016
  5. Stephen MortonJul 27, 2016
  6. Johannes SchindelinJul 27, 2016
  7. Stephen MortonJul 27, 2016
  8. Johannes SchindelinAug 1, 2016
  9. Stephen MortonAug 10, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.