diff options
Diffstat (limited to 'builtin-describe.c')
-rw-r--r-- | builtin-describe.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin-describe.c b/builtin-describe.c index 08d18507ac..2f1e7ba150 100644 --- a/builtin-describe.c +++ b/builtin-describe.c @@ -17,6 +17,7 @@ static const char * const describe_usage[] = { static int debug; /* Display lots of verbose info */ static int all; /* Default to annotated tags only */ static int tags; /* But allow any tags if --tags is specified */ +static int longformat; static int abbrev = DEFAULT_ABBREV; static int max_candidates = 10; const char *pattern = NULL; @@ -165,6 +166,9 @@ static void display_name(struct commit_name *n) printf("%s", n->tag->tag); else printf("%s", n->path); + if (longformat) + printf("-0-g%s", + find_unique_abbrev(n->tag->tagged->sha1, abbrev)); } static void describe(const char *arg, int last_one) @@ -293,6 +297,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix) OPT_BOOLEAN(0, "debug", &debug, "debug search strategy on stderr"), OPT_BOOLEAN(0, "all", &all, "use any ref in .git/refs"), OPT_BOOLEAN(0, "tags", &tags, "use any tag in .git/refs/tags"), + OPT_BOOLEAN(0, "long", &longformat, "always use long format"), OPT__ABBREV(&abbrev), OPT_SET_INT(0, "exact-match", &max_candidates, "only output exact matches", 0), @@ -311,6 +316,9 @@ int cmd_describe(int argc, const char **argv, const char *prefix) save_commit_buffer = 0; + if (longformat && abbrev == 0) + die("--long is incompatible with --abbrev=0"); + if (contains) { const char **args = xmalloc((6 + argc) * sizeof(char*)); int i = 0; |