Skip to content

Commit 267684f

Browse files
committed
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
2 parents f326a06 + b7c1ce4 commit 267684f

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

fast-import.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -539,22 +539,17 @@ static struct object_entry *insert_object(unsigned char *sha1)
539539
{
540540
unsigned int h = sha1[0] << 8 | sha1[1];
541541
struct object_entry *e = object_table[h];
542-
struct object_entry *p = NULL;
543542

544543
while (e) {
545544
if (!hashcmp(sha1, e->idx.sha1))
546545
return e;
547-
p = e;
548546
e = e->next;
549547
}
550548

551549
e = new_object(sha1);
552-
e->next = NULL;
550+
e->next = object_table[h];
553551
e->idx.offset = 0;
554-
if (p)
555-
p->next = e;
556-
else
557-
object_table[h] = e;
552+
object_table[h] = e;
558553
return e;
559554
}
560555

0 commit comments

Comments
 (0)