@@ -390,7 +390,7 @@ static void add_same_unmerged(struct cache_entry *ce,
390
390
static int unpack_index_entry (struct cache_entry * ce ,
391
391
struct unpack_trees_options * o )
392
392
{
393
- struct cache_entry * src [5 ] = { NULL };
393
+ struct cache_entry * src [MAX_UNPACK_TREES + 1 ] = { NULL , };
394
394
int ret ;
395
395
396
396
src [0 ] = ce ;
@@ -436,7 +436,10 @@ static int switch_cache_bottom(struct traverse_info *info)
436
436
return ret ;
437
437
}
438
438
439
- static int traverse_trees_recursive (int n , unsigned long dirmask , unsigned long df_conflicts , struct name_entry * names , struct traverse_info * info )
439
+ static int traverse_trees_recursive (int n , unsigned long dirmask ,
440
+ unsigned long df_conflicts ,
441
+ struct name_entry * names ,
442
+ struct traverse_info * info )
440
443
{
441
444
int i , ret , bottom ;
442
445
struct tree_desc t [MAX_UNPACK_TREES ];
@@ -908,7 +911,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
908
911
909
912
if (!o -> skip_sparse_checkout ) {
910
913
int empty_worktree = 1 ;
911
- for (i = 0 ;i < o -> result .cache_nr ;i ++ ) {
914
+ for (i = 0 ; i < o -> result .cache_nr ; i ++ ) {
912
915
struct cache_entry * ce = o -> result .cache [i ];
913
916
914
917
if (apply_sparse_checkout (ce , o )) {
@@ -920,6 +923,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
920
923
921
924
}
922
925
if (o -> result .cache_nr && empty_worktree ) {
926
+ /* dubious---why should this fail??? */
923
927
ret = unpack_failed (o , "Sparse checkout leaves no entry on working directory" );
924
928
goto done ;
925
929
}
@@ -931,7 +935,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
931
935
* o -> dst_index = o -> result ;
932
936
933
937
done :
934
- for (i = 0 ;i < el .nr ;i ++ )
938
+ for (i = 0 ; i < el .nr ; i ++ )
935
939
free (el .excludes [i ]);
936
940
if (el .excludes )
937
941
free (el .excludes );
0 commit comments