@@ -161,7 +161,7 @@ static unsigned long do_compress(void **pptr, unsigned long size)
161161 return stream .total_out ;
162162}
163163
164- static unsigned long write_large_blob_data (struct git_istream * st , struct sha1file * f ,
164+ static unsigned long write_large_blob_data (struct git_istream * st , struct hashfile * f ,
165165 const struct object_id * oid )
166166{
167167 git_zstream stream ;
@@ -185,7 +185,7 @@ static unsigned long write_large_blob_data(struct git_istream *st, struct sha1fi
185185 stream .next_out = obuf ;
186186 stream .avail_out = sizeof (obuf );
187187 zret = git_deflate (& stream , readlen ? 0 : Z_FINISH );
188- sha1write (f , obuf , stream .next_out - obuf );
188+ hashwrite (f , obuf , stream .next_out - obuf );
189189 olen += stream .next_out - obuf ;
190190 }
191191 if (stream .avail_in )
@@ -230,7 +230,7 @@ static int check_pack_inflate(struct packed_git *p,
230230 stream .total_in == len ) ? 0 : -1 ;
231231}
232232
233- static void copy_pack_data (struct sha1file * f ,
233+ static void copy_pack_data (struct hashfile * f ,
234234 struct packed_git * p ,
235235 struct pack_window * * w_curs ,
236236 off_t offset ,
@@ -243,14 +243,14 @@ static void copy_pack_data(struct sha1file *f,
243243 in = use_pack (p , w_curs , offset , & avail );
244244 if (avail > len )
245245 avail = (unsigned long )len ;
246- sha1write (f , in , avail );
246+ hashwrite (f , in , avail );
247247 offset += avail ;
248248 len -= avail ;
249249 }
250250}
251251
252252/* Return 0 if we will bust the pack-size limit */
253- static unsigned long write_no_reuse_object (struct sha1file * f , struct object_entry * entry ,
253+ static unsigned long write_no_reuse_object (struct hashfile * f , struct object_entry * entry ,
254254 unsigned long limit , int usable_delta )
255255{
256256 unsigned long size , datalen ;
@@ -323,8 +323,8 @@ static unsigned long write_no_reuse_object(struct sha1file *f, struct object_ent
323323 free (buf );
324324 return 0 ;
325325 }
326- sha1write (f , header , hdrlen );
327- sha1write (f , dheader + pos , sizeof (dheader ) - pos );
326+ hashwrite (f , header , hdrlen );
327+ hashwrite (f , dheader + pos , sizeof (dheader ) - pos );
328328 hdrlen += sizeof (dheader ) - pos ;
329329 } else if (type == OBJ_REF_DELTA ) {
330330 /*
@@ -337,8 +337,8 @@ static unsigned long write_no_reuse_object(struct sha1file *f, struct object_ent
337337 free (buf );
338338 return 0 ;
339339 }
340- sha1write (f , header , hdrlen );
341- sha1write (f , entry -> delta -> idx .oid .hash , 20 );
340+ hashwrite (f , header , hdrlen );
341+ hashwrite (f , entry -> delta -> idx .oid .hash , 20 );
342342 hdrlen += 20 ;
343343 } else {
344344 if (limit && hdrlen + datalen + 20 >= limit ) {
@@ -347,21 +347,21 @@ static unsigned long write_no_reuse_object(struct sha1file *f, struct object_ent
347347 free (buf );
348348 return 0 ;
349349 }
350- sha1write (f , header , hdrlen );
350+ hashwrite (f , header , hdrlen );
351351 }
352352 if (st ) {
353353 datalen = write_large_blob_data (st , f , & entry -> idx .oid );
354354 close_istream (st );
355355 } else {
356- sha1write (f , buf , datalen );
356+ hashwrite (f , buf , datalen );
357357 free (buf );
358358 }
359359
360360 return hdrlen + datalen ;
361361}
362362
363363/* Return 0 if we will bust the pack-size limit */
364- static off_t write_reuse_object (struct sha1file * f , struct object_entry * entry ,
364+ static off_t write_reuse_object (struct hashfile * f , struct object_entry * entry ,
365365 unsigned long limit , int usable_delta )
366366{
367367 struct packed_git * p = entry -> in_pack ;
@@ -412,25 +412,25 @@ static off_t write_reuse_object(struct sha1file *f, struct object_entry *entry,
412412 unuse_pack (& w_curs );
413413 return 0 ;
414414 }
415- sha1write (f , header , hdrlen );
416- sha1write (f , dheader + pos , sizeof (dheader ) - pos );
415+ hashwrite (f , header , hdrlen );
416+ hashwrite (f , dheader + pos , sizeof (dheader ) - pos );
417417 hdrlen += sizeof (dheader ) - pos ;
418418 reused_delta ++ ;
419419 } else if (type == OBJ_REF_DELTA ) {
420420 if (limit && hdrlen + 20 + datalen + 20 >= limit ) {
421421 unuse_pack (& w_curs );
422422 return 0 ;
423423 }
424- sha1write (f , header , hdrlen );
425- sha1write (f , entry -> delta -> idx .oid .hash , 20 );
424+ hashwrite (f , header , hdrlen );
425+ hashwrite (f , entry -> delta -> idx .oid .hash , 20 );
426426 hdrlen += 20 ;
427427 reused_delta ++ ;
428428 } else {
429429 if (limit && hdrlen + datalen + 20 >= limit ) {
430430 unuse_pack (& w_curs );
431431 return 0 ;
432432 }
433- sha1write (f , header , hdrlen );
433+ hashwrite (f , header , hdrlen );
434434 }
435435 copy_pack_data (f , p , & w_curs , offset , datalen );
436436 unuse_pack (& w_curs );
@@ -439,7 +439,7 @@ static off_t write_reuse_object(struct sha1file *f, struct object_entry *entry,
439439}
440440
441441/* Return 0 if we will bust the pack-size limit */
442- static off_t write_object (struct sha1file * f ,
442+ static off_t write_object (struct hashfile * f ,
443443 struct object_entry * entry ,
444444 off_t write_offset )
445445{
@@ -512,7 +512,7 @@ enum write_one_status {
512512 WRITE_ONE_RECURSIVE = 2 /* already scheduled to be written */
513513};
514514
515- static enum write_one_status write_one (struct sha1file * f ,
515+ static enum write_one_status write_one (struct hashfile * f ,
516516 struct object_entry * e ,
517517 off_t * offset )
518518{
@@ -731,7 +731,7 @@ static struct object_entry **compute_write_order(void)
731731 return wo ;
732732}
733733
734- static off_t write_reused_pack (struct sha1file * f )
734+ static off_t write_reused_pack (struct hashfile * f )
735735{
736736 unsigned char buffer [8192 ];
737737 off_t to_write , total ;
@@ -762,7 +762,7 @@ static off_t write_reused_pack(struct sha1file *f)
762762 if (read_pack > to_write )
763763 read_pack = to_write ;
764764
765- sha1write (f , buffer , read_pack );
765+ hashwrite (f , buffer , read_pack );
766766 to_write -= read_pack ;
767767
768768 /*
@@ -791,7 +791,7 @@ static const char no_split_warning[] = N_(
791791static void write_pack_file (void )
792792{
793793 uint32_t i = 0 , j ;
794- struct sha1file * f ;
794+ struct hashfile * f ;
795795 off_t offset ;
796796 uint32_t nr_remaining = nr_result ;
797797 time_t last_mtime = 0 ;
@@ -807,7 +807,7 @@ static void write_pack_file(void)
807807 char * pack_tmp_name = NULL ;
808808
809809 if (pack_to_stdout )
810- f = sha1fd_throughput (1 , "<stdout>" , progress_state );
810+ f = hashfd_throughput (1 , "<stdout>" , progress_state );
811811 else
812812 f = create_tmp_packfile (& pack_tmp_name );
813813
@@ -834,11 +834,11 @@ static void write_pack_file(void)
834834 * If so, rewrite it like in fast-import
835835 */
836836 if (pack_to_stdout ) {
837- sha1close (f , oid .hash , CSUM_CLOSE );
837+ hashclose (f , oid .hash , CSUM_CLOSE );
838838 } else if (nr_written == nr_remaining ) {
839- sha1close (f , oid .hash , CSUM_FSYNC );
839+ hashclose (f , oid .hash , CSUM_FSYNC );
840840 } else {
841- int fd = sha1close (f , oid .hash , 0 );
841+ int fd = hashclose (f , oid .hash , 0 );
842842 fixup_pack_header_footer (fd , oid .hash , pack_tmp_name ,
843843 nr_written , oid .hash , offset );
844844 close (fd );
0 commit comments