Thread (1 message) 1 message, 1 author, 2021-02-16

Re: [PATCH v2 1/2] write_entry(): fix misuses of `path` in error messages

From: Junio C Hamano <hidden>
Date: 2021-02-16 02:27:34

Matheus Tavares [off-list ref] writes:
+test_expect_success 'checkout-index --temp correctly reports error on missing blobs' '
+	test_when_finished git reset --hard &&
+	missing_blob=$(git hash-object --stdin </dev/null) &&
+	cat >objs <<-EOF &&
+	100644 $missing_blob	file
+	120000 $missing_blob	symlink
+	EOF
+	git update-index --index-info <objs &&
Does this depend on the fact that nobody created a blob with 0-byte
length in the test repository before this test?  It feels a bit
brittle to me, but as long as future test writers are made aware of
that they must not "git add" an empty file, this is probably OK.

But it may be more robust to do something like

	missing_blob=$(echo no such blob here | git hash-object --stdin)

perhaps?  I dunno.
+	test_must_fail git checkout-index --temp symlink file 2>stderr &&
+	test_i18ngrep "unable to read sha1 file of file ($missing_blob)" stderr &&
+	test_i18ngrep "unable to read sha1 file of symlink ($missing_blob)" stderr
+'
+
+test_expect_success 'checkout-index --temp correctly reports error for submodules' '
+	git init sub &&
+	test_commit -C sub file &&
+	git submodule add ./sub &&
+	git commit -m sub &&
+	test_must_fail git checkout-index --temp sub 2>stderr &&
+	test_i18ngrep "cannot create temporary submodule sub" stderr
+'
+
 test_done
Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help