summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: feededd)
raw | patch | inline | side by side (parent: feededd)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 24 Feb 2008 08:07:28 +0000 (03:07 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 24 Feb 2008 18:01:24 +0000 (10:01 -0800) |
If we aren't going to use a ref there is no reason for us to open
its object from the object database. This avoids opening any of
the head commits reachable from refs/heads/ unless they are also
reachable through the commit we have been asked to describe and
we need to walk through it to find a tag.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
its object from the object database. This avoids opening any of
the head commits reachable from refs/heads/ unless they are also
reachable through the commit we have been asked to describe and
we need to walk through it to find a tag.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
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 bfd25e232454d977e2ad1b9e68ab6ff4c739381d..9c958bd84b839cb501c977ecb7a23ce5400c3f2c 100644 (file)
--- a/builtin-describe.c
+++ b/builtin-describe.c
static int get_name(const char *path, const unsigned char *sha1, int flag, void *cb_data)
{
+ int might_be_tag = !prefixcmp(path, "refs/tags/");
struct commit *commit;
struct object *object;
unsigned char peeled[20];
int is_tag, prio;
+ if (!all && !might_be_tag)
+ return 0;
+
if (!peel_ref(path, peeled) && !is_null_sha1(peeled)) {
commit = lookup_commit_reference_gently(peeled, 1);
if (!commit)
* If --tags, then any tags are used.
* Otherwise only annotated tags are used.
*/
- if (!prefixcmp(path, "refs/tags/")) {
+ if (might_be_tag) {
if (is_tag) {
prio = 2;
if (pattern && fnmatch(pattern, path + 10, 0))