]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pack-write: pass 'struct packing_data' to 'stage_tmp_packfiles'
authorTaylor Blau <me@ttaylorr.com>
Fri, 20 May 2022 23:17:38 +0000 (19:17 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 May 2022 22:48:26 +0000 (15:48 -0700)
This structure will be used to communicate the per-object mtimes when
writing a cruft pack. Here, we need the full packing_data structure
because the mtime information is stored in an array there, not on the
individual object_entry's themselves (to avoid paying the overhead in
structure width for operations which do not generate a cruft pack).

We haven't passed this information down before because one of the two
callers (in bulk-checkin.c) does not have a packing_data structure at
all. In that case (where no cruft pack will be generated), NULL is
passed instead.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c
bulk-checkin.c
pack-write.c
pack.h

index 014dcd4bc98459315b6fbac672df828e06299be0..6ac927047cf4563cff2ec575305cb01cad7084f5 100644 (file)
@@ -1262,7 +1262,8 @@ static void write_pack_file(void)
 
                        stage_tmp_packfiles(&tmpname, pack_tmp_name,
                                            written_list, nr_written,
-                                           &pack_idx_opts, hash, &idx_tmp_name);
+                                           &to_pack, &pack_idx_opts, hash,
+                                           &idx_tmp_name);
 
                        if (write_bitmap_index) {
                                size_t tmpname_len = tmpname.len;
index 6d6c37171c9578b45cc41587f9cdfecb75ebc826..e988a388b6508cc9b3078f9b27fa5c06c96edae1 100644 (file)
@@ -33,7 +33,7 @@ static void finish_tmp_packfile(struct strbuf *basename,
        char *idx_tmp_name = NULL;
 
        stage_tmp_packfiles(basename, pack_tmp_name, written_list, nr_written,
-                           pack_idx_opts, hash, &idx_tmp_name);
+                           NULL, pack_idx_opts, hash, &idx_tmp_name);
        rename_tmp_packfile_idx(basename, &idx_tmp_name);
 
        free(idx_tmp_name);
index 51812cb1299222cbcbc976ef2b8304f7e25bfbff..a2adc565f450335850b3e636278560a8302ec392 100644 (file)
@@ -484,6 +484,7 @@ void stage_tmp_packfiles(struct strbuf *name_buffer,
                         const char *pack_tmp_name,
                         struct pack_idx_entry **written_list,
                         uint32_t nr_written,
+                        struct packing_data *to_pack,
                         struct pack_idx_option *pack_idx_opts,
                         unsigned char hash[],
                         char **idx_tmp_name)
diff --git a/pack.h b/pack.h
index b22bfc4a18e8543be54d6328c4e3cae6270c0aa7..fd27cfdfd7ee83ee379f65f5f19863c97abab623 100644 (file)
--- a/pack.h
+++ b/pack.h
@@ -109,11 +109,14 @@ int encode_in_pack_object_header(unsigned char *hdr, int hdr_len,
 #define PH_ERROR_PROTOCOL      (-3)
 int read_pack_header(int fd, struct pack_header *);
 
+struct packing_data;
+
 struct hashfile *create_tmp_packfile(char **pack_tmp_name);
 void stage_tmp_packfiles(struct strbuf *name_buffer,
                         const char *pack_tmp_name,
                         struct pack_idx_entry **written_list,
                         uint32_t nr_written,
+                        struct packing_data *to_pack,
                         struct pack_idx_option *pack_idx_opts,
                         unsigned char hash[],
                         char **idx_tmp_name);