@@ -2106,12 +2106,27 @@ test_expect_success 'R: abort on receiving feature after data command' '
2106
2106
test_must_fail git fast-import <input
2107
2107
'
2108
2108
2109
+ test_expect_success ' R: import-marks features forbidden by default' '
2110
+ >git.marks &&
2111
+ echo "feature import-marks=git.marks" >input &&
2112
+ test_must_fail git fast-import <input &&
2113
+ echo "feature import-marks-if-exists=git.marks" >input &&
2114
+ test_must_fail git fast-import <input
2115
+ '
2116
+
2109
2117
test_expect_success ' R: only one import-marks feature allowed per stream' '
2118
+ >git.marks &&
2119
+ >git2.marks &&
2110
2120
cat >input <<-EOF &&
2111
2121
feature import-marks=git.marks
2112
2122
feature import-marks=git2.marks
2113
2123
EOF
2114
2124
2125
+ test_must_fail git fast-import --allow-unsafe-features <input
2126
+ '
2127
+
2128
+ test_expect_success ' R: export-marks feature forbidden by default' '
2129
+ echo "feature export-marks=git.marks" >input &&
2115
2130
test_must_fail git fast-import <input
2116
2131
'
2117
2132
@@ -2125,19 +2140,29 @@ test_expect_success 'R: export-marks feature results in a marks file being creat
2125
2140
2126
2141
EOF
2127
2142
2128
- cat input | git fast-import &&
2143
+ git fast-import --allow-unsafe-features <input &&
2129
2144
grep :1 git.marks
2130
2145
'
2131
2146
2132
2147
test_expect_success ' R: export-marks options can be overridden by commandline options' '
2133
- cat input | git fast-import --export-marks=other.marks &&
2134
- grep :1 other.marks
2148
+ cat >input <<-\EOF &&
2149
+ feature export-marks=feature-sub/git.marks
2150
+ blob
2151
+ mark :1
2152
+ data 3
2153
+ hi
2154
+
2155
+ EOF
2156
+ git fast-import --allow-unsafe-features \
2157
+ --export-marks=cmdline-sub/other.marks <input &&
2158
+ grep :1 cmdline-sub/other.marks &&
2159
+ test_path_is_missing feature-sub
2135
2160
'
2136
2161
2137
2162
test_expect_success ' R: catch typo in marks file name' '
2138
2163
test_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&
2139
2164
echo "feature import-marks=nonexistent.marks" |
2140
- test_must_fail git fast-import
2165
+ test_must_fail git fast-import --allow-unsafe-features
2141
2166
'
2142
2167
2143
2168
test_expect_success ' R: import and output marks can be the same file' '
@@ -2193,7 +2218,8 @@ test_expect_success 'R: feature import-marks-if-exists' '
2193
2218
rm -f io.marks &&
2194
2219
>expect &&
2195
2220
2196
- git fast-import --export-marks=io.marks <<-\EOF &&
2221
+ git fast-import --export-marks=io.marks \
2222
+ --allow-unsafe-features <<-\EOF &&
2197
2223
feature import-marks-if-exists=not_io.marks
2198
2224
EOF
2199
2225
test_cmp expect io.marks &&
@@ -2204,7 +2230,8 @@ test_expect_success 'R: feature import-marks-if-exists' '
2204
2230
echo ":1 $blob" >expect &&
2205
2231
echo ":2 $blob" >>expect &&
2206
2232
2207
- git fast-import --export-marks=io.marks <<-\EOF &&
2233
+ git fast-import --export-marks=io.marks \
2234
+ --allow-unsafe-features <<-\EOF &&
2208
2235
feature import-marks-if-exists=io.marks
2209
2236
blob
2210
2237
mark :2
@@ -2217,7 +2244,8 @@ test_expect_success 'R: feature import-marks-if-exists' '
2217
2244
echo ":3 $blob" >>expect &&
2218
2245
2219
2246
git fast-import --import-marks=io.marks \
2220
- --export-marks=io.marks <<-\EOF &&
2247
+ --export-marks=io.marks \
2248
+ --allow-unsafe-features <<-\EOF &&
2221
2249
feature import-marks-if-exists=not_io.marks
2222
2250
blob
2223
2251
mark :3
@@ -2230,7 +2258,8 @@ test_expect_success 'R: feature import-marks-if-exists' '
2230
2258
>expect &&
2231
2259
2232
2260
git fast-import --import-marks-if-exists=not_io.marks \
2233
- --export-marks=io.marks <<-\EOF &&
2261
+ --export-marks=io.marks \
2262
+ --allow-unsafe-features <<-\EOF &&
2234
2263
feature import-marks-if-exists=io.marks
2235
2264
EOF
2236
2265
test_cmp expect io.marks
@@ -2242,7 +2271,7 @@ test_expect_success 'R: import to output marks works without any content' '
2242
2271
feature export-marks=marks.new
2243
2272
EOF
2244
2273
2245
- cat input | git fast-import &&
2274
+ git fast-import --allow-unsafe-features <input &&
2246
2275
test_cmp marks.out marks.new
2247
2276
'
2248
2277
@@ -2252,7 +2281,7 @@ test_expect_success 'R: import marks prefers commandline marks file over the str
2252
2281
feature export-marks=marks.new
2253
2282
EOF
2254
2283
2255
- cat input | git fast-import --import-marks=marks.out &&
2284
+ git fast-import --import-marks=marks.out --allow-unsafe-features <input &&
2256
2285
test_cmp marks.out marks.new
2257
2286
'
2258
2287
@@ -2265,7 +2294,8 @@ test_expect_success 'R: multiple --import-marks= should be honoured' '
2265
2294
2266
2295
head -n2 marks.out > one.marks &&
2267
2296
tail -n +3 marks.out > two.marks &&
2268
- git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
2297
+ git fast-import --import-marks=one.marks --import-marks=two.marks \
2298
+ --allow-unsafe-features <input &&
2269
2299
test_cmp marks.out combined.marks
2270
2300
'
2271
2301
@@ -2278,7 +2308,7 @@ test_expect_success 'R: feature relative-marks should be honoured' '
2278
2308
2279
2309
mkdir -p .git/info/fast-import/ &&
2280
2310
cp marks.new .git/info/fast-import/relative.in &&
2281
- git fast-import <input &&
2311
+ git fast-import --allow-unsafe-features <input &&
2282
2312
test_cmp marks.new .git/info/fast-import/relative.out
2283
2313
'
2284
2314
@@ -2290,7 +2320,7 @@ test_expect_success 'R: feature no-relative-marks should be honoured' '
2290
2320
feature export-marks=non-relative.out
2291
2321
EOF
2292
2322
2293
- git fast-import <input &&
2323
+ git fast-import --allow-unsafe-features <input &&
2294
2324
test_cmp marks.new non-relative.out
2295
2325
'
2296
2326
@@ -2560,7 +2590,7 @@ test_expect_success 'R: quiet option results in no stats being output' '
2560
2590
2561
2591
EOF
2562
2592
2563
- cat input | git fast-import 2> output &&
2593
+ git fast-import 2>output <input &&
2564
2594
test_must_be_empty output
2565
2595
'
2566
2596
0 commit comments