aboutsummaryrefslogtreecommitdiff
path: root/Documentation/config.txt
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-11-08 20:49:27 -0500
committerJunio C Hamano <gitster@pobox.com>2008-11-09 10:16:50 -0800
commit986e82396ab23b9e5f4eab7183bbf76e7bc756d0 (patch)
tree1b97bad8eecac01fb76031ab97de3d0f7121fa1f /Documentation/config.txt
parentb2dc968e60c94189805228f5d99786bd50189583 (diff)
downloadgit-986e82396ab23b9e5f4eab7183bbf76e7bc756d0.tar.gz
git-986e82396ab23b9e5f4eab7183bbf76e7bc756d0.tar.xz
receive-pack: detect push to current branch of non-bare repo
Pushing into the currently checked out branch of a non-bare repository can be dangerous; the HEAD then loses sync with the index and working tree, and it looks in the receiving repo as if the pushed changes have been reverted in the index (since they were never there in the first place). This patch adds a safety valve that checks for this condition and either generates a warning or denies the update. We trigger the check only on a non-bare repository, since a bare repo does not have a working tree (and in fact, pushing to the HEAD branch is a common workflow for publishing repositories). The behavior is configurable via receive.denyCurrentBranch, defaulting to "warn" so as not to break existing setups (though it may, after a deprecation period, switch to "refuse" by default). For users who know what they are doing and want to silence the warning (e.g., because they have a post-receive hook that reconciles the HEAD and working tree), they can turn off the warning by setting it to false or "ignore". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/config.txt')
-rw-r--r--Documentation/config.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 965ed746d..32dcd643d 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1198,6 +1198,15 @@ receive.denyNonFastForwards::
even if that push is forced. This configuration variable is
set when initializing a shared repository.
+receive.denyCurrentBranch::
+ If set to true or "refuse", receive-pack will deny a ref update
+ to the currently checked out branch of a non-bare repository.
+ Such a push is potentially dangerous because it brings the HEAD
+ out of sync with the index and working tree. If set to "warn",
+ print a warning of such a push to stderr, but allow the push to
+ proceed. If set to false or "ignore", allow such pushes with no
+ message. Defaults to "warn".
+
transfer.unpackLimit::
When `fetch.unpackLimit` or `receive.unpackLimit` are
not set, the value of this variable is used instead.