aboutsummaryrefslogtreecommitdiff
path: root/t/t5400-send-pack.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-02-08 22:31:21 -0800
committerJunio C Hamano <gitster@pobox.com>2009-02-10 22:26:49 -0800
commit747ca2455a8dd4e255358f5f96773f84259408c3 (patch)
treede51c7888f7b9bbaa2dc30aed33c66c91bac3218 /t/t5400-send-pack.sh
parentba19a808aa871f0eb20aaeeb205e086b04b726dc (diff)
downloadgit-747ca2455a8dd4e255358f5f96773f84259408c3.tar.gz
git-747ca2455a8dd4e255358f5f96773f84259408c3.tar.xz
receive-pack: receive.denyDeleteCurrent
This is a companion patch to the recent 3d95d92 (receive-pack: explain what to do when push updates the current branch, 2009-01-31). Deleting the current branch from a remote will result in the next clone from it not check out anything, among other things. It also is one of the cause that makes remotes/origin/HEAD a dangling symbolic ref. This patch still allows the traditional behaviour but with a big warning, and promises that the default will change to 'refuse' in a future release. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5400-send-pack.sh')
-rwxr-xr-xt/t5400-send-pack.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index d6151f885..f2d5581b1 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -190,4 +190,17 @@ test_expect_success 'pushing wildcard refspecs respects forcing' '
test "$parent_head" = "$child_head"
'
+test_expect_success 'warn pushing to delete current branch' '
+ rewound_push_setup &&
+ (
+ cd child &&
+ git send-pack ../parent :refs/heads/master 2>errs
+ ) &&
+ grep "warning: to refuse deleting" child/errs &&
+ (
+ cd parent &&
+ test_must_fail git rev-parse --verify master
+ )
+'
+
test_done