@@ -1532,6 +1532,7 @@ struct module_clone_data {
1532
1532
const char * url ;
1533
1533
const char * depth ;
1534
1534
struct list_objects_filter_options * filter_options ;
1535
+ enum ref_storage_format ref_storage_format ;
1535
1536
unsigned int quiet : 1 ;
1536
1537
unsigned int progress : 1 ;
1537
1538
unsigned int dissociate : 1 ;
@@ -1540,6 +1541,7 @@ struct module_clone_data {
1540
1541
};
1541
1542
#define MODULE_CLONE_DATA_INIT { \
1542
1543
.single_branch = -1, \
1544
+ .ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN, \
1543
1545
}
1544
1546
1545
1547
struct submodule_alternate_setup {
@@ -1738,6 +1740,9 @@ static int clone_submodule(const struct module_clone_data *clone_data,
1738
1740
strvec_pushl (& cp .args , "--reference" ,
1739
1741
item -> string , NULL );
1740
1742
}
1743
+ if (clone_data -> ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN )
1744
+ strvec_pushf (& cp .args , "--ref-format=%s" ,
1745
+ ref_storage_format_to_name (clone_data -> ref_storage_format ));
1741
1746
if (clone_data -> dissociate )
1742
1747
strvec_push (& cp .args , "--dissociate" );
1743
1748
if (sm_gitdir && * sm_gitdir )
@@ -1832,6 +1837,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
1832
1837
struct string_list reference = STRING_LIST_INIT_NODUP ;
1833
1838
struct list_objects_filter_options filter_options =
1834
1839
LIST_OBJECTS_FILTER_INIT ;
1840
+ const char * ref_storage_format = NULL ;
1835
1841
1836
1842
struct option module_clone_options [] = {
1837
1843
OPT_STRING (0 , "prefix" , & clone_data .prefix ,
@@ -1849,6 +1855,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
1849
1855
OPT_STRING_LIST (0 , "reference" , & reference ,
1850
1856
N_ ("repo" ),
1851
1857
N_ ("reference repository" )),
1858
+ OPT_STRING (0 , "ref-format" , & ref_storage_format , N_ ("format" ),
1859
+ N_ ("specify the reference format to use" )),
1852
1860
OPT_BOOL (0 , "dissociate" , & dissociate ,
1853
1861
N_ ("use --reference only while cloning" )),
1854
1862
OPT_STRING (0 , "depth" , & clone_data .depth ,
@@ -1875,6 +1883,11 @@ static int module_clone(int argc, const char **argv, const char *prefix)
1875
1883
argc = parse_options (argc , argv , prefix , module_clone_options ,
1876
1884
git_submodule_helper_usage , 0 );
1877
1885
1886
+ if (ref_storage_format ) {
1887
+ clone_data .ref_storage_format = ref_storage_format_by_name (ref_storage_format );
1888
+ if (clone_data .ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN )
1889
+ die (_ ("unknown ref storage format '%s'" ), ref_storage_format );
1890
+ }
1878
1891
clone_data .dissociate = !!dissociate ;
1879
1892
clone_data .quiet = !!quiet ;
1880
1893
clone_data .progress = !!progress ;
@@ -1974,6 +1987,7 @@ struct update_data {
1974
1987
struct submodule_update_strategy update_strategy ;
1975
1988
struct list_objects_filter_options * filter_options ;
1976
1989
struct module_list list ;
1990
+ enum ref_storage_format ref_storage_format ;
1977
1991
int depth ;
1978
1992
int max_jobs ;
1979
1993
int single_branch ;
@@ -1997,6 +2011,7 @@ struct update_data {
1997
2011
#define UPDATE_DATA_INIT { \
1998
2012
.update_strategy = SUBMODULE_UPDATE_STRATEGY_INIT, \
1999
2013
.list = MODULE_LIST_INIT, \
2014
+ .ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN, \
2000
2015
.recommend_shallow = -1, \
2001
2016
.references = STRING_LIST_INIT_DUP, \
2002
2017
.single_branch = -1, \
@@ -2132,6 +2147,9 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
2132
2147
expand_list_objects_filter_spec (suc -> update_data -> filter_options ));
2133
2148
if (suc -> update_data -> require_init )
2134
2149
strvec_push (& child -> args , "--require-init" );
2150
+ if (suc -> update_data -> ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN )
2151
+ strvec_pushf (& child -> args , "--ref-format=%s" ,
2152
+ ref_storage_format_to_name (suc -> update_data -> ref_storage_format ));
2135
2153
strvec_pushl (& child -> args , "--path" , sub -> path , NULL );
2136
2154
strvec_pushl (& child -> args , "--name" , sub -> name , NULL );
2137
2155
strvec_pushl (& child -> args , "--url" , url , NULL );
@@ -2562,6 +2580,9 @@ static void update_data_to_args(const struct update_data *update_data,
2562
2580
for_each_string_list_item (item , & update_data -> references )
2563
2581
strvec_pushl (args , "--reference" , item -> string , NULL );
2564
2582
}
2583
+ if (update_data -> ref_storage_format != REF_STORAGE_FORMAT_UNKNOWN )
2584
+ strvec_pushf (args , "--ref-format=%s" ,
2585
+ ref_storage_format_to_name (update_data -> ref_storage_format ));
2565
2586
if (update_data -> filter_options && update_data -> filter_options -> choice )
2566
2587
strvec_pushf (args , "--filter=%s" ,
2567
2588
expand_list_objects_filter_spec (
@@ -2737,6 +2758,7 @@ static int module_update(int argc, const char **argv, const char *prefix)
2737
2758
struct update_data opt = UPDATE_DATA_INIT ;
2738
2759
struct list_objects_filter_options filter_options =
2739
2760
LIST_OBJECTS_FILTER_INIT ;
2761
+ const char * ref_storage_format = NULL ;
2740
2762
int ret ;
2741
2763
struct option module_update_options [] = {
2742
2764
OPT__SUPER_PREFIX (& opt .super_prefix ),
@@ -2760,6 +2782,8 @@ static int module_update(int argc, const char **argv, const char *prefix)
2760
2782
SM_UPDATE_REBASE ),
2761
2783
OPT_STRING_LIST (0 , "reference" , & opt .references , N_ ("repo" ),
2762
2784
N_ ("reference repository" )),
2785
+ OPT_STRING (0 , "ref-format" , & ref_storage_format , N_ ("format" ),
2786
+ N_ ("specify the reference format to use" )),
2763
2787
OPT_BOOL (0 , "dissociate" , & opt .dissociate ,
2764
2788
N_ ("use --reference only while cloning" )),
2765
2789
OPT_INTEGER (0 , "depth" , & opt .depth ,
@@ -2803,6 +2827,12 @@ static int module_update(int argc, const char **argv, const char *prefix)
2803
2827
module_update_options );
2804
2828
}
2805
2829
2830
+ if (ref_storage_format ) {
2831
+ opt .ref_storage_format = ref_storage_format_by_name (ref_storage_format );
2832
+ if (opt .ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN )
2833
+ die (_ ("unknown ref storage format '%s'" ), ref_storage_format );
2834
+ }
2835
+
2806
2836
opt .filter_options = & filter_options ;
2807
2837
opt .prefix = prefix ;
2808
2838
0 commit comments