summaryrefslogtreecommitdiff
path: root/upload-pack.c
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 /upload-pack.c
parentb2dc968e60c94189805228f5d99786bd50189583 (diff)
downloadgit-986e82396ab23b9e5f4eab7183bbf76e7bc756d0.tar.gz
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 'upload-pack.c')
0 files changed, 0 insertions, 0 deletions