nextstrain / pathogen-repo-guide

3 stars 0 forks source link

Propagate `.gitattributes` to Nextstrain pathogen repos #46

Closed joverlee521 closed 2 hours ago

joverlee521 commented 3 weeks ago

We had a question Nextstrain office hours where a user was running into an error with the curate rule in the ingest workflow:

/usr/bin/env: ‘python3\r’: No such file or directory

@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.

genehack commented 3 weeks 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...)

joverlee521 commented 3 weeks ago

@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.

victorlin commented 3 weeks ago

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).

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 and git merge run. They also affect how Git stores the contents you prepare in the working tree in the repository upon git add and git commit.

This seems to be accurate. Steps done to verify (all commands run on Windows PowerShell):

genehack commented 2 hours ago

....and done! 🙌