aboutsummaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-01-19 08:25:46 -0800
committerJunio C Hamano <gitster@pobox.com>2011-01-19 08:25:46 -0800
commit267684f0b7428583ba88c4acc0e9ef322a36b3ff (patch)
treecb21bc7e1ecdf106029db7774b83537a559ab517 /fast-import.c
parentf326a06497c6609b109c35bab6d8187b02dad81f (diff)
parentb7c1ce4f14f37600a8a5bf8d81e0a723d42644b9 (diff)
downloadgit-267684f0b7428583ba88c4acc0e9ef322a36b3ff.tar.gz
git-267684f0b7428583ba88c4acc0e9ef322a36b3ff.tar.xz
Merge branch 'jn/maint-fast-import-object-reuse' into maint
* 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 eab68d58c..613623be1 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -539,22 +539,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;
}