Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-01-24 00:52:28 +0300
committerJunio C Hamano <gitster@pobox.com>2024-01-24 00:52:28 +0300
commite86e2b8e8e7652077d004ebb6a2b4cc1c8e91301 (patch)
tree64b78e2a6b2dc96ff26aa23a43fce224dcb768d8
parent1d5baf3aeda5377d3d79e580da327969a1b3b572 (diff)
parent45bb91624804d3e3a70cfc1ba0eae5577f81fc38 (diff)
Merge branch 'kl/allow-working-in-dot-git-in-non-bare-repository' into seenseen
Loosen "disable repository discovery of a bare repository" check, triggered by setting safe.bareRepository configuration variable to 'explicit', to exclude the ".git/" directory inside a non-bare repository from the check. Comments? * kl/allow-working-in-dot-git-in-non-bare-repository: setup: allow cwd=.git w/ bareRepository=explicit
-rw-r--r--setup.c3
-rwxr-xr-xt/t0035-safe-bare-repository.sh8
2 files changed, 10 insertions, 1 deletions
diff --git a/setup.c b/setup.c
index 4d9c5e6d76..8616374345 100644
--- a/setup.c
+++ b/setup.c
@@ -1390,7 +1390,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;
diff --git a/t/t0035-safe-bare-repository.sh b/t/t0035-safe-bare-repository.sh
index 038b8b788d..8048856379 100755
--- a/t/t0035-safe-bare-repository.sh
+++ b/t/t0035-safe-bare-repository.sh
@@ -78,4 +78,12 @@ test_expect_success 'no trace when GIT_DIR is explicitly provided' '
expect_accepted_explicit "$pwd/outer-repo/bare-repo"
'
+test_expect_success 'no trace when "bare repository" is .git' '
+ expect_accepted_implicit -C outer-repo/.git
+'
+
+test_expect_success 'no trace when "bare repository" is a subdir of .git' '
+ expect_accepted_implicit -C outer-repo/.git/objects
+'
+
test_done