diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/describe.c | 3 | ||||
-rw-r--r-- | builtin/name-rev.c | 17 |
2 files changed, 18 insertions, 2 deletions
diff --git a/builtin/describe.c b/builtin/describe.c index db41cd7974..7d73722f59 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -446,7 +446,8 @@ int cmd_describe(int argc, const char **argv, const char *prefix) struct argv_array args; argv_array_init(&args); - argv_array_pushl(&args, "name-rev", "--name-only", "--no-undefined", + argv_array_pushl(&args, "name-rev", + "--peel-tag", "--name-only", "--no-undefined", NULL); if (always) argv_array_push(&args, "--always"); diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 4c7cc62a9c..0aaa19e4ab 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -307,7 +307,7 @@ static void name_rev_line(char *p, struct name_ref_data *data) int cmd_name_rev(int argc, const char **argv, const char *prefix) { struct object_array revs = OBJECT_ARRAY_INIT; - int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0; + int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0, peel_tag = 0; struct name_ref_data data = { 0, 0, NULL }; struct option opts[] = { OPT_BOOLEAN(0, "name-only", &data.name_only, N_("print only names (no SHA-1)")), @@ -320,6 +320,12 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) OPT_BOOLEAN(0, "undefined", &allow_undefined, N_("allow to print `undefined` names")), OPT_BOOLEAN(0, "always", &always, N_("show abbreviated commit object as fallback")), + { + /* A Hidden OPT_BOOL */ + OPTION_SET_INT, 0, "peel-tag", &peel_tag, NULL, + N_("dereference tags in the input (internal use)"), + PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, NULL, 1, + }, OPT_END(), }; @@ -361,6 +367,15 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) if (cutoff > commit->date) cutoff = commit->date; } + + if (peel_tag) { + if (!commit) { + fprintf(stderr, "Could not get commit for %s. Skipping.\n", + *argv); + continue; + } + object = (struct object *)commit; + } add_object_array(object, *argv, &revs); } |