Often there are references other than annotated tags under refs/tags hierarchy that are used to "keep things just in case". default to use annotated tags only, still leaving the option to use any ref with --all flag. Signed-off-by: Junio C Hamano <junkio@cox.net> --- Linus Torvalds <torvalds@osdl.org> writes: > On Sat, 24 Dec 2005, Linus Torvalds wrote: >> >> This is useful for two things: >> >> - automatic version naming in Makefiles, for example. We could use it in >> git itself: when doing "git --version", we could use this to give a >> much more useful description of exactly what version was installed. > > This trivial patch fails to do that correctly, but maybe somebody could > fix it. Here is a 6-patch series towards that. Will be in the proposed updates later tonight. describe.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) 170c7e67e7792e0d5ce2328c1d7b8d4139a7c7e7 diff --git a/describe.c b/describe.c index ebfa429..e1b6588 100644 --- a/describe.c +++ b/describe.c @@ -1,12 +1,13 @@ #include "cache.h" #include "commit.h" +#include "tag.h" #include "refs.h" #define SEEN (1u << 0) static const char describe_usage[] = "git-describe [--all] <committish>*"; -static int all = 0; /* Default to tags only */ +static int all = 0; /* Default to annotated tags only */ static int names = 0, allocs = 0; static struct commit_name { @@ -49,9 +50,15 @@ static int get_name(const char *path, co struct commit *commit = lookup_commit_reference_gently(sha1, 1); if (!commit) return 0; - if (!all && strncmp(path, "refs/tags/", 10)) - return 0; - add_to_known_names(path, commit); + if (!all) { + struct object *object; + if (strncmp(path, "refs/tags/", 10)) + return 0; + object = parse_object(sha1); + if (object->type != tag_type) + return 0; + } + add_to_known_names(all ? path : path + 10, commit); return 0; } -- 1.0.5-geb9d - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.htmlReceived on Wed Dec 28 11:45:28 2005
This archive was generated by hypermail 2.1.8 : 2005-12-28 11:46:06 EST