Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-03 02:02:56 +0300
committerJunio C Hamano <gitster@pobox.com>2008-03-03 02:02:56 +0300
commitc42f63671c0f09cba0c8247c4d1d8121f37798fe (patch)
tree0455a5d2bb8b59fa72305235d831bbba0fc3206f /builtin-describe.c
parent7385a42572977c000c361aaad3e5ec066bd240ec (diff)
parent518120e3487a00148f8001454f1e76e484442a22 (diff)
Merge branch 'sb/describe-long'
* sb/describe-long: git-describe: --long shows the object name even for a tagged commit
Diffstat (limited to 'builtin-describe.c')
-rw-r--r--builtin-describe.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/builtin-describe.c b/builtin-describe.c
index 05e309f5ad..2342913df6 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;
@@ -170,7 +171,11 @@ static void describe(const char *arg, int last_one)
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;
}
@@ -271,6 +276,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),
@@ -289,6 +295,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;