summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-10-25 23:07:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-10-25 23:07:00 (GMT)
commit67f310e1adfe3cc186aa3dd5c1acfc94398540cc (patch)
tree0603be4f09da62ff0118448b44994e6b98bd5ec4 /t
parent97ab03b12a044ded55de68aac160ffb72c951830 (diff)
parent5d22e18965664fc4036843cd22424ce38c8fa866 (diff)
downloadgit-67f310e1adfe3cc186aa3dd5c1acfc94398540cc.zip
git-67f310e1adfe3cc186aa3dd5c1acfc94398540cc.tar.gz
git-67f310e1adfe3cc186aa3dd5c1acfc94398540cc.tar.bz2
Merge branch 'ab/test-cleanly-recreate-trash-directory'
Improve test framework around unwritable directories. * ab/test-cleanly-recreate-trash-directory: test-lib.sh: try to re-chmod & retry on failed trash removal
Diffstat (limited to 't')
-rw-r--r--t/test-lib.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 151da80..a291a5d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1407,8 +1407,20 @@ HOME="$TRASH_DIRECTORY"
GNUPGHOME="$HOME/gnupg-home-not-used"
export HOME GNUPGHOME USER_HOME
+# "rm -rf" existing trash directory, even if a previous run left it
+# with bad permissions.
+remove_trash_directory () {
+ dir="$1"
+ if ! rm -rf "$dir" 2>/dev/null
+ then
+ chmod -R u+rwx "$dir"
+ rm -rf "$dir"
+ fi
+ ! test -d "$dir"
+}
+
# Test repository
-rm -fr "$TRASH_DIRECTORY" || {
+remove_trash_directory "$TRASH_DIRECTORY" || {
GIT_EXIT_OK=t
echo >&5 "FATAL: Cannot prepare test area"
exit 1