author | Junio C Hamano <gitster@pobox.com> | |
Thu, 16 Dec 2010 20:49:16 +0000 (12:49 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 16 Dec 2010 20:49:16 +0000 (12:49 -0800) |
* jn/maint-fast-import-object-reuse:
fast-import: insert new object entries at start of hash bucket
fast-import: insert new object entries at start of hash bucket
fast-import.c | patch | blob | history |
diff --git a/fast-import.c b/fast-import.c
index 2b23635d607c871a67b7851aec8809822b284807..3c58e6f04a878c14f398b0fbb501475e842ea0ac 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
{
unsigned int h = sha1[0] << 8 | sha1[1];
struct object_entry *e = object_table[h];
- struct object_entry *p = NULL;
while (e) {
if (!hashcmp(sha1, e->idx.sha1))
return e;
- p = e;
e = e->next;
}
e = new_object(sha1);
- e->next = NULL;
+ e->next = object_table[h];
e->idx.offset = 0;
- if (p)
- p->next = e;
- else
- object_table[h] = e;
+ object_table[h] = e;
return e;
}