From d8f4481c4f03132174b514f428cd67d2cc0dc997 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 10 Apr 2017 18:14:12 -0400 Subject: refs: reject ref updates while GIT_QUARANTINE_PATH is set As documented in git-receive-pack(1), updating a ref from within the pre-receive hook is dangerous and can corrupt your repo. This patch forbids ref updates entirely during the hook to make it harder for adventurous hook writers to shoot themselves in the foot. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/git-receive-pack.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Documentation/git-receive-pack.txt') diff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt index 7267ecfbe8..86a4b32f0f 100644 --- a/Documentation/git-receive-pack.txt +++ b/Documentation/git-receive-pack.txt @@ -239,7 +239,8 @@ This has a few user-visible effects and caveats: 3. The `pre-receive` hook MUST NOT update any refs to point to quarantined objects. Other programs accessing the repository will not be able to see the objects (and if the pre-receive hook fails, - those refs would become corrupted). + those refs would become corrupted). For safety, any ref updates + from within `pre-receive` are automatically rejected. SEE ALSO -- cgit v1.2.1