@@ -1056,7 +1056,7 @@ static int module_deinit(int argc, const char **argv, const char *prefix)
1056
1056
}
1057
1057
1058
1058
static int clone_submodule (const char * path , const char * gitdir , const char * url ,
1059
- const char * depth , struct string_list * reference ,
1059
+ const char * depth , struct string_list * reference , int dissociate ,
1060
1060
int quiet , int progress )
1061
1061
{
1062
1062
struct child_process cp = CHILD_PROCESS_INIT ;
@@ -1075,6 +1075,8 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url
1075
1075
argv_array_pushl (& cp .args , "--reference" ,
1076
1076
item -> string , NULL );
1077
1077
}
1078
+ if (dissociate )
1079
+ argv_array_push (& cp .args , "--dissociate" );
1078
1080
if (gitdir && * gitdir )
1079
1081
argv_array_pushl (& cp .args , "--separate-git-dir" , gitdir , NULL );
1080
1082
@@ -1190,6 +1192,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
1190
1192
char * p , * path = NULL , * sm_gitdir ;
1191
1193
struct strbuf sb = STRBUF_INIT ;
1192
1194
struct string_list reference = STRING_LIST_INIT_NODUP ;
1195
+ int dissociate = 0 ;
1193
1196
char * sm_alternate = NULL , * error_strategy = NULL ;
1194
1197
1195
1198
struct option module_clone_options [] = {
@@ -1208,6 +1211,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
1208
1211
OPT_STRING_LIST (0 , "reference" , & reference ,
1209
1212
N_ ("repo" ),
1210
1213
N_ ("reference repository" )),
1214
+ OPT_BOOL (0 , "dissociate" , & dissociate ,
1215
+ N_ ("use --reference only while cloning" )),
1211
1216
OPT_STRING (0 , "depth" , & depth ,
1212
1217
N_ ("string" ),
1213
1218
N_ ("depth for shallow clones" )),
@@ -1247,7 +1252,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
1247
1252
1248
1253
prepare_possible_alternates (name , & reference );
1249
1254
1250
- if (clone_submodule (path , sm_gitdir , url , depth , & reference ,
1255
+ if (clone_submodule (path , sm_gitdir , url , depth , & reference , dissociate ,
1251
1256
quiet , progress ))
1252
1257
die (_ ("clone of '%s' into submodule path '%s' failed" ),
1253
1258
url , path );
@@ -1300,6 +1305,7 @@ struct submodule_update_clone {
1300
1305
int quiet ;
1301
1306
int recommend_shallow ;
1302
1307
struct string_list references ;
1308
+ int dissociate ;
1303
1309
const char * depth ;
1304
1310
const char * recursive_prefix ;
1305
1311
const char * prefix ;
@@ -1315,7 +1321,7 @@ struct submodule_update_clone {
1315
1321
int failed_clones_nr , failed_clones_alloc ;
1316
1322
};
1317
1323
#define SUBMODULE_UPDATE_CLONE_INIT {0, MODULE_LIST_INIT, 0, \
1318
- SUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, \
1324
+ SUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, 0, \
1319
1325
NULL, NULL, NULL, \
1320
1326
STRING_LIST_INIT_DUP, 0, NULL, 0, 0}
1321
1327
@@ -1442,6 +1448,8 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
1442
1448
for_each_string_list_item (item , & suc -> references )
1443
1449
argv_array_pushl (& child -> args , "--reference" , item -> string , NULL );
1444
1450
}
1451
+ if (suc -> dissociate )
1452
+ argv_array_push (& child -> args , "--dissociate" );
1445
1453
if (suc -> depth )
1446
1454
argv_array_push (& child -> args , suc -> depth );
1447
1455
@@ -1575,6 +1583,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)
1575
1583
N_ ("rebase, merge, checkout or none" )),
1576
1584
OPT_STRING_LIST (0 , "reference" , & suc .references , N_ ("repo" ),
1577
1585
N_ ("reference repository" )),
1586
+ OPT_BOOL (0 , "dissociate" , & suc .dissociate ,
1587
+ N_ ("use --reference only while cloning" )),
1578
1588
OPT_STRING (0 , "depth" , & suc .depth , "<depth>" ,
1579
1589
N_ ("Create a shallow clone truncated to the "
1580
1590
"specified number of revisions" )),
0 commit comments