Merge branch 'zh/push-to-delete-onelevel-ref'
"git push" has been taught to allow deletion of refs with one-level names to help repairing a repository who acquired such a ref by mistake. In general, we don't encourage use of such a ref, and creation or update to such a ref is rejected as before. * zh/push-to-delete-onelevel-ref: push: allow delete single-level ref receive-pack: fix funny ref error messsage
This commit is contained in:
@@ -401,6 +401,11 @@ test_expect_success 'push with ambiguity' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'push with onelevel ref' '
|
||||
mk_test testrepo heads/main &&
|
||||
test_must_fail git push testrepo HEAD:refs/onelevel
|
||||
'
|
||||
|
||||
test_expect_success 'push with colon-less refspec (1)' '
|
||||
|
||||
mk_test testrepo heads/frotz tags/frotz &&
|
||||
@@ -898,6 +903,13 @@ test_expect_success 'push --delete refuses empty string' '
|
||||
test_must_fail git push testrepo --delete ""
|
||||
'
|
||||
|
||||
test_expect_success 'push --delete onelevel refspecs' '
|
||||
mk_test testrepo heads/main &&
|
||||
git -C testrepo update-ref refs/onelevel refs/heads/main &&
|
||||
git push testrepo --delete refs/onelevel &&
|
||||
test_must_fail git -C testrepo rev-parse --verify refs/onelevel
|
||||
'
|
||||
|
||||
test_expect_success 'warn on push to HEAD of non-bare repository' '
|
||||
mk_test testrepo heads/main &&
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user