aboutsummaryrefslogtreecommitdiff
path: root/builtin-revert.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2010-02-11 16:08:15 -0500
committerJunio C Hamano <gitster@pobox.com>2010-02-11 22:11:04 -0800
commit97915544f84132b210a336d5877fafd7cb104abe (patch)
tree9e3dcb69a0b25e2f57d1906f97e5c67f0b74f719 /builtin-revert.c
parent08565bdb4b5d1da597ed8b90d1a23729f7c006d0 (diff)
downloadgit-97915544f84132b210a336d5877fafd7cb104abe.tar.gz
git-97915544f84132b210a336d5877fafd7cb104abe.tar.xz
cherry-pick: show commit name instead of sha1
When we have a conflict, we advise the user to do: git commit -c $sha1 This works fine, but is unnecessarily confusing and annoying for the user to type, when: git commit -c $the_thing_you_called_cherry_pick_with works just as well. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-revert.c')
-rw-r--r--builtin-revert.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/builtin-revert.c b/builtin-revert.c
index 77e4f4eed..ad612497a 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -38,6 +38,7 @@ static const char * const cherry_pick_usage[] = {
static int edit, no_replay, no_commit, mainline, signoff;
static enum { REVERT, CHERRY_PICK } action;
static struct commit *commit;
+static const char *commit_name;
static int allow_rerere_auto;
static const char *me;
@@ -49,7 +50,6 @@ static void parse_args(int argc, const char **argv)
const char * const * usage_str =
action == REVERT ? revert_usage : cherry_pick_usage;
unsigned char sha1[20];
- const char *arg;
int noop;
struct option options[] = {
OPT_BOOLEAN('n', "no-commit", &no_commit, "don't automatically commit"),
@@ -64,10 +64,10 @@ static void parse_args(int argc, const char **argv)
if (parse_options(argc, argv, NULL, options, usage_str, 0) != 1)
usage_with_options(usage_str, options);
- arg = argv[0];
- if (get_sha1(arg, sha1))
- die ("Cannot find '%s'", arg);
+ commit_name = argv[0];
+ if (get_sha1(commit_name, sha1))
+ die ("Cannot find '%s'", commit_name);
commit = lookup_commit_reference(sha1);
if (!commit)
exit(1);
@@ -198,7 +198,7 @@ static void set_author_ident_env(const char *message)
sha1_to_hex(commit->object.sha1));
}
-static char *help_msg(const unsigned char *sha1)
+static char *help_msg(const char *name)
{
struct strbuf helpbuf = STRBUF_INIT;
char *msg = getenv("GIT_CHERRY_PICK_HELP");
@@ -214,7 +214,7 @@ static char *help_msg(const unsigned char *sha1)
strbuf_addf(&helpbuf,
" When committing, use the option '-c %s'\n"
"to retain authorship and message.",
- find_unique_abbrev(sha1, DEFAULT_ABBREV));
+ name);
}
return strbuf_detach(&helpbuf, NULL);
}
@@ -403,7 +403,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
if (commit_lock_file(&msg_file) < 0)
die ("Error wrapping up %s", defmsg);
fprintf(stderr, "Automatic %s failed.%s\n",
- me, help_msg(commit->object.sha1));
+ me, help_msg(commit_name));
rerere(allow_rerere_auto);
exit(1);
}