about summary refs log tree commit diff
path: root/third_party/git/t/t9300-fast-import.sh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/git/t/t9300-fast-import.sh')
-rwxr-xr-xthird_party/git/t/t9300-fast-import.sh132
1 files changed, 35 insertions, 97 deletions
diff --git a/third_party/git/t/t9300-fast-import.sh b/third_party/git/t/t9300-fast-import.sh
index 3e41c58a13..141b7fa35e 100755
--- a/third_party/git/t/t9300-fast-import.sh
+++ b/third_party/git/t/t9300-fast-import.sh
@@ -85,36 +85,6 @@ 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
@@ -187,19 +157,12 @@ 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
 '
@@ -1047,6 +1010,7 @@ test_expect_success 'M: rename root to subdirectory' '
 	EOF
 	git fast-import <input &&
 	git diff-tree -M -r M4^ M4 >actual &&
+	cat actual &&
 	compare_diff_raw expect actual
 '
 
@@ -2142,27 +2106,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
 '
 
@@ -2176,29 +2125,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' '
@@ -2253,8 +2192,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 &&
@@ -2265,8 +2203,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
@@ -2279,8 +2216,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
@@ -2291,8 +2227,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
@@ -2304,7 +2239,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
 '
 
@@ -2314,7 +2249,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
 '
 
@@ -2327,8 +2262,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
 '
 
@@ -2341,7 +2275,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
 '
 
@@ -2353,7 +2287,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
 '
 
@@ -2506,6 +2440,9 @@ test_expect_success PIPE 'R: copy using cat-file' '
 	echo $expect_id blob $expect_len >expect.response &&
 
 	rm -f blobs &&
+	cat >frontend <<-\FRONTEND_END &&
+	#!/bin/sh
+	FRONTEND_END
 
 	mkfifo blobs &&
 	(
@@ -2620,7 +2557,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
 '
 
@@ -2844,6 +2781,7 @@ 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
 '
 
@@ -2860,6 +2798,7 @@ test_expect_success 'S: filemodify with garbage after inline must fail' '
 	inline
 	BLOB
 	EOF
+	cat err &&
 	test_i18ngrep "nvalid dataref" err
 '
 
@@ -2873,6 +2812,7 @@ 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
 '
 
@@ -2888,6 +2828,7 @@ 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
 '
 
@@ -2903,6 +2844,7 @@ test_expect_success 'S: notemodify with garbage after inline dataref must fail'
 	note blob
 	BLOB
 	EOF
+	cat err &&
 	test_i18ngrep "nvalid dataref" err
 '
 
@@ -2916,6 +2858,7 @@ 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
 '
 
@@ -2931,6 +2874,7 @@ 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
 '
 
@@ -2964,6 +2908,7 @@ test_expect_success 'S: from with garbage after mark must fail' '
 	EOF
 
 	# now evaluate the error
+	cat err &&
 	test_i18ngrep "after mark" err
 '
 
@@ -2983,6 +2928,7 @@ 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
 '
 
@@ -2998,6 +2944,7 @@ test_expect_success 'S: tag with garbage after mark must fail' '
 	tag S
 	TAG
 	EOF
+	cat err &&
 	test_i18ngrep "after mark" err
 '
 
@@ -3008,6 +2955,7 @@ 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
 '
 
@@ -3018,6 +2966,7 @@ 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
 '
 
@@ -3026,6 +2975,7 @@ 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
 '
 
@@ -3190,22 +3140,13 @@ background_import_then_checkpoint () {
 	exec 9<>V.output
 	rm V.output
 
-	(
-		git fast-import $options <&8 >&9 &
-		echo $! >&9
-		wait $!
-		echo >&2 "background fast-import terminated too early with exit code $?"
-		# Un-block the read loop in the main shell process.
-		echo >&9 UNEXPECTED
-	) &
-	sh_pid=$!
-	read fi_pid <&9
+	git fast-import $options <&8 >&9 &
+	echo $! >V.pid
 	# We don't mind if fast-import has already died by the time the test
 	# ends.
 	test_when_finished "
 		exec 8>&-; exec 9>&-;
-		kill $sh_pid && wait $sh_pid
-		kill $fi_pid && wait $fi_pid
+		kill $(cat V.pid) && wait $(cat V.pid)
 		true"
 
 	# Start in the background to ensure we adhere strictly to (blocking)
@@ -3225,9 +3166,6 @@ background_import_then_checkpoint () {
 		then
 			error=0
 			break
-		elif test "$output" = "UNEXPECTED"
-		then
-			break
 		fi
 		# otherwise ignore cruft
 		echo >&2 "cruft: $output"
@@ -3240,7 +3178,7 @@ background_import_then_checkpoint () {
 }
 
 background_import_still_running () {
-	if ! kill -0 "$fi_pid"
+	if ! kill -0 "$(cat V.pid)"
 	then
 		echo >&2 "background fast-import terminated too early"
 		false