@@ -5,7 +5,6 @@ test_description='git patch-id'
5
5
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
7
8
- TEST_PASSES_SANITIZE_LEAK=true
9
8
. ./test-lib.sh
10
9
11
10
test_expect_success ' setup' '
@@ -28,16 +27,17 @@ test_expect_success 'setup' '
28
27
'
29
28
30
29
test_expect_success ' patch-id output is well-formed' '
31
- git log -p -1 | git patch-id >output &&
30
+ git log -p -1 >log.output &&
31
+ git patch-id <log.output >output &&
32
32
grep "^$OID_REGEX $(git rev-parse HEAD)$" output
33
33
'
34
34
35
35
# calculate patch id. Make sure output is not empty.
36
36
calc_patch_id () {
37
37
patch_name=" $1 "
38
38
shift
39
- git patch-id " $@ " |
40
- sed " s/ .*//" > patch-id_" $patch_name " &&
39
+ git patch-id " $@ " > patch-id.output &&
40
+ sed " s/ .*//" patch-id.output > patch-id_" $patch_name " &&
41
41
test_line_count -gt 0 patch-id_" $patch_name "
42
42
}
43
43
@@ -46,7 +46,8 @@ get_top_diff () {
46
46
}
47
47
48
48
get_patch_id () {
49
- get_top_diff " $1 " | calc_patch_id " $@ "
49
+ get_top_diff " $1 " > top-diff.output &&
50
+ calc_patch_id < top-diff.output " $@ "
50
51
}
51
52
52
53
test_expect_success ' patch-id detects equality' '
@@ -64,16 +65,18 @@ test_expect_success 'patch-id detects inequality' '
64
65
test_expect_success ' patch-id supports git-format-patch output' '
65
66
get_patch_id main &&
66
67
git checkout same &&
67
- git format-patch -1 --stdout | calc_patch_id same &&
68
+ git format-patch -1 --stdout >format-patch.output &&
69
+ calc_patch_id same <format-patch.output &&
68
70
test_cmp patch-id_main patch-id_same &&
69
- set $(git format- patch -1 --stdout | git patch-id ) &&
71
+ set $(git patch-id <format- patch.output ) &&
70
72
test "$2" = $(git rev-parse HEAD)
71
73
'
72
74
73
75
test_expect_success ' whitespace is irrelevant in footer' '
74
76
get_patch_id main &&
75
77
git checkout same &&
76
- git format-patch -1 --stdout | sed "s/ \$//" | calc_patch_id same &&
78
+ git format-patch -1 --stdout >format-patch.output &&
79
+ sed "s/ \$//" format-patch.output | calc_patch_id same &&
77
80
test_cmp patch-id_main patch-id_same
78
81
'
79
82
@@ -92,10 +95,11 @@ test_patch_id_file_order () {
92
95
shift
93
96
name=" order-${1} -$relevant "
94
97
shift
95
- get_top_diff " main" | calc_patch_id " $name " " $@ " &&
98
+ get_top_diff " main" > top-diff.output &&
99
+ calc_patch_id < top-diff.output " $name " " $@ " &&
96
100
git checkout same &&
97
- git format-patch -1 --stdout -O foo-then-bar |
98
- calc_patch_id " ordered-$name " " $@ " &&
101
+ git format-patch -1 --stdout -O foo-then-bar > format-patch.output &&
102
+ calc_patch_id < format-patch.output " ordered-$name " " $@ " &&
99
103
cmp_patch_id $relevant " $name " " ordered-$name "
100
104
101
105
}
@@ -143,7 +147,8 @@ test_expect_success '--stable overrides patchid.stable = false' '
143
147
test_expect_success ' patch-id supports git-format-patch MIME output' '
144
148
get_patch_id main &&
145
149
git checkout same &&
146
- git format-patch -1 --attach --stdout | calc_patch_id same &&
150
+ git format-patch -1 --attach --stdout >format-patch.output &&
151
+ calc_patch_id <format-patch.output same &&
147
152
test_cmp patch-id_main patch-id_same
148
153
'
149
154
0 commit comments