Open DerekHarter opened 2 years ago
Another note. Once a commit has been created with bad cr/lf endings, the only resolution is to revert all files back. One can also us the dos2unix
command line tool to convert individual files 1-by-one to unix cr/lf endings. You may need to do an apt install dos2unix
to get this tool.
Since all files, including configuration and settings files, get converted, it is often easier to just delete the repository and reaccept the assignment, assuming the error is caught before the student has done too much work...
Steps to Reproduce
At this point, inspecting the Source Control side bar shows all files in the project are currently modified. And all lines in the files are showing modifications that are not visible.
Description
This is more of a user/student installation error than an issue with VSCode or Docker. This happens because, when installing git, students do not correctly specify to keep line endings as they are when checking out files. If an option is selected to convert line endings to Windows style cr/lf, and the student is on a Windows System, all line endings are converted to Windows style when the repository is cloned. The repositories all use unix/linux style line endings. Thus the git diffs shown in Source Control are true, every single line has been modified to change the line ending of the files.
Fix
If this is noticed in a practice assignment, or is noticed by a student before they have done any work on the assignment, you can delete this assignment repository, and fix the git line ending configuration, and then clone the repository again or when the next assignment is done.
Open up a terminal on the host system and change the git configuration to this:
References