From af8282d25bc704b09d8bb2f83bfd49327c041557 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 21 May 2024 12:56:58 -0700 Subject: [PATCH] Revert "fetch/clone: detect dubious ownership of local repositories" This partially reverts f4aa8c8b (fetch/clone: detect dubious ownership of local repositories, 2024-04-10) that broke typical read-only use cases (e.g. by git-daemon serving fetches and clones) where "nobody" who has no write permission serves repositories owned by others. The function to die upon seeing dubious ownership is still kept, as there are other users of it, but calls to it from the generic repository discovery code path, which triggered in cases far wider than originally intended (i.e. to stop local clones), have been removed. Signed-off-by: Junio C Hamano Signed-off-by: Johannes Schindelin --- path.c | 2 -- t/t0411-clone-from-partial.sh | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/path.c b/path.c index d61f70e87d4cb8..492e17ad121062 100644 --- a/path.c +++ b/path.c @@ -840,7 +840,6 @@ const char *enter_repo(const char *path, int strict) if (!suffix[i]) return NULL; gitfile = read_gitfile(used_path.buf); - die_upon_dubious_ownership(gitfile, NULL, used_path.buf); if (gitfile) { strbuf_reset(&used_path); strbuf_addstr(&used_path, gitfile); @@ -851,7 +850,6 @@ const char *enter_repo(const char *path, int strict) } else { const char *gitfile = read_gitfile(path); - die_upon_dubious_ownership(gitfile, NULL, path); if (gitfile) path = gitfile; if (chdir(path)) diff --git a/t/t0411-clone-from-partial.sh b/t/t0411-clone-from-partial.sh index b3d6ddc4bc2d99..a481ed97b7ad05 100755 --- a/t/t0411-clone-from-partial.sh +++ b/t/t0411-clone-from-partial.sh @@ -23,7 +23,7 @@ test_expect_success 'create evil repo' ' >evil/.git/shallow ' -test_expect_success 'local clone must not fetch from promisor remote and execute script' ' +test_expect_failure 'local clone must not fetch from promisor remote and execute script' ' rm -f script-executed && test_must_fail git clone \ --upload-pack="GIT_TEST_ASSUME_DIFFERENT_OWNER=true git-upload-pack" \ @@ -33,7 +33,7 @@ test_expect_success 'local clone must not fetch from promisor remote and execute test_path_is_missing script-executed ' -test_expect_success 'clone from file://... must not fetch from promisor remote and execute script' ' +test_expect_failure 'clone from file://... must not fetch from promisor remote and execute script' ' rm -f script-executed && test_must_fail git clone \ --upload-pack="GIT_TEST_ASSUME_DIFFERENT_OWNER=true git-upload-pack" \ @@ -43,7 +43,7 @@ test_expect_success 'clone from file://... must not fetch from promisor remote a test_path_is_missing script-executed ' -test_expect_success 'fetch from file://... must not fetch from promisor remote and execute script' ' +test_expect_failure 'fetch from file://... must not fetch from promisor remote and execute script' ' rm -f script-executed && test_must_fail git fetch \ --upload-pack="GIT_TEST_ASSUME_DIFFERENT_OWNER=true git-upload-pack" \