Imported Upstream version 2.24.0
[platform/upstream/git.git] / t / t9300-fast-import.sh
index 2ea4795..e707fb8 100755 (executable)
@@ -85,6 +85,36 @@ test_expect_success 'A: create pack from stdin' '
        An annotated tag that annotates a blob.
        EOF
 
+       tag to-be-deleted
+       from :3
+       data <<EOF
+       Another annotated tag that annotates a blob.
+       EOF
+
+       reset refs/tags/to-be-deleted
+       from 0000000000000000000000000000000000000000
+
+       tag nested
+       mark :6
+       from :4
+       data <<EOF
+       Tag of our lovely commit
+       EOF
+
+       reset refs/tags/nested
+       from 0000000000000000000000000000000000000000
+
+       tag nested
+       mark :7
+       from :6
+       data <<EOF
+       Tag of tag of our lovely commit
+       EOF
+
+       alias
+       mark :8
+       to :5
+
        INPUT_END
        git fast-import --export-marks=marks.out <input &&
        git whatchanged master
@@ -157,12 +187,19 @@ test_expect_success 'A: verify tag/series-A-blob' '
        test_cmp expect actual
 '
 
+test_expect_success 'A: verify tag deletion is successful' '
+       test_must_fail git rev-parse --verify refs/tags/to-be-deleted
+'
+
 test_expect_success 'A: verify marks output' '
        cat >expect <<-EOF &&
        :2 $(git rev-parse --verify master:file2)
        :3 $(git rev-parse --verify master:file3)
        :4 $(git rev-parse --verify master:file4)
        :5 $(git rev-parse --verify master^0)
+       :6 $(git cat-file tag nested | grep object | cut -d" " -f 2)
+       :7 $(git rev-parse --verify nested)
+       :8 $(git rev-parse --verify master^0)
        EOF
        test_cmp expect marks.out
 '
@@ -2106,27 +2143,12 @@ 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
 '
 
@@ -2140,29 +2162,19 @@ test_expect_success 'R: export-marks feature results in a marks file being creat
 
        EOF
 
-       git fast-import --allow-unsafe-features <input &&
+       cat input | git fast-import &&
        grep :1 git.marks
 '
 
 test_expect_success 'R: export-marks options can be overridden by commandline options' '
-       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
+       cat input | git fast-import --export-marks=other.marks &&
+       grep :1 other.marks
 '
 
 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 --allow-unsafe-features
+       test_must_fail git fast-import
 '
 
 test_expect_success 'R: import and output marks can be the same file' '
@@ -2217,8 +2229,7 @@ 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 \
-                       --allow-unsafe-features <<-\EOF &&
+       git fast-import --export-marks=io.marks <<-\EOF &&
        feature import-marks-if-exists=not_io.marks
        EOF
        test_must_be_empty io.marks &&
@@ -2229,8 +2240,7 @@ test_expect_success 'R: feature import-marks-if-exists' '
        echo ":1 $blob" >expect &&
        echo ":2 $blob" >>expect &&
 
-       git fast-import --export-marks=io.marks \
-                       --allow-unsafe-features <<-\EOF &&
+       git fast-import --export-marks=io.marks <<-\EOF &&
        feature import-marks-if-exists=io.marks
        blob
        mark :2
@@ -2243,8 +2253,7 @@ test_expect_success 'R: feature import-marks-if-exists' '
        echo ":3 $blob" >>expect &&
 
        git fast-import --import-marks=io.marks \
-                       --export-marks=io.marks \
-                       --allow-unsafe-features <<-\EOF &&
+                       --export-marks=io.marks <<-\EOF &&
        feature import-marks-if-exists=not_io.marks
        blob
        mark :3
@@ -2255,8 +2264,7 @@ 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 \
-                       --allow-unsafe-features <<-\EOF &&
+                       --export-marks=io.marks <<-\EOF &&
        feature import-marks-if-exists=io.marks
        EOF
        test_must_be_empty io.marks
@@ -2268,7 +2276,7 @@ test_expect_success 'R: import to output marks works without any content' '
        feature export-marks=marks.new
        EOF
 
-       git fast-import --allow-unsafe-features <input &&
+       cat input | git fast-import &&
        test_cmp marks.out marks.new
 '
 
@@ -2278,7 +2286,7 @@ test_expect_success 'R: import marks prefers commandline marks file over the str
        feature export-marks=marks.new
        EOF
 
-       git fast-import --import-marks=marks.out --allow-unsafe-features <input &&
+       cat input | git fast-import --import-marks=marks.out &&
        test_cmp marks.out marks.new
 '
 
@@ -2291,8 +2299,7 @@ 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 \
-               --allow-unsafe-features <input &&
+       git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
        test_cmp marks.out combined.marks
 '
 
@@ -2305,7 +2312,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 --allow-unsafe-features <input &&
+       git fast-import <input &&
        test_cmp marks.new .git/info/fast-import/relative.out
 '
 
@@ -2317,7 +2324,7 @@ test_expect_success 'R: feature no-relative-marks should be honoured' '
        feature export-marks=non-relative.out
        EOF
 
-       git fast-import --allow-unsafe-features <input &&
+       git fast-import <input &&
        test_cmp marks.new non-relative.out
 '
 
@@ -2587,7 +2594,7 @@ test_expect_success 'R: quiet option results in no stats being output' '
 
        EOF
 
-       git fast-import 2>output <input &&
+       cat input | git fast-import 2> output &&
        test_must_be_empty output
 '
 
@@ -2811,7 +2818,6 @@ test_expect_success 'S: filemodify with garbage after mark must fail' '
        COMMIT
        M 100644 :403x hello.c
        EOF
-       cat err &&
        test_i18ngrep "space after mark" err
 '
 
@@ -2828,7 +2834,6 @@ test_expect_success 'S: filemodify with garbage after inline must fail' '
        inline
        BLOB
        EOF
-       cat err &&
        test_i18ngrep "nvalid dataref" err
 '
 
@@ -2842,7 +2847,6 @@ test_expect_success 'S: filemodify with garbage after sha1 must fail' '
        COMMIT
        M 100644 ${sha1}x hello.c
        EOF
-       cat err &&
        test_i18ngrep "space after SHA1" err
 '
 
@@ -2858,7 +2862,6 @@ test_expect_success 'S: notemodify with garbage after mark dataref must fail' '
        COMMIT
        N :202x :302
        EOF
-       cat err &&
        test_i18ngrep "space after mark" err
 '
 
@@ -2874,7 +2877,6 @@ test_expect_success 'S: notemodify with garbage after inline dataref must fail'
        note blob
        BLOB
        EOF
-       cat err &&
        test_i18ngrep "nvalid dataref" err
 '
 
@@ -2888,7 +2890,6 @@ test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '
        COMMIT
        N ${sha1}x :302
        EOF
-       cat err &&
        test_i18ngrep "space after SHA1" err
 '
 
@@ -2904,7 +2905,6 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail'
        COMMIT
        N :202 :302x
        EOF
-       cat err &&
        test_i18ngrep "after mark" err
 '
 
@@ -2938,7 +2938,6 @@ test_expect_success 'S: from with garbage after mark must fail' '
        EOF
 
        # now evaluate the error
-       cat err &&
        test_i18ngrep "after mark" err
 '
 
@@ -2958,7 +2957,6 @@ test_expect_success 'S: merge with garbage after mark must fail' '
        merge :303x
        M 100644 :403 hello.c
        EOF
-       cat err &&
        test_i18ngrep "after mark" err
 '
 
@@ -2974,7 +2972,6 @@ test_expect_success 'S: tag with garbage after mark must fail' '
        tag S
        TAG
        EOF
-       cat err &&
        test_i18ngrep "after mark" err
 '
 
@@ -2985,7 +2982,6 @@ test_expect_success 'S: cat-blob with garbage after mark must fail' '
        test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
        cat-blob :403x
        EOF
-       cat err &&
        test_i18ngrep "after mark" err
 '
 
@@ -2996,7 +2992,6 @@ test_expect_success 'S: ls with garbage after mark must fail' '
        test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
        ls :302x hello.c
        EOF
-       cat err &&
        test_i18ngrep "space after mark" err
 '
 
@@ -3005,7 +3000,6 @@ test_expect_success 'S: ls with garbage after sha1 must fail' '
        test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
        ls ${sha1}x hello.c
        EOF
-       cat err &&
        test_i18ngrep "space after tree-ish" err
 '