diff options
author | René Scharfe <l.s.r@web.de> | 2020-09-06 08:39:23 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-06 20:40:37 (GMT) |
commit | ccb181d0f053100a988ee0a240e3c0c0bb962d4d (patch) | |
tree | 53aa239b1b5bca8d7cf068c8c0cc0b92c83c32b8 /builtin/fast-import.c | |
parent | 3a238e539bcdfe3f9eb5010fd218640c1b499f7a (diff) | |
download | git-ccb181d0f053100a988ee0a240e3c0c0bb962d4d.zip git-ccb181d0f053100a988ee0a240e3c0c0bb962d4d.tar.gz git-ccb181d0f053100a988ee0a240e3c0c0bb962d4d.tar.bz2 |
fast-import: use write_pack_header()
Call write_pack_header() to hash and write a pack header instead of
open-coding this function. This gets rid of duplicate code and of the
magic version number 2 -- which has been used here since c90be46abd
(Changed fast-import's pack header creation to use pack.h, 2006-08-16)
and in pack.h (again) since 29f049a0c2 (Revert "move pack creation to
version 3", 2006-10-14).
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fast-import.c')
-rw-r--r-- | builtin/fast-import.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 1c85eaf..1bf50a7 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -739,7 +739,6 @@ static void start_packfile(void) { struct strbuf tmp_file = STRBUF_INIT; struct packed_git *p; - struct pack_header hdr; int pack_fd; pack_fd = odb_mkstemp(&tmp_file, "pack/tmp_pack_XXXXXX"); @@ -750,13 +749,8 @@ static void start_packfile(void) p->do_not_close = 1; pack_file = hashfd(pack_fd, p->pack_name); - hdr.hdr_signature = htonl(PACK_SIGNATURE); - hdr.hdr_version = htonl(2); - hdr.hdr_entries = 0; - hashwrite(pack_file, &hdr, sizeof(hdr)); - pack_data = p; - pack_size = sizeof(hdr); + pack_size = write_pack_header(pack_file, 0); object_count = 0; REALLOC_ARRAY(all_packs, pack_id + 1); |