cherry-pick: do not give irrelevant advice when cherry-pick punted

If a cherry-pick did not even start because the working tree had local changes that would overlap with the operation, we shouldn't be advising the users to resolve conflicts nor to conclude it with "git commit". Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jay Soffian committed Oct 6, 2011 at 13:58 UTC 82352cb633f30fef9dd837235c328890da12930e
1 file changed +7 -5
builtin/revert.c
+7 -5
@@ -223,7 +223,7 @@ static void advise(const char *advice, ...)
223 va_end(params);
224 }
225
226 -static void print_advice(void)
226 +static void print_advice(int show_hint)
227 {
228 char *msg = getenv("GIT_CHERRY_PICK_HELP");
229
@@ -238,9 +238,11 @@ static void print_advice(void)
238 return;
239 }
240
241 - advise("after resolving the conflicts, mark the corrected paths");
242 - advise("with 'git add <paths>' or 'git rm <paths>'");
243 - advise("and commit the result with 'git commit'");
241 + if (show_hint) {
242 + advise("after resolving the conflicts, mark the corrected paths");
243 + advise("with 'git add <paths>' or 'git rm <paths>'");
244 + advise("and commit the result with 'git commit'");
245 + }
246 }
247
248 static void write_message(struct strbuf *msgbuf, const char *filename)
@@ -516,7 +518,7 @@ static int do_pick_commit(void)
518 : _("could not apply %s... %s"),
519 find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),
520 msg.subject);
519 - print_advice();
521 + print_advice(res == 1);
522 rerere(allow_rerere_auto);
523 } else {
524 if (!no_commit)