summaryrefslogtreecommitdiffstats
path: root/t/t5516-fetch-push.sh
diff options
context:
space:
mode:
authorGlen Choo <chooglen@google.com>2022-06-01 01:12:34 +0200
committerJunio C Hamano <gitster@pobox.com>2022-06-01 19:49:51 +0200
commitf1dfbd9ee010e5cdf0d931d16b4b2892b33331e5 (patch)
tree11059c68a3ec4fe9dd62bb52bcdef264b9fb2fc4 /t/t5516-fetch-push.sh
parentremote.c: don't BUG() on 0-length branch names (diff)
downloadgit-f1dfbd9ee010e5cdf0d931d16b4b2892b33331e5.tar.xz
git-f1dfbd9ee010e5cdf0d931d16b4b2892b33331e5.zip
remote.c: reject 0-length branch names
Branch names can't be empty, so config keys with an empty branch name, e.g. "branch..remote", are silently ignored. Since these config keys will never be useful, make it a fatal error when remote.c finds a key that starts with "branch." and has an empty subsection. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5516-fetch-push.sh')
-rwxr-xr-xt/t5516-fetch-push.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index de0bab398e..ff38563fb7 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -602,13 +602,23 @@ test_expect_success 'branch.*.pushremote config order is irrelevant' '
check_push_result two_repo $the_commit heads/main
'
-test_expect_success 'push ignores empty branch name entries' '
+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
'