]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t9300-fast-import.sh
Sync with 2.23.1
[thirdparty/git.git] / t / t9300-fast-import.sh
index e707fb861e14ed66b7cc524ab02513eafec74fca..17bb6dccbd4ec6377563b78e3ce353dc1cdeb82c 100755 (executable)
@@ -2143,12 +2143,27 @@ test_expect_success 'R: abort on receiving feature after data command' '
        test_must_fail git fast-import <input
 '
 
+test_expect_success 'R: import-marks features forbidden by default' '
+       >git.marks &&
+       echo "feature import-marks=git.marks" >input &&
+       test_must_fail git fast-import <input &&
+       echo "feature import-marks-if-exists=git.marks" >input &&
+       test_must_fail git fast-import <input
+'
+
 test_expect_success 'R: only one import-marks feature allowed per stream' '
+       >git.marks &&
+       >git2.marks &&
        cat >input <<-EOF &&
        feature import-marks=git.marks
        feature import-marks=git2.marks
        EOF
 
+       test_must_fail git fast-import --allow-unsafe-features <input
+'
+
+test_expect_success 'R: export-marks feature forbidden by default' '
+       echo "feature export-marks=git.marks" >input &&
        test_must_fail git fast-import <input
 '
 
@@ -2162,19 +2177,29 @@ test_expect_success 'R: export-marks feature results in a marks file being creat
 
        EOF
 
-       cat input | git fast-import &&
+       git fast-import --allow-unsafe-features <input &&
        grep :1 git.marks
 '
 
 test_expect_success 'R: export-marks options can be overridden by commandline options' '
-       cat input | git fast-import --export-marks=other.marks &&
-       grep :1 other.marks
+       cat >input <<-\EOF &&
+       feature export-marks=feature-sub/git.marks
+       blob
+       mark :1
+       data 3
+       hi
+
+       EOF
+       git fast-import --allow-unsafe-features \
+                       --export-marks=cmdline-sub/other.marks <input &&
+       grep :1 cmdline-sub/other.marks &&
+       test_path_is_missing feature-sub
 '
 
 test_expect_success 'R: catch typo in marks file name' '
        test_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&
        echo "feature import-marks=nonexistent.marks" |
-       test_must_fail git fast-import
+       test_must_fail git fast-import --allow-unsafe-features
 '
 
 test_expect_success 'R: import and output marks can be the same file' '
@@ -2229,7 +2254,8 @@ test_expect_success 'R: --import-marks-if-exists' '
 test_expect_success 'R: feature import-marks-if-exists' '
        rm -f io.marks &&
 
-       git fast-import --export-marks=io.marks <<-\EOF &&
+       git fast-import --export-marks=io.marks \
+                       --allow-unsafe-features <<-\EOF &&
        feature import-marks-if-exists=not_io.marks
        EOF
        test_must_be_empty io.marks &&
@@ -2240,7 +2266,8 @@ test_expect_success 'R: feature import-marks-if-exists' '
        echo ":1 $blob" >expect &&
        echo ":2 $blob" >>expect &&
 
-       git fast-import --export-marks=io.marks <<-\EOF &&
+       git fast-import --export-marks=io.marks \
+                       --allow-unsafe-features <<-\EOF &&
        feature import-marks-if-exists=io.marks
        blob
        mark :2
@@ -2253,7 +2280,8 @@ test_expect_success 'R: feature import-marks-if-exists' '
        echo ":3 $blob" >>expect &&
 
        git fast-import --import-marks=io.marks \
-                       --export-marks=io.marks <<-\EOF &&
+                       --export-marks=io.marks \
+                       --allow-unsafe-features <<-\EOF &&
        feature import-marks-if-exists=not_io.marks
        blob
        mark :3
@@ -2264,7 +2292,8 @@ test_expect_success 'R: feature import-marks-if-exists' '
        test_cmp expect io.marks &&
 
        git fast-import --import-marks-if-exists=not_io.marks \
-                       --export-marks=io.marks <<-\EOF &&
+                       --export-marks=io.marks \
+                       --allow-unsafe-features <<-\EOF &&
        feature import-marks-if-exists=io.marks
        EOF
        test_must_be_empty io.marks
@@ -2276,7 +2305,7 @@ test_expect_success 'R: import to output marks works without any content' '
        feature export-marks=marks.new
        EOF
 
-       cat input | git fast-import &&
+       git fast-import --allow-unsafe-features <input &&
        test_cmp marks.out marks.new
 '
 
@@ -2286,7 +2315,7 @@ test_expect_success 'R: import marks prefers commandline marks file over the str
        feature export-marks=marks.new
        EOF
 
-       cat input | git fast-import --import-marks=marks.out &&
+       git fast-import --import-marks=marks.out --allow-unsafe-features <input &&
        test_cmp marks.out marks.new
 '
 
@@ -2299,7 +2328,8 @@ test_expect_success 'R: multiple --import-marks= should be honoured' '
 
        head -n2 marks.out > one.marks &&
        tail -n +3 marks.out > two.marks &&
-       git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
+       git fast-import --import-marks=one.marks --import-marks=two.marks \
+               --allow-unsafe-features <input &&
        test_cmp marks.out combined.marks
 '
 
@@ -2312,7 +2342,7 @@ test_expect_success 'R: feature relative-marks should be honoured' '
 
        mkdir -p .git/info/fast-import/ &&
        cp marks.new .git/info/fast-import/relative.in &&
-       git fast-import <input &&
+       git fast-import --allow-unsafe-features <input &&
        test_cmp marks.new .git/info/fast-import/relative.out
 '
 
@@ -2324,7 +2354,7 @@ test_expect_success 'R: feature no-relative-marks should be honoured' '
        feature export-marks=non-relative.out
        EOF
 
-       git fast-import <input &&
+       git fast-import --allow-unsafe-features <input &&
        test_cmp marks.new non-relative.out
 '
 
@@ -2594,7 +2624,7 @@ test_expect_success 'R: quiet option results in no stats being output' '
 
        EOF
 
-       cat input | git fast-import 2> output &&
+       git fast-import 2>output <input &&
        test_must_be_empty output
 '