Git, Shopware and empty folders

the file version management system git is slim, fast, and portable. git always handles objects, namely files. folders are only created if there are files in them, otherwise git doesn't capture them in the first place. this has unpleasant side effects in some projects. for example, the shop system shopware relies on strict adherence to the folder structure to function.

If only one folder is missing (for example, in the "cache" folder or in "templates"), Shopware will terminate the service, and the latest log file in the "logs" folder will show, for example:

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'The directory "C:\...\cache\doctrine\filecache\" does not exist'

To solve the problem, simply place the following php file in the root folder of the repository in which the empty folders are still present and run it:


The file recursively goes through the complete folder structure and puts the empty file "empty-folder" into empty folders. After pushing the change and cleaning the problematic repository, the folder structure is now complete and Shopware works without problems.