]> git.ipfire.org Git - thirdparty/git.git/blobdiff - fast-import.c
csum-file: rename hashclose() to finalize_hashfile()
[thirdparty/git.git] / fast-import.c
index f20f30ab622586c5ea66ef26e32fdf83879e2b90..1b58fca9f0ee21be8988d225bf76d6d4b1190e66 100644 (file)
@@ -316,7 +316,7 @@ static struct atom_str **atom_table;
 /* The .pack file being generated */
 static struct pack_idx_option pack_idx_opts;
 static unsigned int pack_id;
-static struct sha1file *pack_file;
+static struct hashfile *pack_file;
 static struct packed_git *pack_data;
 static struct packed_git **all_packs;
 static off_t pack_size;
@@ -905,12 +905,12 @@ static void start_packfile(void)
 
        p->pack_fd = pack_fd;
        p->do_not_close = 1;
-       pack_file = sha1fd(pack_fd, p->pack_name);
+       pack_file = hashfd(pack_fd, p->pack_name);
 
        hdr.hdr_signature = htonl(PACK_SIGNATURE);
        hdr.hdr_version = htonl(2);
        hdr.hdr_entries = 0;
-       sha1write(pack_file, &hdr, sizeof(hdr));
+       hashwrite(pack_file, &hdr, sizeof(hdr));
 
        pack_data = p;
        pack_size = sizeof(hdr);
@@ -1016,7 +1016,7 @@ static void end_packfile(void)
                struct tag *t;
 
                close_pack_windows(pack_data);
-               sha1close(pack_file, cur_pack_oid.hash, 0);
+               finalize_hashfile(pack_file, cur_pack_oid.hash, 0);
                fixup_pack_header_footer(pack_data->pack_fd, pack_data->sha1,
                                    pack_data->pack_name, object_count,
                                    cur_pack_oid.hash, pack_size);
@@ -1182,23 +1182,23 @@ static int store_object(
 
                hdrlen = encode_in_pack_object_header(hdr, sizeof(hdr),
                                                      OBJ_OFS_DELTA, deltalen);
-               sha1write(pack_file, hdr, hdrlen);
+               hashwrite(pack_file, hdr, hdrlen);
                pack_size += hdrlen;
 
                hdr[pos] = ofs & 127;
                while (ofs >>= 7)
                        hdr[--pos] = 128 | (--ofs & 127);
-               sha1write(pack_file, hdr + pos, sizeof(hdr) - pos);
+               hashwrite(pack_file, hdr + pos, sizeof(hdr) - pos);
                pack_size += sizeof(hdr) - pos;
        } else {
                e->depth = 0;
                hdrlen = encode_in_pack_object_header(hdr, sizeof(hdr),
                                                      type, dat->len);
-               sha1write(pack_file, hdr, hdrlen);
+               hashwrite(pack_file, hdr, hdrlen);
                pack_size += hdrlen;
        }
 
-       sha1write(pack_file, out, s.total_out);
+       hashwrite(pack_file, out, s.total_out);
        pack_size += s.total_out;
 
        e->idx.crc32 = crc32_end(pack_file);
@@ -1217,9 +1217,9 @@ static int store_object(
        return 0;
 }
 
-static void truncate_pack(struct sha1file_checkpoint *checkpoint)
+static void truncate_pack(struct hashfile_checkpoint *checkpoint)
 {
-       if (sha1file_truncate(pack_file, checkpoint))
+       if (hashfile_truncate(pack_file, checkpoint))
                die_errno("cannot truncate pack to skip duplicate");
        pack_size = checkpoint->offset;
 }
@@ -1235,7 +1235,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
        off_t offset;
        git_hash_ctx c;
        git_zstream s;
-       struct sha1file_checkpoint checkpoint;
+       struct hashfile_checkpoint checkpoint;
        int status = Z_OK;
 
        /* Determine if we should auto-checkpoint. */
@@ -1243,7 +1243,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
                || (pack_size + 60 + len) < pack_size)
                cycle_packfile();
 
-       sha1file_checkpoint(pack_file, &checkpoint);
+       hashfile_checkpoint(pack_file, &checkpoint);
        offset = checkpoint.offset;
 
        hdrlen = xsnprintf((char *)out_buf, out_sz, "blob %" PRIuMAX, len) + 1;
@@ -1277,7 +1277,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
 
                if (!s.avail_out || status == Z_STREAM_END) {
                        size_t n = s.next_out - out_buf;
-                       sha1write(pack_file, out_buf, n);
+                       hashwrite(pack_file, out_buf, n);
                        pack_size += n;
                        s.next_out = out_buf;
                        s.avail_out = out_sz;
@@ -1362,7 +1362,7 @@ static void *gfi_unpack_entry(
                 * the newly written data.
                 */
                close_pack_windows(p);
-               sha1flush(pack_file);
+               hashflush(pack_file);
 
                /* We have to offer rawsz bytes additional on the end of
                 * the packfile as the core unpacker code assumes the