1- #define USE_THE_REPOSITORY_VARIABLE
2-
31#include "git-compat-util.h"
42#include "environment.h"
53#include "gettext.h"
@@ -211,9 +209,10 @@ static void write_rev_index_positions(struct hashfile *f,
211209 hashwrite_be32 (f , pack_order [i ]);
212210}
213211
214- static void write_rev_trailer (struct hashfile * f , const unsigned char * hash )
212+ static void write_rev_trailer (const struct git_hash_algo * hash_algo ,
213+ struct hashfile * f , const unsigned char * hash )
215214{
216- hashwrite (f , hash , the_hash_algo -> rawsz );
215+ hashwrite (f , hash , hash_algo -> rawsz );
217216}
218217
219218char * write_rev_file (const struct git_hash_algo * hash_algo ,
@@ -286,7 +285,7 @@ char *write_rev_file_order(const struct git_hash_algo *hash_algo,
286285 write_rev_header (hash_algo , f );
287286
288287 write_rev_index_positions (f , pack_order , nr_objects );
289- write_rev_trailer (f , hash );
288+ write_rev_trailer (hash_algo , f , hash );
290289
291290 if (adjust_shared_perm (path ) < 0 )
292291 die (_ ("failed to make %s readable" ), path );
@@ -298,11 +297,12 @@ char *write_rev_file_order(const struct git_hash_algo *hash_algo,
298297 return path ;
299298}
300299
301- static void write_mtimes_header (struct hashfile * f )
300+ static void write_mtimes_header (const struct git_hash_algo * hash_algo ,
301+ struct hashfile * f )
302302{
303303 hashwrite_be32 (f , MTIMES_SIGNATURE );
304304 hashwrite_be32 (f , MTIMES_VERSION );
305- hashwrite_be32 (f , oid_version (the_hash_algo ));
305+ hashwrite_be32 (f , oid_version (hash_algo ));
306306}
307307
308308/*
@@ -322,12 +322,14 @@ static void write_mtimes_objects(struct hashfile *f,
322322 }
323323}
324324
325- static void write_mtimes_trailer (struct hashfile * f , const unsigned char * hash )
325+ static void write_mtimes_trailer (const struct git_hash_algo * hash_algo ,
326+ struct hashfile * f , const unsigned char * hash )
326327{
327- hashwrite (f , hash , the_hash_algo -> rawsz );
328+ hashwrite (f , hash , hash_algo -> rawsz );
328329}
329330
330- static char * write_mtimes_file (struct packing_data * to_pack ,
331+ static char * write_mtimes_file (const struct git_hash_algo * hash_algo ,
332+ struct packing_data * to_pack ,
331333 struct pack_idx_entry * * objects ,
332334 uint32_t nr_objects ,
333335 const unsigned char * hash )
@@ -344,9 +346,9 @@ static char *write_mtimes_file(struct packing_data *to_pack,
344346 mtimes_name = strbuf_detach (& tmp_file , NULL );
345347 f = hashfd (fd , mtimes_name );
346348
347- write_mtimes_header (f );
349+ write_mtimes_header (hash_algo , f );
348350 write_mtimes_objects (f , to_pack , objects , nr_objects );
349- write_mtimes_trailer (f , hash );
351+ write_mtimes_trailer (hash_algo , f , hash );
350352
351353 if (adjust_shared_perm (mtimes_name ) < 0 )
352354 die (_ ("failed to make %s readable" ), mtimes_name );
@@ -575,8 +577,8 @@ void stage_tmp_packfiles(const struct git_hash_algo *hash_algo,
575577 hash , pack_idx_opts -> flags );
576578
577579 if (pack_idx_opts -> flags & WRITE_MTIMES ) {
578- mtimes_tmp_name = write_mtimes_file (to_pack , written_list ,
579- nr_written ,
580+ mtimes_tmp_name = write_mtimes_file (hash_algo , to_pack ,
581+ written_list , nr_written ,
580582 hash );
581583 }
582584
0 commit comments