Skip to content

Commit f1e4fb2

Browse files
committed
t4045: reindent to make helpers readable
Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6d7c17e commit f1e4fb2

File tree

1 file changed

+56
-48
lines changed

1 file changed

+56
-48
lines changed

t/t4045-diff-relative.sh

Lines changed: 56 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,60 +12,68 @@ test_expect_success 'setup' '
1212
git commit -m one
1313
'
1414

15-
check_diff() {
16-
dir=$1; shift
17-
expect=$1; shift
18-
cat >expected <<EOF
19-
diff --git a/$expect b/$expect
20-
new file mode 100644
21-
index 0000000..25c05ef
22-
--- /dev/null
23-
+++ b/$expect
24-
@@ -0,0 +1 @@
25-
+other content
26-
EOF
27-
test_expect_success "-p $*" "
28-
git -C '$dir' diff -p $* HEAD^ >actual &&
29-
test_cmp expected actual
30-
"
15+
check_diff () {
16+
dir=$1
17+
shift
18+
expect=$1
19+
shift
20+
cat >expected <<-EOF
21+
diff --git a/$expect b/$expect
22+
new file mode 100644
23+
index 0000000..25c05ef
24+
--- /dev/null
25+
+++ b/$expect
26+
@@ -0,0 +1 @@
27+
+other content
28+
EOF
29+
test_expect_success "-p $*" "
30+
git -C '$dir' diff -p $* HEAD^ >actual &&
31+
test_cmp expected actual
32+
"
3133
}
3234

33-
check_numstat() {
34-
dir=$1; shift
35-
expect=$1; shift
36-
cat >expected <<EOF
37-
1 0 $expect
38-
EOF
39-
test_expect_success "--numstat $*" "
40-
echo '1 0 $expect' >expected &&
41-
git -C '$dir' diff --numstat $* HEAD^ >actual &&
42-
test_cmp expected actual
43-
"
35+
check_numstat () {
36+
dir=$1
37+
shift
38+
expect=$1
39+
shift
40+
cat >expected <<-EOF
41+
1 0 $expect
42+
EOF
43+
test_expect_success "--numstat $*" "
44+
echo '1 0 $expect' >expected &&
45+
git -C '$dir' diff --numstat $* HEAD^ >actual &&
46+
test_cmp expected actual
47+
"
4448
}
4549

46-
check_stat() {
47-
dir=$1; shift
48-
expect=$1; shift
49-
cat >expected <<EOF
50-
$expect | 1 +
51-
1 file changed, 1 insertion(+)
52-
EOF
53-
test_expect_success "--stat $*" "
54-
git -C '$dir' diff --stat $* HEAD^ >actual &&
55-
test_i18ncmp expected actual
56-
"
50+
check_stat () {
51+
dir=$1
52+
shift
53+
expect=$1
54+
shift
55+
cat >expected <<-EOF
56+
$expect | 1 +
57+
1 file changed, 1 insertion(+)
58+
EOF
59+
test_expect_success "--stat $*" "
60+
git -C '$dir' diff --stat $* HEAD^ >actual &&
61+
test_i18ncmp expected actual
62+
"
5763
}
5864

59-
check_raw() {
60-
dir=$1; shift
61-
expect=$1; shift
62-
cat >expected <<EOF
63-
:000000 100644 0000000000000000000000000000000000000000 25c05ef3639d2d270e7fe765a67668f098092bc5 A $expect
64-
EOF
65-
test_expect_success "--raw $*" "
66-
git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual &&
67-
test_cmp expected actual
68-
"
65+
check_raw () {
66+
dir=$1
67+
shift
68+
expect=$1
69+
shift
70+
cat >expected <<-EOF
71+
:000000 100644 0000000000000000000000000000000000000000 25c05ef3639d2d270e7fe765a67668f098092bc5 A $expect
72+
EOF
73+
test_expect_success "--raw $*" "
74+
git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual &&
75+
test_cmp expected actual
76+
"
6977
}
7078

7179
for type in diff numstat stat raw

0 commit comments

Comments
 (0)