1
+ #define NO_THE_INDEX_COMPATIBILITY_MACROS
2
+
1
3
#include "cache.h"
2
4
#include "repository.h"
3
5
#include "config.h"
@@ -1179,7 +1181,7 @@ int submodule_touches_in_range(struct object_id *excl_oid,
1179
1181
struct submodule_parallel_fetch {
1180
1182
int count ;
1181
1183
struct argv_array args ;
1182
- const char * work_tree ;
1184
+ struct repository * r ;
1183
1185
const char * prefix ;
1184
1186
int command_line_option ;
1185
1187
int default_option ;
@@ -1200,7 +1202,7 @@ static int get_fetch_recurse_config(const struct submodule *submodule,
1200
1202
1201
1203
int fetch_recurse = submodule -> fetch_recurse ;
1202
1204
key = xstrfmt ("submodule.%s.fetchRecurseSubmodules" , submodule -> name );
1203
- if (!repo_config_get_string_const (the_repository , key , & value )) {
1205
+ if (!repo_config_get_string_const (spf -> r , key , & value )) {
1204
1206
fetch_recurse = parse_fetch_recurse_submodules_arg (key , value );
1205
1207
}
1206
1208
free (key );
@@ -1219,19 +1221,19 @@ static int get_next_submodule(struct child_process *cp,
1219
1221
int ret = 0 ;
1220
1222
struct submodule_parallel_fetch * spf = data ;
1221
1223
1222
- for (; spf -> count < active_nr ; spf -> count ++ ) {
1224
+ for (; spf -> count < spf -> r -> index -> cache_nr ; spf -> count ++ ) {
1223
1225
struct strbuf submodule_path = STRBUF_INIT ;
1224
1226
struct strbuf submodule_git_dir = STRBUF_INIT ;
1225
1227
struct strbuf submodule_prefix = STRBUF_INIT ;
1226
- const struct cache_entry * ce = active_cache [spf -> count ];
1228
+ const struct cache_entry * ce = spf -> r -> index -> cache [spf -> count ];
1227
1229
const char * git_dir , * default_argv ;
1228
1230
const struct submodule * submodule ;
1229
1231
struct submodule default_submodule = SUBMODULE_INIT ;
1230
1232
1231
1233
if (!S_ISGITLINK (ce -> ce_mode ))
1232
1234
continue ;
1233
1235
1234
- submodule = submodule_from_path ( & null_oid , ce -> name );
1236
+ submodule = submodule_from_cache ( spf -> r , & null_oid , ce -> name );
1235
1237
if (!submodule ) {
1236
1238
const char * name = default_name_or_path (ce -> name );
1237
1239
if (name ) {
@@ -1257,7 +1259,7 @@ static int get_next_submodule(struct child_process *cp,
1257
1259
continue ;
1258
1260
}
1259
1261
1260
- strbuf_addf (& submodule_path , "%s/%s" , spf -> work_tree , ce -> name );
1262
+ strbuf_repo_worktree_path (& submodule_path , spf -> r , "%s" , ce -> name );
1261
1263
strbuf_addf (& submodule_git_dir , "%s/.git" , submodule_path .buf );
1262
1264
strbuf_addf (& submodule_prefix , "%s%s/" , spf -> prefix , ce -> name );
1263
1265
git_dir = read_gitfile (submodule_git_dir .buf );
@@ -1310,24 +1312,25 @@ static int fetch_finish(int retvalue, struct strbuf *err,
1310
1312
return 0 ;
1311
1313
}
1312
1314
1313
- int fetch_populated_submodules (const struct argv_array * options ,
1315
+ int fetch_populated_submodules (struct repository * r ,
1316
+ const struct argv_array * options ,
1314
1317
const char * prefix , int command_line_option ,
1315
1318
int default_option ,
1316
1319
int quiet , int max_parallel_jobs )
1317
1320
{
1318
1321
int i ;
1319
1322
struct submodule_parallel_fetch spf = SPF_INIT ;
1320
1323
1321
- spf .work_tree = get_git_work_tree () ;
1324
+ spf .r = r ;
1322
1325
spf .command_line_option = command_line_option ;
1323
1326
spf .default_option = default_option ;
1324
1327
spf .quiet = quiet ;
1325
1328
spf .prefix = prefix ;
1326
1329
1327
- if (!spf . work_tree )
1330
+ if (!r -> worktree )
1328
1331
goto out ;
1329
1332
1330
- if (read_cache ( ) < 0 )
1333
+ if (repo_read_index ( r ) < 0 )
1331
1334
die ("index file corrupt" );
1332
1335
1333
1336
argv_array_push (& spf .args , "fetch" );
0 commit comments