summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4cfbe06)
raw | patch | inline | side by side (parent: 4cfbe06)
author | Björn Steinbrink <B.Steinbrink@gmx.de> | |
Thu, 6 Aug 2009 12:15:14 +0000 (14:15 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 6 Aug 2009 20:35:55 +0000 (13:35 -0700) |
If we find no refs that may be used for git-describe with the current
options, then die early instead of pointlessly walking the whole
history.
In git.git with all the tags dropped, this makes "git describe" go down
from 0.244 to 0.003 seconds for me. This is especially noticeable with
"git submodule status" which calls describe with increasing levels of
allowed refs to be matched. For a submodule without tags, this means
that it walks the whole history in the submodule twice (first annotated,
then plain tags), just to find out that it can't describe the commit
anyway.
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
options, then die early instead of pointlessly walking the whole
history.
In git.git with all the tags dropped, this makes "git describe" go down
from 0.244 to 0.003 seconds for me. This is especially noticeable with
"git submodule status" which calls describe with increasing levels of
allowed refs to be matched. For a submodule without tags, this means
that it walks the whole history in the submodule twice (first annotated,
then plain tags), just to find out that it can't describe the commit
anyway.
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-describe.c | patch | blob | history |
diff --git a/builtin-describe.c b/builtin-describe.c
index 7a662980d102a275fceb8299bba0b84b41a8f9cb..df67a733ae5c91b0b4278c31c12a7432c0ec601e 100644 (file)
--- a/builtin-describe.c
+++ b/builtin-describe.c
static int longformat;
static int abbrev = DEFAULT_ABBREV;
static int max_candidates = 10;
+static int found_names;
static const char *pattern;
static int always;
memcpy(e->path, path, len);
commit->util = e;
}
+ found_names = 1;
}
static int get_name(const char *path, const unsigned char *sha1, int flag, void *cb_data)
for_each_ref(get_name, NULL);
}
+ if (!found_names)
+ die("cannot describe '%s'", sha1_to_hex(sha1));
+
n = cmit->util;
if (n) {
/*