Code

Add git-replace to .gitignore
[git.git] / builtin-pack-objects.c
index d3360ac1f8bf13a00f90d9f385d69b628471a95d..b2c93d3d212055dd097ce696dea8f3beba6afc6a 100644 (file)
@@ -293,7 +293,7 @@ static unsigned long write_object(struct sha1file *f,
                                die("unable to read %s", sha1_to_hex(entry->idx.sha1));
                        /*
                         * make sure no cached delta data remains from a
-                        * previous attempt before a pack split occured.
+                        * previous attempt before a pack split occurred.
                         */
                        free(entry->delta_data);
                        entry->delta_data = NULL;
@@ -1907,13 +1907,19 @@ static void show_commit(struct commit *commit, void *data)
        commit->object.flags |= OBJECT_ADDED;
 }
 
-static void show_object(struct object_array_entry *p, void *data)
+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)
@@ -2097,6 +2103,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
        int rp_ac_alloc = 64;
        int rp_ac;
 
+       read_replace_refs = 0;
+
        rp_av = xcalloc(rp_ac_alloc, sizeof(*rp_av));
 
        rp_av[0] = "pack-objects";