Merge branch 'wc/rebase-insn'

* wc/rebase-insn:
  Mention that git-rm can be an appropriate resolution as well as git-add.
  revert/cherry-pick: Allow overriding the help text by the calling Porcelain
This commit is contained in:
Junio C Hamano 2007-12-02 23:00:28 -08:00
commit 5b0d61637c
2 changed files with 28 additions and 10 deletions

View File

@ -224,6 +224,27 @@ static int merge_recursive(const char *base_sha1,
return run_command_v_opt(argv, RUN_COMMAND_NO_STDIN | RUN_GIT_CMD);
}
static char *help_msg(const unsigned char *sha1)
{
static char helpbuf[1024];
char *msg = getenv("GIT_CHERRY_PICK_HELP");
if (msg)
return msg;
strcpy(helpbuf, " After resolving the conflicts,\n"
"mark the corrected paths with 'git add <paths>' "
"or 'git rm <paths>' and commit the result.");
if (action == CHERRY_PICK) {
sprintf(helpbuf + strlen(helpbuf),
"\nWhen commiting, use the option "
"'-c %s' to retain authorship and message.",
find_unique_abbrev(sha1, DEFAULT_ABBREV));
}
return helpbuf;
}
static int revert_or_cherry_pick(int argc, const char **argv)
{
unsigned char head[20];
@ -352,16 +373,8 @@ static int revert_or_cherry_pick(int argc, const char **argv)
}
if (close(msg_fd) || commit_lock_file(&msg_file) < 0)
die ("Error wrapping up %s", defmsg);
fprintf(stderr, "Automatic %s failed. "
"After resolving the conflicts,\n"
"mark the corrected paths with 'git add <paths>' "
"and commit the result.\n", me);
if (action == CHERRY_PICK) {
fprintf(stderr, "When commiting, use the option "
"'-c %s' to retain authorship and message.\n",
find_unique_abbrev(commit->object.sha1,
DEFAULT_ABBREV));
}
fprintf(stderr, "Automatic %s failed.%s\n",
me, help_msg(commit->object.sha1));
exit(1);
}
if (close(msg_fd) || commit_lock_file(&msg_file) < 0)

View File

@ -30,6 +30,11 @@ test -d "$REWRITTEN" && PRESERVE_MERGES=t
test -f "$DOTEST"/strategy && STRATEGY="$(cat "$DOTEST"/strategy)"
test -f "$DOTEST"/verbose && VERBOSE=t
GIT_CHERRY_PICK_HELP=" After resolving the conflicts,
mark the corrected paths with 'git add <paths>', and
run 'git rebase --continue'"
export GIT_CHERRY_PICK_HELP
warn () {
echo "$*" >&2
}