@@ -58,6 +58,7 @@ static int shared_callback(const struct option *opt, const char *arg, int unset)
58
58
static const char * const init_db_usage [] = {
59
59
N_ ("git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
60
60
" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
61
+ " [--ref-format=<format>]\n"
61
62
" [-b <branch-name> | --initial-branch=<branch-name>]\n"
62
63
" [--shared[=<permissions>]] [<directory>]" ),
63
64
NULL
@@ -77,8 +78,10 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
77
78
const char * template_dir = NULL ;
78
79
unsigned int flags = 0 ;
79
80
const char * object_format = NULL ;
81
+ const char * ref_format = NULL ;
80
82
const char * initial_branch = NULL ;
81
83
int hash_algo = GIT_HASH_UNKNOWN ;
84
+ unsigned int ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN ;
82
85
int init_shared_repository = -1 ;
83
86
const struct option init_db_options [] = {
84
87
OPT_STRING (0 , "template" , & template_dir , N_ ("template-directory" ),
@@ -96,6 +99,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
96
99
N_ ("override the name of the initial branch" )),
97
100
OPT_STRING (0 , "object-format" , & object_format , N_ ("hash" ),
98
101
N_ ("specify the hash algorithm to use" )),
102
+ OPT_STRING (0 , "ref-format" , & ref_format , N_ ("format" ),
103
+ N_ ("specify the reference format to use" )),
99
104
OPT_END ()
100
105
};
101
106
@@ -159,6 +164,12 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
159
164
die (_ ("unknown hash algorithm '%s'" ), object_format );
160
165
}
161
166
167
+ if (ref_format ) {
168
+ ref_storage_format = ref_storage_format_by_name (ref_format );
169
+ if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN )
170
+ die (_ ("unknown ref storage format '%s'" ), ref_format );
171
+ }
172
+
162
173
if (init_shared_repository != -1 )
163
174
set_shared_repository (init_shared_repository );
164
175
@@ -237,6 +248,6 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
237
248
238
249
flags |= INIT_DB_EXIST_OK ;
239
250
return init_db (git_dir , real_git_dir , template_dir , hash_algo ,
240
- REF_STORAGE_FORMAT_UNKNOWN , initial_branch ,
251
+ ref_storage_format , initial_branch ,
241
252
init_shared_repository , flags );
242
253
}
0 commit comments