summaryrefslogtreecommitdiffstats
path: root/path.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-12-10 02:04:55 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-10 02:04:55 +0100
commit35f40385e441d5aa885f5aa813539d5ed9dc2d26 (patch)
tree07dbb374eaef5dbdff5a0ad6369232f975acd570 /path.h
parentMerge branch 'pb/mergetool-errors' (diff)
parentAllow cloning from repositories owned by another user (diff)
downloadgit-35f40385e441d5aa885f5aa813539d5ed9dc2d26.tar.xz
git-35f40385e441d5aa885f5aa813539d5ed9dc2d26.zip
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.h')
-rw-r--r--path.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/path.h b/path.h
index e91d19fff6..5f6c85e5f8 100644
--- a/path.h
+++ b/path.h
@@ -156,7 +156,22 @@ int calc_shared_perm(int mode);
int adjust_shared_perm(const char *path);
char *interpolate_path(const char *path, int real_home);
-const char *enter_repo(const char *path, int strict);
+
+/* The bits are as follows:
+ *
+ * - ENTER_REPO_STRICT: callers that require exact paths (as opposed
+ * to allowing known suffixes like ".git", ".git/.git" to be
+ * omitted) can set this bit.
+ *
+ * - ENTER_REPO_ANY_OWNER_OK: callers that are willing to run without
+ * ownership check can set this bit.
+ */
+enum {
+ ENTER_REPO_STRICT = (1<<0),
+ ENTER_REPO_ANY_OWNER_OK = (1<<1),
+};
+
+const char *enter_repo(const char *path, unsigned flags);
const char *remove_leading_path(const char *in, const char *prefix);
const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);
int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);