Skip to content

Git's autocrlf-true interacts badly with cargo rewriting the lockfile #2076

Closed
@gkoz

Description

@gkoz

If git has core.autocrlf=true (a reasonable thing on Windows) it checks out Cargo.lock with CRLF line endings. The next time cargo touches the file, it changes the line endings to LF making git think that it has changed.

Some possible solutions/remedies:

  • preserve the line endings in Cargo.lock (perhaps not exactly preserve but detect the kind from the first line);
  • in cargo new --bin create .gitattributes with the line Cargo.lock eol=lf;
  • document this issue somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions