Skip to content

Commit ccb181d

Browse files
rscharfegitster
authored andcommitted
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 c90be46 (Changed fast-import's pack header creation to use pack.h, 2006-08-16) and in pack.h (again) since 29f049a (Revert "move pack creation to version 3", 2006-10-14). Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3a238e5 commit ccb181d

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

builtin/fast-import.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,6 @@ static void start_packfile(void)
739739
{
740740
struct strbuf tmp_file = STRBUF_INIT;
741741
struct packed_git *p;
742-
struct pack_header hdr;
743742
int pack_fd;
744743

745744
pack_fd = odb_mkstemp(&tmp_file, "pack/tmp_pack_XXXXXX");
@@ -750,13 +749,8 @@ static void start_packfile(void)
750749
p->do_not_close = 1;
751750
pack_file = hashfd(pack_fd, p->pack_name);
752751

753-
hdr.hdr_signature = htonl(PACK_SIGNATURE);
754-
hdr.hdr_version = htonl(2);
755-
hdr.hdr_entries = 0;
756-
hashwrite(pack_file, &hdr, sizeof(hdr));
757-
758752
pack_data = p;
759-
pack_size = sizeof(hdr);
753+
pack_size = write_pack_header(pack_file, 0);
760754
object_count = 0;
761755

762756
REALLOC_ARRAY(all_packs, pack_id + 1);

0 commit comments

Comments
 (0)