summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 56a5f3a)
raw | patch | inline | side by side (parent: 56a5f3a)
author | Anders Kaseorg <andersk@ksplice.com> | |
Thu, 9 Dec 2010 06:43:32 +0000 (01:43 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 9 Dec 2010 19:20:25 +0000 (11:20 -0800) |
Now add_to_known_names overwrites commit_names in place when multiple
tags point to the same commit. This will make it easier to store
commit_names in a hash table.
Signed-off-by: Anders Kaseorg <andersk@ksplice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tags point to the same commit. This will make it easier to store
commit_names in a hash table.
Signed-off-by: Anders Kaseorg <andersk@ksplice.com>
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 700f74015460b8cdae9ba2d5be4607310af144c0..5b8461d87fa03eb9ec2363c2bea0bfa1126c57cc 100644 (file)
--- a/builtin/describe.c
+++ b/builtin/describe.c
unsigned prio:2; /* annotated tag = 2, tag = 1, head = 0 */
unsigned name_checked:1;
unsigned char sha1[20];
- char path[FLEX_ARRAY]; /* more */
+ const char *path;
};
static const char *prio_names[] = {
"head", "lightweight", "annotated",
struct commit_name *e = commit->util;
struct tag *tag = NULL;
if (replace_name(e, prio, sha1, &tag)) {
- size_t len = strlen(path)+1;
- free(e);
- e = xmalloc(sizeof(struct commit_name) + len);
+ if (!e) {
+ e = xmalloc(sizeof(struct commit_name));
+ commit->util = e;
+ }
e->tag = tag;
e->prio = prio;
e->name_checked = 0;
hashcpy(e->sha1, sha1);
- memcpy(e->path, path, len);
- commit->util = e;
+ e->path = path;
}
found_names = 1;
}