diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-12-10 10:04:55 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-12-10 10:04:55 +0900 |
| commit | 35f40385e441d5aa885f5aa813539d5ed9dc2d26 (patch) | |
| tree | 07dbb374eaef5dbdff5a0ad6369232f975acd570 /path.c | |
| parent | 9cd1e2e1a0350a3b6cbc4bcd268f0cbbe8c89687 (diff) | |
| parent | 0ffb5a6bf1b0fd9ce0c0b1fd9ce9fd30b89a2563 (diff) | |
| download | git-35f40385e441d5aa885f5aa813539d5ed9dc2d26.tar.xz | |
Merge branch 'bc/allow-upload-pack-from-other-people'
Loosen overly strict ownership check introduced in the recent past,
to keep the promise "cloning a suspicious repository is a safe
first step to inspect it".
* bc/allow-upload-pack-from-other-people:
Allow cloning from repositories owned by another user
Diffstat (limited to 'path.c')
| -rw-r--r-- | path.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -684,7 +684,7 @@ return_null: * links. User relative paths are also returned as they are given, * except DWIM suffixing. */ -const char *enter_repo(const char *path, int strict) +const char *enter_repo(const char *path, unsigned flags) { static struct strbuf validated_path = STRBUF_INIT; static struct strbuf used_path = STRBUF_INIT; @@ -692,7 +692,7 @@ const char *enter_repo(const char *path, int strict) if (!path) return NULL; - if (!strict) { + if (!(flags & ENTER_REPO_STRICT)) { static const char *suffix[] = { "/.git", "", ".git/.git", ".git", NULL, }; @@ -736,7 +736,8 @@ 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 (!(flags & ENTER_REPO_ANY_OWNER_OK)) + die_upon_dubious_ownership(gitfile, NULL, used_path.buf); if (gitfile) { strbuf_reset(&used_path); strbuf_addstr(&used_path, gitfile); @@ -747,7 +748,8 @@ const char *enter_repo(const char *path, int strict) } else { const char *gitfile = read_gitfile(path); - die_upon_dubious_ownership(gitfile, NULL, path); + if (!(flags & ENTER_REPO_ANY_OWNER_OK)) + die_upon_dubious_ownership(gitfile, NULL, path); if (gitfile) path = gitfile; if (chdir(path)) |
