Code

Merge branch 'lt/pack-object-memuse' into maint
[git.git] / builtin-pack-objects.c
index 6cf5b86e15bd01d03aad4c3476a005923542a6f3..b859cb147c707d76685e999284d8cc647977e6a0 100644 (file)
@@ -1907,13 +1907,19 @@ static void show_commit(struct commit *commit)
        commit->object.flags |= OBJECT_ADDED;
 }
 
-static void show_object(struct object_array_entry *p)
+static void show_object(struct object *obj, const struct name_path *path, const char *last)
 {
-       add_preferred_base_object(p->name);
-       add_object_entry(p->item->sha1, p->item->type, p->name, 0);
-       p->item->flags |= OBJECT_ADDED;
-       free((char *)p->name);
-       p->name = NULL;
+       char *name = path_name(path, last);
+
+       add_preferred_base_object(name);
+       add_object_entry(obj->sha1, obj->type, name, 0);
+       obj->flags |= OBJECT_ADDED;
+
+       /*
+        * We will have generated the hash from the name,
+        * but not saved a pointer to it - we can free it
+        */
+       free((char *)name);
 }
 
 static void show_edge(struct commit *commit)