summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-12-16 12:49:16 -0800
committerJunio C Hamano <gitster@pobox.com>2010-12-16 12:49:16 -0800
commitc835288be4cac722a20f9601a920879206a0ff61 (patch)
tree4fc99ec107345b5da5380eca3fee8f5f61599a2d /fast-import.c
parentf73c3e9704b80c8813b92392cced9328f81e91d6 (diff)
parentb7c1ce4f14f37600a8a5bf8d81e0a723d42644b9 (diff)
downloadgit-c835288be4cac722a20f9601a920879206a0ff61.tar.gz
Merge branch 'jn/maint-fast-import-object-reuse'
* jn/maint-fast-import-object-reuse: fast-import: insert new object entries at start of hash bucket
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/fast-import.c b/fast-import.c
index 2b23635d60..3c58e6f04a 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -569,22 +569,17 @@ static struct object_entry *insert_object(unsigned char *sha1)
{
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;
}