summaryrefslogtreecommitdiff
path: root/t/t5520-pull.sh
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2019-11-12 23:07:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-21 00:41:51 (GMT)
commite8d1eaf9b4b8cec4928962084d07147e0161a88e (patch)
tree947d1dcd0bc6d9b8638f4d729c76bb6c887d382a /t/t5520-pull.sh
parent2c9e125b2727c33dccdba1b2a46f462b77e10bed (diff)
downloadgit-e8d1eaf9b4b8cec4928962084d07147e0161a88e.zip
git-e8d1eaf9b4b8cec4928962084d07147e0161a88e.tar.gz
git-e8d1eaf9b4b8cec4928962084d07147e0161a88e.tar.bz2
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>
Diffstat (limited to 't/t5520-pull.sh')
-rwxr-xr-xt/t5520-pull.sh88
1 files changed, 45 insertions, 43 deletions
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index cf4cc32..51d6ce8 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -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 &&
-
- modify s/44/55/ stuff &&
- git commit --amend -a -m "Modified Change 4"
+ (
+ 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"
)
'
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)
)
'