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:

4287bb0575ce0f5ea732

The file recursively traverses the entire folder structure and creates the empty file "empty-folder" in empty folders . After pushing the change and pulling it from the problematic repository, the folder structure is now complete and Shopware functions without problems.

Back