mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
Merge branch 'jc/push-delete-nothing'
"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
This commit is contained in:
commit
140045821a
|
@ -115,7 +115,7 @@ static void set_refspecs(const char **refs, int nr, const char *repo)
|
||||||
else
|
else
|
||||||
refspec_appendf(&rs, "refs/tags/%s", ref);
|
refspec_appendf(&rs, "refs/tags/%s", ref);
|
||||||
} else if (deleterefs) {
|
} else if (deleterefs) {
|
||||||
if (strchr(ref, ':'))
|
if (strchr(ref, ':') || !*ref)
|
||||||
die(_("--delete only accepts plain target ref names"));
|
die(_("--delete only accepts plain target ref names"));
|
||||||
refspec_appendf(&rs, ":%s", ref);
|
refspec_appendf(&rs, ":%s", ref);
|
||||||
} else if (!strchr(ref, ':')) {
|
} else if (!strchr(ref, ':')) {
|
||||||
|
|
|
@ -820,6 +820,11 @@ test_expect_success 'push --delete refuses src:dest refspecs' '
|
||||||
test_must_fail git push testrepo --delete main:foo
|
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' '
|
test_expect_success 'warn on push to HEAD of non-bare repository' '
|
||||||
mk_test testrepo heads/main &&
|
mk_test testrepo heads/main &&
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in a new issue