t5528: do not fail with FreeBSD shell

The FreeBSD shell converts this expression: git ${1:+-c push.default="$1"} push to this when "$1" is not empty: git "-c push.default=$1" push which causes git to fail. To avoid this we simply break up the expansion into two parts so that the whitespace which creates two arguments instead of one is outside the ${...} like so: git ${1:+-c} ${1:+push.default="$1"} push This has the desired effect on all platforms allowing the test to pass on FreeBSD. Signed-off-by: Kyle J. McKay <mackyle@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kyle J. McKay committed Mar 8, 2015 at 08:37 UTC ce026cc7e2ff729c9809fef860cd696d1f7bb06c
1 file changed +2 -2
t/t5528-push-default.sh
+2 -2
@@ -26,7 +26,7 @@ check_pushed_commit () {
26 # $2 = expected target branch for the push
27 # $3 = [optional] repo to check for actual output (repo1 by default)
28 test_push_success () {
29 - git ${1:+-c push.default="$1"} push &&
29 + git ${1:+-c} ${1:+push.default="$1"} push &&
30 check_pushed_commit HEAD "$2" "$3"
31 }
32
@@ -34,7 +34,7 @@ test_push_success () {
34 # check that push fails and does not modify any remote branch
35 test_push_failure () {
36 git --git-dir=repo1 log --no-walk --format='%h %s' --all >expect &&
37 - test_must_fail git ${1:+-c push.default="$1"} push &&
37 + test_must_fail git ${1:+-c} ${1:+push.default="$1"} push &&
38 git --git-dir=repo1 log --no-walk --format='%h %s' --all >actual &&
39 test_cmp expect actual
40 }