summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorPhil Hord <hordp@cisco.com>2012-02-21 19:44:17 -0500
committerJunio C Hamano <gitster@pobox.com>2012-02-22 11:13:43 -0800
commited727b192bb3506ee7904c1c9e8370d6b4ecaf5d (patch)
treede21fef09f9d9bcbc64f28b194d0b23c3f9b46e4 /sequencer.c
parent7010146f90abf0e4954690f6cd38a8463786fec7 (diff)
downloadgit-ed727b192bb3506ee7904c1c9e8370d6b4ecaf5d.tar.gz
cherry-pick: No advice to commit if --no-commitph/cherry-pick-advice-refinement
When cherry-pick fails it offers a helpful hint about how to proceed. The hint tells the user how to do the cleanup needed by the conflicted cherry-pick and finish the job after conflict resolution. In case of cherry-pick --no-commit, the hint goes too far. It tells the user to finish up with 'git commit'. That is not what this git-cherry-pick was trying to do in the first place. Restrict the hint in case of --no-commit to avoid giving this extra advice. Also, add a test verifying the reduced hint for the --no-commit version of cherry-pick. Signed-off-by: Phil Hord <hordp@cisco.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sequencer.c b/sequencer.c
index 5fcbcb8875..a37846a594 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -123,7 +123,7 @@ static void write_cherry_pick_head(struct commit *commit, const char *pseudoref)
strbuf_release(&buf);
}
-static void print_advice(int show_hint)
+static void print_advice(int show_hint, struct replay_opts *opts)
{
char *msg = getenv("GIT_CHERRY_PICK_HELP");
@@ -138,10 +138,15 @@ static void print_advice(int show_hint)
return;
}
- if (show_hint)
- 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'"));
+ 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'"));
+ }
}
static void write_message(struct strbuf *msgbuf, const char *filename)
@@ -423,7 +428,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
: _("could not apply %s... %s"),
find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),
msg.subject);
- print_advice(res == 1);
+ print_advice(res == 1, opts);
rerere(opts->allow_rerere_auto);
} else {
if (!opts->no_commit)