Skip to content

Commit ce026cc

Browse files
mackylegitster
authored andcommitted
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>
1 parent b680a86 commit ce026cc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

t/t5528-push-default.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ check_pushed_commit () {
2626
# $2 = expected target branch for the push
2727
# $3 = [optional] repo to check for actual output (repo1 by default)
2828
test_push_success () {
29-
git ${1:+-c push.default="$1"} push &&
29+
git ${1:+-c} ${1:+push.default="$1"} push &&
3030
check_pushed_commit HEAD "$2" "$3"
3131
}
3232

3333
# $1 = push.default value
3434
# check that push fails and does not modify any remote branch
3535
test_push_failure () {
3636
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 &&
3838
git --git-dir=repo1 log --no-walk --format='%h %s' --all >actual &&
3939
test_cmp expect actual
4040
}

0 commit comments

Comments
 (0)