Closed joverlee521 closed 2 hours ago
Done for seasonal-cov
and yellow-fever
— note that seasonal-cov
had .gitattributes
in .gitignore
so that needed to be adjusted as well; not sure where that came from originally (and didn't try to track it down either...)
@genehack raised a question in the Nextstrain dev chat of whether forcing LF line endings could cause unexpected behavior for Windows users outside of Docker. @victorlin is exploring behaviors with .gitattributes
on a Windows laptop.
I just tried some different scenarios detailed below. Let me know if you can think of other scenarios to test.
TLDR: text files are handled properly with * text=auto eol=lf
or * text eol=lf
. We settled on * text=auto eol=lf
in https://github.com/nextstrain/pathogen-repo-guide/pull/37#discussion_r1543501665
What does a Windows text editor do?
I tested two common editors: Notepad (Windows version 21H1) and VS Code (1.90.2).
.gitattributes
is helpful.What does .gitattributes
do?
From git docs:
These attributes affect how the contents stored in the repository are copied to the working tree files when commands such as
git switch
,git checkout
andgit merge
run. They also affect how Git stores the contents you prepare in the working tree in the repository upongit add
andgit commit
.
This seems to be accurate. Steps done to verify (all commands run on Windows PowerShell):
.gitattributes
) resulted in CRLF on all text files - no good.* text eol=lf
) resulted in LF on all text files. Good!.gitattributes
resulted in CRLF on all text files. Switching branches to latest master
resulted in LF on all text files. Good!* text=auto eol=lf
) resulted in LF on all text files. Good!* text eol=lf
or * text=auto eol=lf
get stored in git as LF upon git add
. They're kept as CRLF locally but a git switch
to a commit without the file then back to a commit that adds the file results in conversion to LF. Good!....and done! 🙌
We had a question Nextstrain office hours where a user was running into an error with the curate rule in the ingest workflow:
@genehack flagged that this is likely an issue with line endings in Slack, which reminded me that we added
.gitattributes
in https://github.com/nextstrain/pathogen-repo-guide/pull/37 for this exact reason!We should propagate the
.gitattributes
file to all the Nextstrain pathogen repos so that Window's users are less likely to run into this error.TODOs
Pathogen repos from https://github.com/search?q=topic%3Apathogen+topic%3Anextstrain&type=repositories
Other pathogen repos:
Following .gitattribute docs to normalize line endings of existing files in repos.