diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-01-30 13:34:12 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-01-30 13:34:12 -0800 |
| commit | a8bf3c0cac802487f308f5986620723ee3c27969 (patch) | |
| tree | b2074b3100bdfba1cada0cd110b7844f339e38cb /setup.c | |
| parent | fa50e7a8a08741c798fa72c1177e78966d0cd553 (diff) | |
| parent | 45bb91624804d3e3a70cfc1ba0eae5577f81fc38 (diff) | |
| download | git-a8bf3c0cac802487f308f5986620723ee3c27969.tar.gz | |
Merge branch 'kl/allow-working-in-dot-git-in-non-bare-repository'
The "disable repository discovery of a bare repository" check,
triggered by setting safe.bareRepository configuration variable to
'explicit', has been loosened to exclude the ".git/" directory inside
a non-bare repository from the check. So you can do "cd .git &&
git cmd" to run a Git command that works on a bare repository without
explicitly specifying $GIT_DIR now.
* kl/allow-working-in-dot-git-in-non-bare-repository:
setup: allow cwd=.git w/ bareRepository=explicit
Diffstat (limited to 'setup.c')
| -rw-r--r-- | setup.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1371,7 +1371,8 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir, if (is_git_directory(dir->buf)) { trace2_data_string("setup", NULL, "implicit-bare-repository", dir->buf); - if (get_allowed_bare_repo() == ALLOWED_BARE_REPO_EXPLICIT) + if (get_allowed_bare_repo() == ALLOWED_BARE_REPO_EXPLICIT && + !ends_with_path_components(dir->buf, ".git")) return GIT_DIR_DISALLOWED_BARE; if (!ensure_valid_ownership(NULL, NULL, dir->buf, report)) return GIT_DIR_INVALID_OWNERSHIP; |
