]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/fast-import.c
Merge branch 'ab/object-file-api-updates'
[thirdparty/git.git] / builtin / fast-import.c
index b7105fcad9bae67c93c8087a8206ec962793a4ca..ad045c7c2d8b9510f50dc3a9a94d859b40940e43 100644 (file)
@@ -944,8 +944,8 @@ static int store_object(
        git_hash_ctx c;
        git_zstream s;
 
-       hdrlen = xsnprintf((char *)hdr, sizeof(hdr), "%s %lu",
-                          type_name(type), (unsigned long)dat->len) + 1;
+       hdrlen = format_object_header((char *)hdr, sizeof(hdr), type,
+                                     dat->len);
        the_hash_algo->init_fn(&c);
        the_hash_algo->update_fn(&c, hdr, hdrlen);
        the_hash_algo->update_fn(&c, dat->buf, dat->len);
@@ -1098,7 +1098,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
        hashfile_checkpoint(pack_file, &checkpoint);
        offset = checkpoint.offset;
 
-       hdrlen = xsnprintf((char *)out_buf, out_sz, "blob %" PRIuMAX, len) + 1;
+       hdrlen = format_object_header((char *)out_buf, out_sz, OBJ_BLOB, len);
 
        the_hash_algo->init_fn(&c);
        the_hash_algo->update_fn(&c, out_buf, hdrlen);
@@ -2490,7 +2490,7 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
                unsigned long size;
                char *buf = read_object_with_reference(the_repository,
                                                       &commit_oid,
-                                                      commit_type, &size,
+                                                      OBJ_COMMIT, &size,
                                                       &commit_oid);
                if (!buf || size < the_hash_algo->hexsz + 6)
                        die("Not a valid commit: %s", p);
@@ -2562,7 +2562,7 @@ static void parse_from_existing(struct branch *b)
                char *buf;
 
                buf = read_object_with_reference(the_repository,
-                                                &b->oid, commit_type, &size,
+                                                &b->oid, OBJ_COMMIT, &size,
                                                 &b->oid);
                parse_from_commit(b, buf, size);
                free(buf);
@@ -2658,7 +2658,7 @@ static struct hash_list *parse_merge(unsigned int *count)
                        unsigned long size;
                        char *buf = read_object_with_reference(the_repository,
                                                               &n->oid,
-                                                              commit_type,
+                                                              OBJ_COMMIT,
                                                               &size, &n->oid);
                        if (!buf || size < the_hash_algo->hexsz + 6)
                                die("Not a valid commit: %s", from);