@@ -60,17 +60,17 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
6060 reprepare_packed_git ();
6161}
6262
63- static int already_written (struct bulk_checkin_state * state , unsigned char sha1 [] )
63+ static int already_written (struct bulk_checkin_state * state , struct object_id * oid )
6464{
6565 int i ;
6666
6767 /* The object may already exist in the repository */
68- if (has_sha1_file (sha1 ))
68+ if (has_sha1_file (oid -> hash ))
6969 return 1 ;
7070
7171 /* Might want to keep the list sorted */
7272 for (i = 0 ; i < state -> nr_written ; i ++ )
73- if (!hashcmp ( state -> written [i ]-> oid . hash , sha1 ))
73+ if (!oidcmp ( & state -> written [i ]-> oid , oid ))
7474 return 1 ;
7575
7676 /* This is a new object we need to keep */
@@ -186,7 +186,7 @@ static void prepare_to_stream(struct bulk_checkin_state *state,
186186}
187187
188188static int deflate_to_pack (struct bulk_checkin_state * state ,
189- unsigned char result_sha1 [] ,
189+ struct object_id * result_oid ,
190190 int fd , size_t size ,
191191 enum object_type type , const char * path ,
192192 unsigned flags )
@@ -236,17 +236,17 @@ static int deflate_to_pack(struct bulk_checkin_state *state,
236236 if (lseek (fd , seekback , SEEK_SET ) == (off_t ) - 1 )
237237 return error ("cannot seek back" );
238238 }
239- the_hash_algo -> final_fn (result_sha1 , & ctx );
239+ the_hash_algo -> final_fn (result_oid -> hash , & ctx );
240240 if (!idx )
241241 return 0 ;
242242
243243 idx -> crc32 = crc32_end (state -> f );
244- if (already_written (state , result_sha1 )) {
244+ if (already_written (state , result_oid )) {
245245 hashfile_truncate (state -> f , & checkpoint );
246246 state -> offset = checkpoint .offset ;
247247 free (idx );
248248 } else {
249- hashcpy ( idx -> oid . hash , result_sha1 );
249+ oidcpy ( & idx -> oid , result_oid );
250250 ALLOC_GROW (state -> written ,
251251 state -> nr_written + 1 ,
252252 state -> alloc_written );
@@ -255,11 +255,11 @@ static int deflate_to_pack(struct bulk_checkin_state *state,
255255 return 0 ;
256256}
257257
258- int index_bulk_checkin (unsigned char * sha1 ,
258+ int index_bulk_checkin (struct object_id * oid ,
259259 int fd , size_t size , enum object_type type ,
260260 const char * path , unsigned flags )
261261{
262- int status = deflate_to_pack (& state , sha1 , fd , size , type ,
262+ int status = deflate_to_pack (& state , oid , fd , size , type ,
263263 path , flags );
264264 if (!state .plugged )
265265 finish_bulk_checkin (& state );
0 commit comments