diff --git a/builtin-describe.c b/builtin-describe.c
index 08d18507ac99a6c852f04d5b069857347dc5c0b8..2f1e7ba150098dfa85c8ffe009b318c22bedcbbd 100644 (file)
--- a/builtin-describe.c
+++ b/builtin-describe.c
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;
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)
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),
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;