Skip to content

Commit 396243f

Browse files
artagnongitster
authored andcommitted
t/t5528-push-default: generalize test_push_*
The setup creates two bare repositories: repo1 and repo2, but test_push_commit() hard-codes checking in repo1 for the actual output. Generalize it and its caller, test_push_success(), to optionally accept a third argument to specify the name of the repository to check for actual output. We will use this in the next patch. Signed-off-by: Ramkumar Ramachandra <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ed2b182 commit 396243f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/t5528-push-default.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@ test_expect_success 'setup bare remotes' '
1515

1616
# $1 = local revision
1717
# $2 = remote revision (tested to be equal to the local one)
18+
# $3 = [optional] repo to check for actual output (repo1 by default)
1819
check_pushed_commit () {
1920
git log -1 --format='%h %s' "$1" >expect &&
20-
git --git-dir=repo1 log -1 --format='%h %s' "$2" >actual &&
21+
git --git-dir="${3:-repo1}" log -1 --format='%h %s' "$2" >actual &&
2122
test_cmp expect actual
2223
}
2324

2425
# $1 = push.default value
2526
# $2 = expected target branch for the push
27+
# $3 = [optional] repo to check for actual output (repo1 by default)
2628
test_push_success () {
2729
git -c push.default="$1" push &&
28-
check_pushed_commit HEAD "$2"
30+
check_pushed_commit HEAD "$2" "$3"
2931
}
3032

3133
# $1 = push.default value

0 commit comments

Comments
 (0)