@@ -1968,7 +1968,6 @@ void create_reference_database(unsigned int ref_storage_format,
19681968static int create_default_files (const char * template_path ,
19691969 const char * original_git_dir ,
19701970 const struct repository_format * fmt ,
1971- int prev_bare_repository ,
19721971 int init_shared_repository )
19731972{
19741973 struct stat st1 ;
@@ -2003,34 +2002,8 @@ static int create_default_files(const char *template_path,
20032002 */
20042003 if (init_shared_repository != -1 )
20052004 set_shared_repository (init_shared_repository );
2006- /*
2007- * TODO: heed core.bare from config file in templates if no
2008- * command-line override given
2009- */
2010- is_bare_repository_cfg = prev_bare_repository || !work_tree ;
2011- /* TODO (continued):
2012- *
2013- * Unfortunately, the line above is equivalent to
2014- * is_bare_repository_cfg = !work_tree;
2015- * which ignores the config entirely even if no `--[no-]bare`
2016- * command line option was present.
2017- *
2018- * To see why, note that before this function, there was this call:
2019- * prev_bare_repository = is_bare_repository()
2020- * expanding the right hand side:
2021- * = is_bare_repository_cfg && !get_git_work_tree()
2022- * = is_bare_repository_cfg && !work_tree
2023- * note that the last simplification above is valid because nothing
2024- * calls repo_init() or set_git_work_tree() between any of the
2025- * relevant calls in the code, and thus the !get_git_work_tree()
2026- * calls will return the same result each time. So, what we are
2027- * interested in computing is the right hand side of the line of
2028- * code just above this comment:
2029- * prev_bare_repository || !work_tree
2030- * = is_bare_repository_cfg && !work_tree || !work_tree
2031- * = !work_tree
2032- * because "A && !B || !B == !B" for all boolean values of A & B.
2033- */
2005+
2006+ is_bare_repository_cfg = !work_tree ;
20342007
20352008 /*
20362009 * We would have created the above under user's umask -- under
@@ -2182,7 +2155,6 @@ int init_db(const char *git_dir, const char *real_git_dir,
21822155 int exist_ok = flags & INIT_DB_EXIST_OK ;
21832156 char * original_git_dir = real_pathdup (git_dir , 1 );
21842157 struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT ;
2185- int prev_bare_repository ;
21862158
21872159 if (real_git_dir ) {
21882160 struct stat st ;
@@ -2208,7 +2180,6 @@ int init_db(const char *git_dir, const char *real_git_dir,
22082180
22092181 safe_create_dir (git_dir , 0 );
22102182
2211- prev_bare_repository = is_bare_repository ();
22122183
22132184 /* Check to see if the repository version is right.
22142185 * Note that a newly created repository does not have
@@ -2221,8 +2192,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
22212192 validate_ref_storage_format (& repo_fmt , ref_storage_format );
22222193
22232194 reinit = create_default_files (template_dir , original_git_dir ,
2224- & repo_fmt , prev_bare_repository ,
2225- init_shared_repository );
2195+ & repo_fmt , init_shared_repository );
22262196
22272197 /*
22282198 * Now that we have set up both the hash algorithm and the ref storage
0 commit comments