]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/push-delete-nothing'
authorJunio C Hamano <gitster@pobox.com>
Fri, 26 Feb 2021 00:43:32 +0000 (16:43 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Feb 2021 00:43:33 +0000 (16:43 -0800)
"git push $there --delete ''" should have been diagnosed as an
error, but instead turned into a matching push, which has been
corrected.

* jc/push-delete-nothing:
  push: do not turn --delete '' into a matching push

1  2 
builtin/push.c
t/t5516-fetch-push.sh

diff --cc builtin/push.c
Simple merge
index 15262b41929d81fe51ea03d1aba298860ca346b3,bf0d295d804c14998e4070c751dfad06b01a7cf5..f11742ed5999eeb710901226b81d628404021cd6
@@@ -816,18 -814,23 +816,23 @@@ test_expect_success 'push --delete with
  '
  
  test_expect_success 'push --delete refuses src:dest refspecs' '
 -      mk_test testrepo heads/master &&
 -      test_must_fail git push testrepo --delete master:foo
 +      mk_test testrepo heads/main &&
 +      test_must_fail git push testrepo --delete main:foo
  '
  
+ test_expect_success 'push --delete refuses empty string' '
+       mk_test testrepo heads/master &&
+       test_must_fail git push testrepo --delete ""
+ '
  test_expect_success 'warn on push to HEAD of non-bare repository' '
 -      mk_test testrepo heads/master &&
 +      mk_test testrepo heads/main &&
        (
                cd testrepo &&
 -              git checkout master &&
 +              git checkout main &&
                git config receive.denyCurrentBranch warn
        ) &&
 -      git push testrepo master 2>stderr &&
 +      git push testrepo main 2>stderr &&
        grep "warning: updating the current branch" stderr
  '