@@ -494,7 +494,7 @@ static int verify_clean_subdirectory(struct cache_entry *ce, const char *action,
494
494
* anything in the existing directory there.
495
495
*/
496
496
int namelen ;
497
- int pos , i ;
497
+ int i ;
498
498
struct dir_struct d ;
499
499
char * pathbuf ;
500
500
int cnt = 0 ;
@@ -515,24 +515,20 @@ static int verify_clean_subdirectory(struct cache_entry *ce, const char *action,
515
515
* in that directory.
516
516
*/
517
517
namelen = strlen (ce -> name );
518
- pos = index_name_pos (o -> src_index , ce -> name , namelen );
519
- if (0 <= pos )
520
- return cnt ; /* we have it as nondirectory */
521
- pos = - pos - 1 ;
522
- for (i = pos ; i < o -> src_index -> cache_nr ; i ++ ) {
523
- struct cache_entry * ce = o -> src_index -> cache [i ];
524
- int len = ce_namelen (ce );
518
+ for (i = o -> pos ; i < o -> src_index -> cache_nr ; i ++ ) {
519
+ struct cache_entry * ce2 = o -> src_index -> cache [i ];
520
+ int len = ce_namelen (ce2 );
525
521
if (len < namelen ||
526
- strncmp (ce -> name , ce -> name , namelen ) ||
527
- ce -> name [namelen ] != '/' )
522
+ strncmp (ce -> name , ce2 -> name , namelen ) ||
523
+ ce2 -> name [namelen ] != '/' )
528
524
break ;
529
525
/*
530
- * ce ->name is an entry in the subdirectory.
526
+ * ce2 ->name is an entry in the subdirectory.
531
527
*/
532
- if (!ce_stage (ce )) {
533
- if (verify_uptodate (ce , o ))
528
+ if (!ce_stage (ce2 )) {
529
+ if (verify_uptodate (ce2 , o ))
534
530
return -1 ;
535
- add_entry (o , ce , CE_REMOVE , 0 );
531
+ add_entry (o , ce2 , CE_REMOVE , 0 );
536
532
}
537
533
cnt ++ ;
538
534
}
@@ -588,7 +584,7 @@ static int verify_absent(struct cache_entry *ce, const char *action,
588
584
return 0 ;
589
585
590
586
if (!lstat (ce -> name , & st )) {
591
- int cnt ;
587
+ int ret ;
592
588
int dtype = ce_to_dtype (ce );
593
589
struct cache_entry * result ;
594
590
@@ -616,13 +612,15 @@ static int verify_absent(struct cache_entry *ce, const char *action,
616
612
* files that are in "foo/" we would lose
617
613
* it.
618
614
*/
619
- cnt = verify_clean_subdirectory (ce , action , o );
615
+ ret = verify_clean_subdirectory (ce , action , o );
616
+ if (ret < 0 )
617
+ return ret ;
620
618
621
619
/*
622
620
* If this removed entries from the index,
623
621
* what that means is:
624
622
*
625
- * (1) the caller unpack_trees_rec () saw path/foo
623
+ * (1) the caller unpack_callback () saw path/foo
626
624
* in the index, and it has not removed it because
627
625
* it thinks it is handling 'path' as blob with
628
626
* D/F conflict;
@@ -635,7 +633,7 @@ static int verify_absent(struct cache_entry *ce, const char *action,
635
633
* We need to increment it by the number of
636
634
* deleted entries here.
637
635
*/
638
- o -> pos += cnt ;
636
+ o -> pos += ret ;
639
637
return 0 ;
640
638
}
641
639
0 commit comments