@@ -3374,7 +3374,9 @@ static struct patch *previous_patch(struct apply_state *state,
3374
3374
return previous ;
3375
3375
}
3376
3376
3377
- static int verify_index_match (const struct cache_entry * ce , struct stat * st )
3377
+ static int verify_index_match (struct apply_state * state ,
3378
+ const struct cache_entry * ce ,
3379
+ struct stat * st )
3378
3380
{
3379
3381
if (S_ISGITLINK (ce -> ce_mode )) {
3380
3382
if (!S_ISDIR (st -> st_mode ))
@@ -3524,7 +3526,7 @@ static int load_current(struct apply_state *state,
3524
3526
if (checkout_target (& the_index , ce , & st ))
3525
3527
return -1 ;
3526
3528
}
3527
- if (verify_index_match (ce , & st ))
3529
+ if (verify_index_match (state , ce , & st ))
3528
3530
return error (_ ("%s: does not match index" ), name );
3529
3531
3530
3532
status = load_patch_target (state , & buf , ce , & st , patch , name , mode );
@@ -3694,7 +3696,7 @@ static int check_preimage(struct apply_state *state,
3694
3696
if (checkout_target (& the_index , * ce , st ))
3695
3697
return -1 ;
3696
3698
}
3697
- if (!state -> cached && verify_index_match (* ce , st ))
3699
+ if (!state -> cached && verify_index_match (state , * ce , st ))
3698
3700
return error (_ ("%s: does not match index" ), old_name );
3699
3701
if (state -> cached )
3700
3702
st_mode = (* ce )-> ce_mode ;
@@ -4313,7 +4315,9 @@ static int add_index_file(struct apply_state *state,
4313
4315
* 0 if everything went well
4314
4316
* 1 if a recoverable error happened
4315
4317
*/
4316
- static int try_create_file (const char * path , unsigned int mode , const char * buf , unsigned long size )
4318
+ static int try_create_file (struct apply_state * state , const char * path ,
4319
+ unsigned int mode , const char * buf ,
4320
+ unsigned long size )
4317
4321
{
4318
4322
int fd , res ;
4319
4323
struct strbuf nbuf = STRBUF_INIT ;
@@ -4371,7 +4375,7 @@ static int create_one_file(struct apply_state *state,
4371
4375
if (state -> cached )
4372
4376
return 0 ;
4373
4377
4374
- res = try_create_file (path , mode , buf , size );
4378
+ res = try_create_file (state , path , mode , buf , size );
4375
4379
if (res < 0 )
4376
4380
return -1 ;
4377
4381
if (!res )
@@ -4380,7 +4384,7 @@ static int create_one_file(struct apply_state *state,
4380
4384
if (errno == ENOENT ) {
4381
4385
if (safe_create_leading_directories (path ))
4382
4386
return 0 ;
4383
- res = try_create_file (path , mode , buf , size );
4387
+ res = try_create_file (state , path , mode , buf , size );
4384
4388
if (res < 0 )
4385
4389
return -1 ;
4386
4390
if (!res )
@@ -4402,7 +4406,7 @@ static int create_one_file(struct apply_state *state,
4402
4406
for (;;) {
4403
4407
char newpath [PATH_MAX ];
4404
4408
mksnpath (newpath , sizeof (newpath ), "%s~%u" , path , nr );
4405
- res = try_create_file (newpath , mode , buf , size );
4409
+ res = try_create_file (state , newpath , mode , buf , size );
4406
4410
if (res < 0 )
4407
4411
return -1 ;
4408
4412
if (!res ) {
0 commit comments