diff options
author | Jeff King <peff@peff.net> | 2014-07-02 14:44:30 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-07-02 12:51:38 -0700 |
commit | 45067fc973c31953ab283f77f0f91eba9a272624 (patch) | |
tree | aff48ea05984ad0effcea2e67cfeea8a7483d257 /t/t7300-clean.sh | |
parent | 782735203c316041df120748e5e88c1787cdf4da (diff) | |
download | git-45067fc973c31953ab283f77f0f91eba9a272624.tar.gz |
t7300: repair filesystem permissions with test_when_finished
We create a directory that cannot be removed, confirm that
it cannot be removed, and then fix it like:
chmod 0 foo &&
test_must_fail git clean -d -f &&
chmod 755 foo
If the middle step fails but leaves the directory (e.g., the
bug is that clean does not notice the failure), this
pollutes the test repo with an unremovable directory. Not
only does this cause further tests to fail, but it means
that "rm -rf" fails on the whole trash directory, and the
user has to intervene manually to even re-run the test script.
We can bump the "chmod 755" recovery to a test_when_finished
block to be sure that it always runs.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7300-clean.sh')
-rwxr-xr-x | t/t7300-clean.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 710be90489..8dbe950bb0 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -426,10 +426,10 @@ test_expect_success SANITY 'removal failure' ' mkdir foo && touch foo/bar && + test_when_finished "chmod 755 foo" && (exec <foo/bar && chmod 0 foo && - test_must_fail git clean -f -d && - chmod 755 foo) + test_must_fail git clean -f -d) ' test_expect_success 'nested git work tree' ' |