@@ -3403,21 +3403,21 @@ int write_sha1_file(const void *buf, unsigned long len, const char *type, unsign
34033403}
34043404
34053405int hash_sha1_file_literally (const void * buf , unsigned long len , const char * type ,
3406- unsigned char * sha1 , unsigned flags )
3406+ struct object_id * oid , unsigned flags )
34073407{
34083408 char * header ;
34093409 int hdrlen , status = 0 ;
34103410
34113411 /* type string, SP, %lu of the length plus NUL must fit this */
34123412 hdrlen = strlen (type ) + 32 ;
34133413 header = xmalloc (hdrlen );
3414- write_sha1_file_prepare (buf , len , type , sha1 , header , & hdrlen );
3414+ write_sha1_file_prepare (buf , len , type , oid -> hash , header , & hdrlen );
34153415
34163416 if (!(flags & HASH_WRITE_OBJECT ))
34173417 goto cleanup ;
3418- if (freshen_packed_object (sha1 ) || freshen_loose_object (sha1 ))
3418+ if (freshen_packed_object (oid -> hash ) || freshen_loose_object (oid -> hash ))
34193419 goto cleanup ;
3420- status = write_loose_object (sha1 , header , hdrlen , buf , len , 0 );
3420+ status = write_loose_object (oid -> hash , header , hdrlen , buf , len , 0 );
34213421
34223422cleanup :
34233423 free (header );
@@ -3621,14 +3621,14 @@ static int index_core(unsigned char *sha1, int fd, size_t size,
36213621 * binary blobs, they generally do not want to get any conversion, and
36223622 * callers should avoid this code path when filters are requested.
36233623 */
3624- static int index_stream (unsigned char * sha1 , int fd , size_t size ,
3624+ static int index_stream (struct object_id * oid , int fd , size_t size ,
36253625 enum object_type type , const char * path ,
36263626 unsigned flags )
36273627{
3628- return index_bulk_checkin (sha1 , fd , size , type , path , flags );
3628+ return index_bulk_checkin (oid -> hash , fd , size , type , path , flags );
36293629}
36303630
3631- int index_fd (unsigned char * sha1 , int fd , struct stat * st ,
3631+ int index_fd (struct object_id * oid , int fd , struct stat * st ,
36323632 enum object_type type , const char * path , unsigned flags )
36333633{
36343634 int ret ;
@@ -3638,21 +3638,21 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st,
36383638 * die() for large files.
36393639 */
36403640 if (type == OBJ_BLOB && path && would_convert_to_git_filter_fd (path ))
3641- ret = index_stream_convert_blob (sha1 , fd , path , flags );
3641+ ret = index_stream_convert_blob (oid -> hash , fd , path , flags );
36423642 else if (!S_ISREG (st -> st_mode ))
3643- ret = index_pipe (sha1 , fd , type , path , flags );
3643+ ret = index_pipe (oid -> hash , fd , type , path , flags );
36443644 else if (st -> st_size <= big_file_threshold || type != OBJ_BLOB ||
36453645 (path && would_convert_to_git (& the_index , path )))
3646- ret = index_core (sha1 , fd , xsize_t (st -> st_size ), type , path ,
3646+ ret = index_core (oid -> hash , fd , xsize_t (st -> st_size ), type , path ,
36473647 flags );
36483648 else
3649- ret = index_stream (sha1 , fd , xsize_t (st -> st_size ), type , path ,
3649+ ret = index_stream (oid , fd , xsize_t (st -> st_size ), type , path ,
36503650 flags );
36513651 close (fd );
36523652 return ret ;
36533653}
36543654
3655- int index_path (unsigned char * sha1 , const char * path , struct stat * st , unsigned flags )
3655+ int index_path (struct object_id * oid , const char * path , struct stat * st , unsigned flags )
36563656{
36573657 int fd ;
36583658 struct strbuf sb = STRBUF_INIT ;
@@ -3662,22 +3662,22 @@ int index_path(unsigned char *sha1, const char *path, struct stat *st, unsigned
36623662 fd = open (path , O_RDONLY );
36633663 if (fd < 0 )
36643664 return error_errno ("open(\"%s\")" , path );
3665- if (index_fd (sha1 , fd , st , OBJ_BLOB , path , flags ) < 0 )
3665+ if (index_fd (oid , fd , st , OBJ_BLOB , path , flags ) < 0 )
36663666 return error ("%s: failed to insert into database" ,
36673667 path );
36683668 break ;
36693669 case S_IFLNK :
36703670 if (strbuf_readlink (& sb , path , st -> st_size ))
36713671 return error_errno ("readlink(\"%s\")" , path );
36723672 if (!(flags & HASH_WRITE_OBJECT ))
3673- hash_sha1_file (sb .buf , sb .len , blob_type , sha1 );
3674- else if (write_sha1_file (sb .buf , sb .len , blob_type , sha1 ))
3673+ hash_sha1_file (sb .buf , sb .len , blob_type , oid -> hash );
3674+ else if (write_sha1_file (sb .buf , sb .len , blob_type , oid -> hash ))
36753675 return error ("%s: failed to insert into database" ,
36763676 path );
36773677 strbuf_release (& sb );
36783678 break ;
36793679 case S_IFDIR :
3680- return resolve_gitlink_ref (path , "HEAD" , sha1 );
3680+ return resolve_gitlink_ref (path , "HEAD" , oid -> hash );
36813681 default :
36823682 return error ("%s: unsupported file type" , path );
36833683 }
0 commit comments