Skip to content

Commit 18a8269

Browse files
jrngitster
authored andcommitted
tests: subshell indentation stylefix
Format the subshells introduced by the previous patch (Several tests: cd inside subshell instead of around, 2010-09-06) like so: ( cd subdir && ... ) && This is generally easier to read and has the nice side-effect that this patch will show what commands are used in the subshell, making it easier to check for lost environment variables and similar behavior changes. Cc: Jens Lehmann <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 347c47e commit 18a8269

22 files changed

+260
-192
lines changed

t/t1020-subdirectory.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ test_expect_success 'update-index and ls-files' '
2727
one) echo pass one ;;
2828
*) echo bad one; exit 1 ;;
2929
esac &&
30-
(cd dir &&
31-
git update-index --add two &&
32-
case "`git ls-files`" in
33-
two) echo pass two ;;
34-
*) echo bad two; exit 1 ;;
35-
esac
30+
(
31+
cd dir &&
32+
git update-index --add two &&
33+
case "`git ls-files`" in
34+
two) echo pass two ;;
35+
*) echo bad two; exit 1 ;;
36+
esac
3637
) &&
3738
case "`git ls-files`" in
3839
dir/two"$LF"one) echo pass both ;;

t/t1302-repo-version.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,15 @@ test_expect_success 'gitdir selection on unsupported repo' '
3333

3434
test_expect_success 'gitdir not required mode' '
3535
git apply --stat test.patch &&
36-
(cd test && git apply --stat ../test.patch) &&
37-
(cd test2 && git apply --stat ../test.patch)'
36+
(
37+
cd test &&
38+
git apply --stat ../test.patch
39+
) &&
40+
(
41+
cd test2 &&
42+
git apply --stat ../test.patch
43+
)
44+
'
3845

3946
test_expect_success 'gitdir required mode on normal repos' '
4047
(git apply --check --index test.patch &&

t/t3060-ls-files-with-tree.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ test_expect_success setup '
5353
git add .
5454
'
5555

56-
# We have to run from a sub-directory to trigger prune_path
57-
# Then we finally get to run our --with-tree test
58-
5956
test_expect_success 'git -ls-files --with-tree should succeed from subdir' '
60-
61-
(cd sub && git ls-files --with-tree=HEAD~1 >../output)
62-
57+
# We have to run from a sub-directory to trigger prune_path
58+
# Then we finally get to run our --with-tree test
59+
(
60+
cd sub &&
61+
git ls-files --with-tree=HEAD~1 >../output
62+
)
6363
'
6464

6565
test_expect_success \

t/t3409-rebase-preserve-merges.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ test_expect_success 'setup for merge-preserving rebase' \
5252
git commit -m "Add different B" &&
5353
5454
git clone ./. clone2 &&
55-
(cd clone2 &&
56-
git checkout -b topic origin/topic &&
57-
test_must_fail git merge origin/master &&
58-
echo Resolved > B &&
59-
git add B &&
60-
git commit -m "Merge origin/master into topic"
55+
(
56+
cd clone2 &&
57+
git checkout -b topic origin/topic &&
58+
test_must_fail git merge origin/master &&
59+
echo Resolved >B &&
60+
git add B &&
61+
git commit -m "Merge origin/master into topic"
6162
) &&
6263
6364
git checkout topic &&

t/t3903-stash.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ test_expect_success 'apply stashed changes (including index)' '
6969
test_expect_success 'unstashing in a subdirectory' '
7070
git reset --hard HEAD &&
7171
mkdir subdir &&
72-
(cd subdir &&
73-
git stash apply
72+
(
73+
cd subdir &&
74+
git stash apply
7475
)
7576
'
7677

t/t4041-diff-submodule-option.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ EOF
8585
"
8686

8787
commit_file sm1 &&
88-
head3=$(cd sm1 &&
89-
git reset --hard HEAD~2 >/dev/null &&
90-
git rev-parse --verify HEAD | cut -c1-7
88+
head3=$(
89+
cd sm1 &&
90+
git reset --hard HEAD~2 >/dev/null &&
91+
git rev-parse --verify HEAD | cut -c1-7
9192
)
9293

9394
test_expect_success 'modified submodule(backward)' "

t/t5510-fetch.sh

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,29 @@ test_expect_success setup '
2121

2222
test_expect_success "clone and setup child repos" '
2323
git clone . one &&
24-
(cd one &&
25-
echo >file updated by one &&
26-
git commit -a -m "updated by one"
24+
(
25+
cd one &&
26+
echo >file updated by one &&
27+
git commit -a -m "updated by one"
2728
) &&
2829
git clone . two &&
29-
(cd two &&
30-
git config branch.master.remote one &&
31-
git config remote.one.url ../one/.git/ &&
32-
git config remote.one.fetch refs/heads/master:refs/heads/one
30+
(
31+
cd two &&
32+
git config branch.master.remote one &&
33+
git config remote.one.url ../one/.git/ &&
34+
git config remote.one.fetch refs/heads/master:refs/heads/one
3335
) &&
3436
git clone . three &&
35-
(cd three &&
36-
git config branch.master.remote two &&
37-
git config branch.master.merge refs/heads/one &&
38-
mkdir -p .git/remotes &&
39-
{
40-
echo "URL: ../two/.git/"
41-
echo "Pull: refs/heads/master:refs/heads/two"
42-
echo "Pull: refs/heads/one:refs/heads/one"
43-
} >.git/remotes/two
37+
(
38+
cd three &&
39+
git config branch.master.remote two &&
40+
git config branch.master.merge refs/heads/one &&
41+
mkdir -p .git/remotes &&
42+
{
43+
echo "URL: ../two/.git/"
44+
echo "Pull: refs/heads/master:refs/heads/two"
45+
echo "Pull: refs/heads/one:refs/heads/one"
46+
} >.git/remotes/two
4447
) &&
4548
git clone . bundle &&
4649
git clone . seven

t/t6050-replace.sh

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,17 @@ test_expect_success '"git fsck" works' '
104104
test_expect_success 'repack, clone and fetch work' '
105105
git repack -a -d &&
106106
git clone --no-hardlinks . clone_dir &&
107-
(cd clone_dir &&
108-
git show HEAD~5 | grep "A U Thor" &&
109-
git show $HASH2 | grep "A U Thor" &&
110-
git cat-file commit $R &&
111-
git repack -a -d &&
112-
test_must_fail git cat-file commit $R &&
113-
git fetch ../ "refs/replace/*:refs/replace/*" &&
114-
git show HEAD~5 | grep "O Thor" &&
115-
git show $HASH2 | grep "O Thor" &&
116-
git cat-file commit $R
107+
(
108+
cd clone_dir &&
109+
git show HEAD~5 | grep "A U Thor" &&
110+
git show $HASH2 | grep "A U Thor" &&
111+
git cat-file commit $R &&
112+
git repack -a -d &&
113+
test_must_fail git cat-file commit $R &&
114+
git fetch ../ "refs/replace/*:refs/replace/*" &&
115+
git show HEAD~5 | grep "O Thor" &&
116+
git show $HASH2 | grep "O Thor" &&
117+
git cat-file commit $R
117118
)
118119
'
119120

@@ -177,9 +178,10 @@ test_expect_success 'create parallel branch without the bug' '
177178

178179
test_expect_success 'push to cloned repo' '
179180
git push cloned $HASH6^:refs/heads/parallel &&
180-
(cd clone_dir &&
181-
git checkout parallel &&
182-
git log --pretty=oneline | grep $PARA2
181+
(
182+
cd clone_dir &&
183+
git checkout parallel &&
184+
git log --pretty=oneline | grep $PARA2
183185
)
184186
'
185187

@@ -191,19 +193,21 @@ test_expect_success 'push branch with replacement' '
191193
git show $HASH6~2 | grep "O Thor" &&
192194
git show $PARA3 | grep "O Thor" &&
193195
git push cloned $HASH6^:refs/heads/parallel2 &&
194-
(cd clone_dir &&
195-
git checkout parallel2 &&
196-
git log --pretty=oneline | grep $PARA3 &&
197-
git show $PARA3 | grep "A U Thor"
196+
(
197+
cd clone_dir &&
198+
git checkout parallel2 &&
199+
git log --pretty=oneline | grep $PARA3 &&
200+
git show $PARA3 | grep "A U Thor"
198201
)
199202
'
200203

201204
test_expect_success 'fetch branch with replacement' '
202205
git branch tofetch $HASH6 &&
203-
(cd clone_dir &&
204-
git fetch origin refs/heads/tofetch:refs/heads/parallel3
205-
git log --pretty=oneline parallel3 | grep $PARA3
206-
git show $PARA3 | grep "A U Thor"
206+
(
207+
cd clone_dir &&
208+
git fetch origin refs/heads/tofetch:refs/heads/parallel3
209+
git log --pretty=oneline parallel3 | grep $PARA3
210+
git show $PARA3 | grep "A U Thor"
207211
)
208212
'
209213

t/t7400-submodule-basic.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,12 @@ test_expect_success 'submodule <invalid-path> warns' '
413413

414414
test_expect_success 'add submodules without specifying an explicit path' '
415415
mkdir repo &&
416-
(cd repo &&
417-
git init &&
418-
echo r >r &&
419-
git add r &&
420-
git commit -m "repo commit 1"
416+
(
417+
cd repo &&
418+
git init &&
419+
echo r >r &&
420+
git add r &&
421+
git commit -m "repo commit 1"
421422
) &&
422423
git clone --bare repo/ bare.git &&
423424
cd addtest &&

t/t7401-submodule-summary.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ EOF
6666
"
6767

6868
commit_file sm1 &&
69-
head3=$(cd sm1 &&
70-
git reset --hard HEAD~2 >/dev/null &&
71-
git rev-parse --verify HEAD | cut -c1-7
69+
head3=$(
70+
cd sm1 &&
71+
git reset --hard HEAD~2 >/dev/null &&
72+
git rev-parse --verify HEAD | cut -c1-7
7273
)
7374

7475
test_expect_success 'modified submodule(backward)' "

0 commit comments

Comments
 (0)