t2101: modernize test style
Most of our tests start with the opening quote of the test body on the same line as the test_expect_success call. Additionally, our tests are usually indented with a single tab. Update this test to be the same as most others, which will make it easier to use inline heredocs in the future. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Mar 25, 2018 at 19:20 UTC
7cbae724a4e35a55fb788f78be38e88748e25c24
1 file changed
+29
-23
t/t2101-update-index-reupdate.sh
+29
-23
@@ -12,15 +12,16 @@ cat > expected <<\EOF
12
100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0 file1
13
100644 9db8893856a8a02eaa73470054b7c1c5a7c82e47 0 file2
14
EOF
15
-test_expect_success 'update-index --add' \
16
- 'echo hello world >file1 &&
17
- echo goodbye people >file2 &&
18
- git update-index --add file1 file2 &&
19
- git ls-files -s >current &&
20
- cmp current expected'
15
+test_expect_success 'update-index --add' '
16
+ echo hello world >file1 &&
17
+ echo goodbye people >file2 &&
18
+ git update-index --add file1 file2 &&
19
+ git ls-files -s >current &&
20
+ cmp current expected
21
+'
22
22
-test_expect_success 'update-index --again' \
23
- 'rm -f file1 &&
23
+test_expect_success 'update-index --again' '
24
+ rm -f file1 &&
25
echo hello everybody >file2 &&
26
if git update-index --again
27
then
@@ -29,16 +30,18 @@ test_expect_success 'update-index --again' \
30
else
31
echo happy - failed as expected
32
fi &&
32
- git ls-files -s >current &&
33
- cmp current expected'
33
+ git ls-files -s >current &&
34
+ cmp current expected
35
+'
36
37
cat > expected <<\EOF
38
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
39
EOF
38
-test_expect_success 'update-index --remove --again' \
39
- 'git update-index --remove --again &&
40
- git ls-files -s >current &&
41
- cmp current expected'
40
+test_expect_success 'update-index --remove --again' '
41
+ git update-index --remove --again &&
42
+ git ls-files -s >current &&
43
+ cmp current expected
44
+'
45
46
test_expect_success 'first commit' 'git commit -m initial'
47
@@ -46,8 +49,8 @@ cat > expected <<\EOF
49
100644 53ab446c3f4e42ce9bb728a0ccb283a101be4979 0 dir1/file3
50
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
51
EOF
49
-test_expect_success 'update-index again' \
50
- 'mkdir -p dir1 &&
52
+test_expect_success 'update-index again' '
53
+ mkdir -p dir1 &&
54
echo hello world >dir1/file3 &&
55
echo goodbye people >file2 &&
56
git update-index --add file2 dir1/file3 &&
@@ -55,30 +58,33 @@ test_expect_success 'update-index again' \
58
echo happy >dir1/file3 &&
59
git update-index --again &&
60
git ls-files -s >current &&
58
- cmp current expected'
61
+ cmp current expected
62
+'
63
64
cat > expected <<\EOF
65
100644 d7fb3f695f06c759dbf3ab00046e7cc2da22d10f 0 dir1/file3
66
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
67
EOF
64
-test_expect_success 'update-index --update from subdir' \
65
- 'echo not so happy >file2 &&
68
+test_expect_success 'update-index --update from subdir' '
69
+ echo not so happy >file2 &&
70
(cd dir1 &&
71
cat ../file2 >file3 &&
72
git update-index --again
73
) &&
74
git ls-files -s >current &&
71
- cmp current expected'
75
+ cmp current expected
76
+'
77
78
cat > expected <<\EOF
79
100644 594fb5bb1759d90998e2bf2a38261ae8e243c760 0 dir1/file3
80
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
81
EOF
77
-test_expect_success 'update-index --update with pathspec' \
78
- 'echo very happy >file2 &&
82
+test_expect_success 'update-index --update with pathspec' '
83
+ echo very happy >file2 &&
84
cat file2 >dir1/file3 &&
85
git update-index --again dir1/ &&
86
git ls-files -s >current &&
82
- cmp current expected'
87
+ cmp current expected
88
+'
89
90
test_done