Corrupted line endings when a deployment is clone under Windows
After deploying GitKit, when the deployment is cloned under Windows the line endings of bash scripts are "corrupted". If one tries to run the install scripts in a linux environment under windows (e.g., Docker container a la VS Code Devcontainer, WSL, Cygwin, etc.), the scripts fail. For example,
(Image provided by Dr. Lovell).
This is not a problem for KitClient because the clone occurs inside the KitClient under Linux. Here is a rough sketch of the steps.
- Run KitClient
- In KitClient clone deployed GitKit-FarmData2. <--- Clone within Linux.
- Bash install scripts automatically run in KitClient when cloned.
The problem arises with VS Code DevContainer clients because the clone happens in a possibly Windows environment, causing git to translate newlines according to local system configuration. The workflow now looks like this.
- Clone GitKit-FarmData2. <--- Clone under a Windows environment, corrupting line endings.
- Start VS Code which creates and reopens in DevContainer mounting the local repo.
- Bash install scripts fail to run in DevContainer because the line endings are wrong.
Assuming we want to support DevContainer environments, GitKit-FarmData2 deployments need a properly configured .gitattributes file. This file minimally needs to protect line endings for bash scripts in the .kit folder. This file must be placed during deployment. It should not be placed in the root, because that is FarmData2's territory. It probably belongs in the .kit folder. It could either be generated by a deployment script, or could be placed in a directory that is copied over by the deploy script (preferred because it is simpler and more obvious). Such a .gitattributes file should be generated for ALL deployments (so it's not conditional).