diff options
author | Jeff King <peff@peff.net> | 2008-11-08 20:49:27 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-11-09 10:16:50 -0800 |
commit | 986e82396ab23b9e5f4eab7183bbf76e7bc756d0 (patch) | |
tree | 1b97bad8eecac01fb76031ab97de3d0f7121fa1f /builtin-symbolic-ref.c | |
parent | t5516: refactor oddball tests (diff) | |
download | tgif-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 'builtin-symbolic-ref.c')
0 files changed, 0 insertions, 0 deletions