Skip to content

Commit

Permalink
Revert "fetch/clone: detect dubious ownership of local repositories"
Browse files Browse the repository at this point in the history
This partially reverts f4aa8c8 (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 <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
gitster authored and dscho committed May 21, 2024
1 parent 5c576e8 commit af8282d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions path.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions t/t0411-clone-from-partial.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand All @@ -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" \
Expand All @@ -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" \
Expand Down

0 comments on commit af8282d

Please sign in to comment.