t5520: improve test style

Improve the test style by removing leading and trailing empty lines
within test cases. Also, reformat multi-line subshells to conform to the
existing style.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Denton Liu 2019-11-12 15:07:48 -08:00 committed by Junio C Hamano
parent 2c9e125b27
commit e8d1eaf9b4

View File

@ -538,7 +538,6 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m
'
test_expect_success '--rebase with rebased upstream' '
git remote add -f me . &&
git checkout copy &&
git tag copy-orig &&
@ -552,7 +551,6 @@ test_expect_success '--rebase with rebased upstream' '
git pull --rebase me copy &&
test "conflicting modification" = "$(cat file)" &&
test file = "$(cat file2)"
'
test_expect_success '--rebase -f with rebased upstream' '
@ -564,14 +562,12 @@ test_expect_success '--rebase -f with rebased upstream' '
'
test_expect_success '--rebase with rebased default upstream' '
git update-ref refs/remotes/me/copy copy-orig &&
git checkout --track -b to-rebase2 me/copy &&
git reset --hard to-rebase-orig &&
git pull --rebase &&
test "conflicting modification" = "$(cat file)" &&
test file = "$(cat file2)"
'
test_expect_success 'rebased upstream + fetch + pull --rebase' '
@ -588,7 +584,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '
'
test_expect_success 'pull --rebase dies early with dirty working directory' '
git checkout to-rebase &&
git update-ref refs/remotes/me/copy copy^ &&
COPY="$(git rev-parse --verify me/copy)" &&
@ -603,16 +598,16 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '
git checkout HEAD -- file &&
git pull &&
test "$COPY" != "$(git rev-parse --verify me/copy)"
'
test_expect_success 'pull --rebase works on branch yet to be born' '
git rev-parse master >expect &&
mkdir empty_repo &&
(cd empty_repo &&
git init &&
git pull --rebase .. master &&
git rev-parse HEAD >../actual
(
cd empty_repo &&
git init &&
git pull --rebase .. master &&
git rev-parse HEAD >../actual
) &&
test_cmp expect actual
'
@ -646,58 +641,65 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '
test_expect_success 'setup for detecting upstreamed changes' '
mkdir src &&
(cd src &&
git init &&
printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff &&
git add stuff &&
git commit -m "Initial revision"
(
cd src &&
git init &&
printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff &&
git add stuff &&
git commit -m "Initial revision"
) &&
git clone src dst &&
(cd src &&
modify s/5/43/ stuff &&
git commit -a -m "5->43" &&
modify s/6/42/ stuff &&
git commit -a -m "Make it bigger"
(
cd src &&
modify s/5/43/ stuff &&
git commit -a -m "5->43" &&
modify s/6/42/ stuff &&
git commit -a -m "Make it bigger"
) &&
(cd dst &&
modify s/5/43/ stuff &&
git commit -a -m "Independent discovery of 5->43"
(
cd dst &&
modify s/5/43/ stuff &&
git commit -a -m "Independent discovery of 5->43"
)
'
test_expect_success 'git pull --rebase detects upstreamed changes' '
(cd dst &&
git pull --rebase &&
test -z "$(git ls-files -u)"
(
cd dst &&
git pull --rebase &&
test -z "$(git ls-files -u)"
)
'
test_expect_success 'setup for avoiding reapplying old patches' '
(cd dst &&
test_might_fail git rebase --abort &&
git reset --hard origin/master
(
cd dst &&
test_might_fail git rebase --abort &&
git reset --hard origin/master
) &&
git clone --bare src src-replace.git &&
rm -rf src &&
mv src-replace.git src &&
(cd dst &&
modify s/2/22/ stuff &&
git commit -a -m "Change 2" &&
modify s/3/33/ stuff &&
git commit -a -m "Change 3" &&
modify s/4/44/ stuff &&
git commit -a -m "Change 4" &&
git push &&
(
cd dst &&
modify s/2/22/ stuff &&
git commit -a -m "Change 2" &&
modify s/3/33/ stuff &&
git commit -a -m "Change 3" &&
modify s/4/44/ stuff &&
git commit -a -m "Change 4" &&
git push &&
modify s/44/55/ stuff &&
git commit --amend -a -m "Modified Change 4"
modify s/44/55/ stuff &&
git commit --amend -a -m "Modified Change 4"
)
'
test_expect_success 'git pull --rebase does not reapply old patches' '
(cd dst &&
test_must_fail git pull --rebase &&
test 1 = $(find .git/rebase-apply -name "000*" | wc -l)
(
cd dst &&
test_must_fail git pull --rebase &&
test 1 = $(find .git/rebase-apply -name "000*" | wc -l)
)
'