Skip to content

Commit 3f4f4cc

Browse files
committed
clone: do not export and unexport GIT_CONFIG
Earlier, dc87183 (use GIT_CONFIG only in "git config", not other programs, 2008-06-30) made sure that the environment variable is never used outside "git config", but "git clone", after creating a directory for the new repository and until the init_db() function populates its .git/ directory, exported the variable for no good reason. No hook will run from init_db() and more importantly no hook can run until init_db() finishes creation of the new repository, so it cannot be used by any invocation of "git config" by definition. Stop doing the useless export/unexport. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 785ee49 commit 3f4f4cc

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

builtin/clone.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
714714
atexit(remove_junk);
715715
sigchain_push_common(remove_junk_on_signal);
716716

717-
setenv(CONFIG_ENVIRONMENT, mkpath("%s/config", git_dir), 1);
718-
719717
if (safe_create_leading_directories_const(git_dir) < 0)
720718
die(_("could not create leading directories of '%s'"), git_dir);
721719

@@ -732,13 +730,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
732730
init_db(option_template, INIT_DB_QUIET);
733731
write_config(&option_config);
734732

735-
/*
736-
* At this point, the config exists, so we do not need the
737-
* environment variable. We actually need to unset it, too, to
738-
* re-enable parsing of the global configs.
739-
*/
740-
unsetenv(CONFIG_ENVIRONMENT);
741-
742733
git_config(git_default_config, NULL);
743734

744735
if (option_bare) {

0 commit comments

Comments
 (0)