Re: [PATCH v2 1/2] write_entry(): fix misuses of `path` in error messages
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 16, 2021, 02:26 UTC
- Message-ID
- <xmqqk0r8sq6u.fsf@gitster.c.googlers.com>
- In-Reply-To
- <bdda5f99d031abad65c296a61b3713f60d22ef16.1613411136.git.matheus.bernardino@usp.br>
Matheus Tavares <matheus.bernardino@usp.br> writes:
Show 8 quoted lines
> +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.
Show 15 quoted lines
> + 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.