@@ -1208,12 +1208,13 @@ static int module_summary(int argc, const char **argv, const char *prefix)
1208
1208
1209
1209
struct sync_cb {
1210
1210
const char * prefix ;
1211
+ const char * super_prefix ;
1211
1212
unsigned int flags ;
1212
1213
};
1213
1214
#define SYNC_CB_INIT { 0 }
1214
1215
1215
1216
static void sync_submodule (const char * path , const char * prefix ,
1216
- unsigned int flags )
1217
+ const char * super_prefix , unsigned int flags )
1217
1218
{
1218
1219
const struct submodule * sub ;
1219
1220
char * remote_key = NULL ;
@@ -1244,8 +1245,7 @@ static void sync_submodule(const char *path, const char *prefix,
1244
1245
super_config_url = xstrdup ("" );
1245
1246
}
1246
1247
1247
- displaypath = get_submodule_displaypath (path , prefix ,
1248
- get_super_prefix ());
1248
+ displaypath = get_submodule_displaypath (path , prefix , super_prefix );
1249
1249
1250
1250
if (!(flags & OPT_QUIET ))
1251
1251
printf (_ ("Synchronizing submodule url for '%s'\n" ),
@@ -1282,10 +1282,11 @@ static void sync_submodule(const char *path, const char *prefix,
1282
1282
cpr .dir = path ;
1283
1283
prepare_submodule_repo_env (& cpr .env );
1284
1284
1285
- strvec_push (& cpr .args , "--super-prefix" );
1286
- strvec_pushf (& cpr .args , "%s/" , displaypath );
1287
1285
strvec_pushl (& cpr .args , "submodule--helper" , "sync" ,
1288
1286
"--recursive" , NULL );
1287
+ strvec_push (& cpr .args , "--super-prefix" );
1288
+ strvec_pushf (& cpr .args , "%s/" , displaypath );
1289
+
1289
1290
1290
1291
if (flags & OPT_QUIET )
1291
1292
strvec_push (& cpr .args , "--quiet" );
@@ -1308,7 +1309,8 @@ static void sync_submodule_cb(const struct cache_entry *list_item, void *cb_data
1308
1309
{
1309
1310
struct sync_cb * info = cb_data ;
1310
1311
1311
- sync_submodule (list_item -> name , info -> prefix , info -> flags );
1312
+ sync_submodule (list_item -> name , info -> prefix , info -> super_prefix ,
1313
+ info -> flags );
1312
1314
}
1313
1315
1314
1316
static int module_sync (int argc , const char * * argv , const char * prefix )
@@ -1319,6 +1321,7 @@ static int module_sync(int argc, const char **argv, const char *prefix)
1319
1321
int quiet = 0 ;
1320
1322
int recursive = 0 ;
1321
1323
struct option module_sync_options [] = {
1324
+ OPT__SUPER_PREFIX (& info .super_prefix ),
1322
1325
OPT__QUIET (& quiet , N_ ("suppress output of synchronizing submodule url" )),
1323
1326
OPT_BOOL (0 , "recursive" , & recursive ,
1324
1327
N_ ("recurse into nested submodules" )),
@@ -2887,7 +2890,7 @@ static int module_set_url(int argc, const char **argv, const char *prefix)
2887
2890
config_name = xstrfmt ("submodule.%s.url" , path );
2888
2891
2889
2892
config_set_in_gitmodules_file_gently (config_name , newurl );
2890
- sync_submodule (path , prefix , quiet ? OPT_QUIET : 0 );
2893
+ sync_submodule (path , prefix , NULL , quiet ? OPT_QUIET : 0 );
2891
2894
2892
2895
free (config_name );
2893
2896
@@ -3392,8 +3395,7 @@ int cmd_submodule__helper(int argc, const char **argv, const char *prefix)
3392
3395
subcmd = argv [0 ];
3393
3396
3394
3397
if (strcmp (subcmd , "clone" ) && strcmp (subcmd , "update" ) &&
3395
- strcmp (subcmd , "status" ) && strcmp (subcmd , "sync" ) &&
3396
- get_super_prefix ())
3398
+ strcmp (subcmd , "status" ) && get_super_prefix ())
3397
3399
/*
3398
3400
* xstrfmt() rather than "%s %s" to keep the translated
3399
3401
* string identical to git.c's.
0 commit comments