diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2021-08-29 11:25:36 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-08-30 09:42:49 -0700 |
commit | 614c3d8f2e330baedfdb09fc90803a4c360d39cb (patch) | |
tree | b5fc4fd358ee1750929d4ddc8425240eb61718b1 /contrib/coccinelle/object_id.cocci | |
parent | Git 2.33 (diff) | |
download | tgif-614c3d8f2e330baedfdb09fc90803a4c360d39cb.tar.xz |
test-lib: set GIT_CEILING_DIRECTORIES to protect the surrounding repository
Every once in a while a test somehow manages to escape from its trash
directory and modifies the surrounding repository, whether because of
a bug in git itself, a bug in a test [1], or e.g. when trying to run
tests with a shell that is, in general, unable to run our tests [2].
Set GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.." as an additional
safety measure to protect the surrounding repository at least from
modifications by git commands executed in the tests (assuming that
handling of ceiling directories during repository discovery is not
broken, and, of course, it won't save us from regular shell commands,
e.g. 'cd .. && rm -f ...').
[1] e.g. https://public-inbox.org/git/20210423051255.GD2947267@szeder.dev
[2] $ git symbolic-ref HEAD
refs/heads/master
$ ksh ./t2011-checkout-invalid-head.sh
[... a lot of "not ok" ...]
$ git symbolic-ref HEAD
refs/heads/other
(In short: 'ksh' doesn't support the 'local' builtin command,
which is used by 'test_oid', causing it to return with error
whenever it's called, leaving ZERO_OID set to empty, so when the
test 'checkout main from invalid HEAD' runs 'echo $ZERO_OID
>.git/HEAD' it writes a corrupt (not invalid) HEAD, and subsequent
git commands don't recognize the repository in the trash directory
anymore, but operate on the surrounding repo.)
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/coccinelle/object_id.cocci')
0 files changed, 0 insertions, 0 deletions