From f9739262907ddd0531cbb05aef5d4ff9091f820a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Tue, 18 Sep 2018 09:27:59 +0200 Subject: [PATCH] Include empty directories in the default state of acceptance tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before each scenario of the acceptance tests is run the Nextcloud server is reset to a default state. To do this the full directory of the Nextcloud server is commited to a local Git repository and then reset to that commit when needed. Unfortunately, Git does not support including empty directories in a commit. Due to this, when the default state was restored, it could happen that the file cache listed an empty directory that did not exist because it was not properly restored (for example, "data/appdata_*/css/icons"), and that in turn could lead to an error when the directory was used. Currently the only way to force Git to include an empty directory is to add a dummy file to the directory (so it will no longer be empty, but that should not be a problem in the affected directories, even if the dummy file is not included in the file cache); although Git FAQ suggests using a ".gitignore" file a ".keep" file was used instead, as it conveys better its purpose. Signed-off-by: Daniel Calviño Sánchez --- tests/acceptance/run-local.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/acceptance/run-local.sh b/tests/acceptance/run-local.sh index e2270be385..0e47b47bfa 100755 --- a/tests/acceptance/run-local.sh +++ b/tests/acceptance/run-local.sh @@ -160,6 +160,8 @@ tests/acceptance/installAndConfigureServer.sh $INSTALL_AND_CONFIGURE_SERVER_PARA echo "Saving the default state so acceptance tests can reset to it" find . -name ".gitignore" -exec rm --force {} \; +# Create dummy files in empty directories to force Git to save the directories. +find . -not -path "*.git*" -type d -empty -exec touch {}/.keep \; git add --all && echo 'Default state' | git -c user.name='John Doe' -c user.email='john@doe.org' commit --quiet --file=- cd tests/acceptance