summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 99d8ea2)
raw | patch | inline | side by side (parent: 99d8ea2)
author | Santi Béjar <sbejar@gmail.com> | |
Mon, 25 Feb 2008 09:43:33 +0000 (10:43 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 26 Feb 2008 02:59:20 +0000 (18:59 -0800) |
This is useful when you want to see parts of the commit object name
in "describe" output, even when the commit in question happens to be
a tagged version. Instead of just emitting the tag name, it will
describe such a commit as v1.2-0-deadbeef (0th commit since tag v1.2
that points at object deadbeef....).
Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
in "describe" output, even when the commit in question happens to be
a tagged version. Instead of just emitting the tag name, it will
describe such a commit as v1.2-0-deadbeef (0th commit since tag v1.2
that points at object deadbeef....).
Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-describe.txt | patch | blob | history | |
builtin-describe.c | patch | blob | history | |
t/t6120-describe.sh | patch | blob | history |
index 1c3dfb40c63350651efb570ed540b69c34ccbc81..270b80875516772618b35fccd1bbac31a5bb46d3 100644 (file)
being employed to standard error. The tag name will still
be printed to standard out.
+--long::
+ Always output the long format (the tag, the number of commits
+ and the abbreviated commit name) even when it matches a tag.
+ This is useful when you want to see parts of the commit object name
+ in "describe" output, even when the commit in question happens to be
+ a tagged version. Instead of just emitting the tag name, it will
+ describe such a commit as v1.2-0-deadbeef (0th commit since tag v1.2
+ that points at object deadbeef....).
+
--match <pattern>::
Only consider tags matching the given pattern (can be used to avoid
leaking private tags made from the repository).
diff --git a/builtin-describe.c b/builtin-describe.c
index 3428483134156f4e1761aa47ed2e8098a294808c..3fd2e7371f2b685d4dd5868c5b3294b224c9d4f0 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;
n = cmit->util;
if (n) {
- printf("%s\n", n->path);
+ if (!longformat)
+ printf("%s\n", n->path);
+ else
+ printf("%s-0-g%s\n", n->path,
+ find_unique_abbrev(cmit->object.sha1, abbrev));
return;
}
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_INTEGER(0, "candidates", &max_candidates,
"consider <n> most recent tags (default: 10)"),
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;
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index ae8ee11183833fd4610adb1f83763eba381f7850..a7557bdc79623dfc7648097985b8d09aea1801df 100755 (executable)
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
check_describe A-* --tags HEAD^^2
check_describe B --tags HEAD^^2^
+check_describe B-0-* --long HEAD^^2^
+
test_done