Skip to content

Consider enforcing line feeds in .gitattributes #4341

Description

@lukekoch

Description of feature

Enforce line feeds in .gitattributes using settings such as

* text eol=lf

to prevent corruption by core.autocrlf settings.

Background

I recently ran into an edge case likely caused by a misconfigured core.autocrlf setting in git while running nf-core/mag (see the original issue here: nf-core/mag#1050). This caused line endings in a python script to be converted to CRLF in the working tree when nextflow pulled the pipeline (apparently the global git settings apply to nextflow pulls). If the pipeline is run with the apptainer profile (although this might apply to other profiles as well), this corrupts the shebang #!/usr/bin/env python and causes the apptainer to crash. Manual CRLF to LF conversion in the cached repository using dos2unix fixed this issue.

Settings in the .gitattributes file can be used to overrule core.autocrlf to force git (and by extension nextflow) to checkout to LF line endings, preventing this issue.

While this is an edge case, I do not see a scenario in which forced LF line endings would cause issues and therefore request the .gitattributes file be changed accordingly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions