@@ -72,6 +72,7 @@ static char *remote_name = NULL;
72
72
static char * option_branch = NULL ;
73
73
static struct string_list option_not = STRING_LIST_INIT_NODUP ;
74
74
static const char * real_git_dir ;
75
+ static const char * ref_format ;
75
76
static char * option_upload_pack = "git-upload-pack" ;
76
77
static int option_verbosity ;
77
78
static int option_progress = -1 ;
@@ -157,6 +158,8 @@ static struct option builtin_clone_options[] = {
157
158
N_ ("any cloned submodules will be shallow" )),
158
159
OPT_STRING (0 , "separate-git-dir" , & real_git_dir , N_ ("gitdir" ),
159
160
N_ ("separate git dir from working tree" )),
161
+ OPT_STRING (0 , "ref-format" , & ref_format , N_ ("format" ),
162
+ N_ ("specify the reference format to use" )),
160
163
OPT_STRING_LIST ('c' , "config" , & option_config , N_ ("key=value" ),
161
164
N_ ("set config inside the new repository" )),
162
165
OPT_STRING_LIST (0 , "server-option" , & server_options ,
@@ -932,6 +935,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
932
935
int submodule_progress ;
933
936
int filter_submodules = 0 ;
934
937
int hash_algo ;
938
+ unsigned int ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN ;
935
939
const int do_not_override_repo_unix_permissions = -1 ;
936
940
937
941
struct transport_ls_refs_options transport_ls_refs_options =
@@ -957,6 +961,12 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
957
961
if (option_single_branch == -1 )
958
962
option_single_branch = deepen ? 1 : 0 ;
959
963
964
+ if (ref_format ) {
965
+ ref_storage_format = ref_storage_format_by_name (ref_format );
966
+ if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN )
967
+ die (_ ("unknown ref storage format '%s'" ), ref_format );
968
+ }
969
+
960
970
if (option_mirror )
961
971
option_bare = 1 ;
962
972
@@ -1108,7 +1118,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
1108
1118
* their on-disk data structures.
1109
1119
*/
1110
1120
init_db (git_dir , real_git_dir , option_template , GIT_HASH_UNKNOWN ,
1111
- REF_STORAGE_FORMAT_UNKNOWN , NULL ,
1121
+ ref_storage_format , NULL ,
1112
1122
do_not_override_repo_unix_permissions , INIT_DB_QUIET | INIT_DB_SKIP_REFDB );
1113
1123
1114
1124
if (real_git_dir ) {
0 commit comments