Linus Torvalds <torvalds@osdl.org> writes: > What it does is to take any random commit, and "name" it by looking up the > most recent commit that is tagged and reachable from that commit. Sounds useful. > Comments? > +static struct commit_name { > + const struct commit *commit; > + char path[]; > +} **name_array = NULL; I wonder if some tags are more important than others (we may want to pick a signed tag that is a bit further down than an autogenerated snapshot -git47 tag), but that depends on the usage. For bug hunting -git47 is more useful than sparsely done signed tags e.g. -rc4. > +static void describe(struct commit *cmit) > +... > + list = NULL; > + commit_list_insert(cmit, &list); > + while (list) { > + struct commit *c = pop_most_recent_commit(&list, SEEN); > + n = match(c); > + if (n) { > + printf("%s-g%.8s\n", n->path, sha1_to_hex(cmit->object.sha1)); > + return; > + } > + } > +} I think this leaks list elements but until/unless this is libified we would not care too much about it. We could use find_unique_abbrev(cmit->object.sha1, 8) but probably it is an overkill. - 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 Sun Dec 25 12:42:59 2005
This archive was generated by hypermail 2.1.8 : 2005-12-25 12:43:06 EST