mirror of
https://github.com/git/git
synced 2024-08-28 20:20:07 +00:00
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
This commit is contained in:
commit
c835288be4
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue