Merge branch 'jk/alias-in-bare'
An aliased command spawned from a bare repository that does not say it is bare with "core.bare = yes" is treated as non-bare by mistake. * jk/alias-in-bare: setup: suppress implicit "." work-tree for bare repos environment: add GIT_PREFIX to local_repo_env cache.h: drop LOCAL_REPO_ENV_SIZE
This commit is contained in:
12
setup.c
12
setup.c
@ -523,6 +523,12 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,
|
||||
set_git_work_tree(core_worktree);
|
||||
}
|
||||
}
|
||||
else if (!git_env_bool(GIT_IMPLICIT_WORK_TREE_ENVIRONMENT, 1)) {
|
||||
/* #16d */
|
||||
set_git_dir(gitdirenv);
|
||||
free(gitfile);
|
||||
return NULL;
|
||||
}
|
||||
else /* #2, #10 */
|
||||
set_git_work_tree(".");
|
||||
|
||||
@ -601,6 +607,8 @@ static const char *setup_bare_git_dir(char *cwd, int offset, int len, int *nongi
|
||||
if (check_repository_format_gently(".", nongit_ok))
|
||||
return NULL;
|
||||
|
||||
setenv(GIT_IMPLICIT_WORK_TREE_ENVIRONMENT, "0", 1);
|
||||
|
||||
/* --work-tree is set without --git-dir; use discovered one */
|
||||
if (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {
|
||||
const char *gitdir;
|
||||
@ -794,9 +802,9 @@ const char *setup_git_directory_gently(int *nongit_ok)
|
||||
|
||||
prefix = setup_git_directory_gently_1(nongit_ok);
|
||||
if (prefix)
|
||||
setenv("GIT_PREFIX", prefix, 1);
|
||||
setenv(GIT_PREFIX_ENVIRONMENT, prefix, 1);
|
||||
else
|
||||
setenv("GIT_PREFIX", "", 1);
|
||||
setenv(GIT_PREFIX_ENVIRONMENT, "", 1);
|
||||
|
||||
if (startup_info) {
|
||||
startup_info->have_repository = !nongit_ok || !*nongit_ok;
|
||||
|
Reference in New Issue
Block a user