Merge branch 'gc/zero-length-branch-config-fix'

A misconfigured 'branch..remote' led to a bug in configuration
parsing.

* gc/zero-length-branch-config-fix:
  remote.c: reject 0-length branch names
  remote.c: don't BUG() on 0-length branch names
This commit is contained in:
Junio C Hamano
2022-06-10 15:04:14 -07:00
2 changed files with 26 additions and 4 deletions

View File

@ -598,6 +598,26 @@ test_expect_success 'branch.*.pushremote config order is irrelevant' '
check_push_result two_repo $the_commit heads/main
'
test_expect_success 'push rejects empty branch name entries' '
mk_test one_repo heads/main &&
test_config remote.one.url one_repo &&
test_config branch..remote one &&
test_config branch..merge refs/heads/ &&
test_config branch.main.remote one &&
test_config branch.main.merge refs/heads/main &&
test_must_fail git push 2>err &&
grep "bad config variable .branch\.\." err
'
test_expect_success 'push ignores "branch." config without subsection' '
mk_test one_repo heads/main &&
test_config remote.one.url one_repo &&
test_config branch.autoSetupMerge true &&
test_config branch.main.remote one &&
test_config branch.main.merge refs/heads/main &&
git push
'
test_expect_success 'push with dry-run' '
mk_test testrepo heads/main &&