On Mon, Feb 09, 2009 at 01:09:22AM -0800, Junio C Hamano wrote:
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.
This patch looks good to me. One comment:
quoted hunk ↗ jump to hunk
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -193,4 +193,11 @@ test_expect_success 'pushing wildcard refspecs respects forcing' '
)
'
+test_expect_success 'deny pushing to delete current branch' '
+ (
+ rewound_push_setup &&
+ git send-pack ../parent/.git :refs/heads/master 2>errs
+ )
+'
It was not immediately obvious why the subshell is needed here (for
those in the audience, it is because rewound_push_setup changes
directory). Perhaps 2/6 should be amended for rewound_push_setup to use
a subshell instead, which makes it less likely to be forgotten by new
tests.
-Peff