Git 2.5.6
[gitweb.git] / builtin / pack-objects.c
index c067107a6a6b8d6f797854d1e3a7cc9ce5da0cdc..53307d53b00812a40b2958aa01bff3ccca6f6298 100644 (file)
@@ -540,11 +540,11 @@ static enum write_one_status write_one(struct sha1file *f,
        return WRITE_ONE_WRITTEN;
 }
 
-static int mark_tagged(const char *path, const unsigned char *sha1, int flag,
+static int mark_tagged(const char *path, const struct object_id *oid, int flag,
                       void *cb_data)
 {
        unsigned char peeled[20];
-       struct object_entry *entry = packlist_find(&to_pack, sha1, NULL);
+       struct object_entry *entry = packlist_find(&to_pack, oid->hash, NULL);
 
        if (entry)
                entry->tagged = 1;
@@ -2097,14 +2097,14 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
 #define ll_find_deltas(l, s, w, d, p)  find_deltas(l, &s, w, d, p)
 #endif
 
-static int add_ref_tag(const char *path, const unsigned char *sha1, int flag, void *cb_data)
+static int add_ref_tag(const char *path, const struct object_id *oid, int flag, void *cb_data)
 {
-       unsigned char peeled[20];
+       struct object_id peeled;
 
        if (starts_with(path, "refs/tags/") && /* is a tag? */
-           !peel_ref(path, peeled)        && /* peelable? */
-           packlist_find(&to_pack, peeled, NULL))      /* object packed? */
-               add_object_entry(sha1, OBJ_TAG, NULL, 0);
+           !peel_ref(path, peeled.hash)    && /* peelable? */
+           packlist_find(&to_pack, peeled.hash, NULL))      /* object packed? */
+               add_object_entry(oid->hash, OBJ_TAG, NULL, 0);
        return 0;
 }
 
@@ -2284,21 +2284,11 @@ static void show_commit(struct commit *commit, void *data)
                index_commit_for_bitmap(commit);
 }
 
-static void show_object(struct object *obj,
-                       const struct name_path *path, const char *last,
-                       void *data)
+static void show_object(struct object *obj, const char *name, void *data)
 {
-       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)
@@ -2480,8 +2470,7 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
 }
 
 static void record_recent_object(struct object *obj,
-                                const struct name_path *path,
-                                const char *last,
+                                const char *name,
                                 void *data)
 {
        sha1_array_append(&recent_objects, obj->sha1);