]> git.ipfire.org Git - thirdparty/git.git/blobdiff - fast-import.c
Merge branch 'jn/maint-fast-import-object-reuse' into maint
[thirdparty/git.git] / fast-import.c
index eab68d58c394a67f4805d77b0007b583e79e24b9..613623be14c4c647e11b20fefb382b3f7438fb3c 100644 (file)
@@ -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;
 }