Skip to content

Adding tracked files is triggering warnings of eol normalization on Windows #473

Closed

Description

@shana

When adding files that are tracked by git lfs on Windows with the version of git that is shipped with the windows app (1.9.5), I'm getting warnings about line ending normalization.

I've confirmed that .gitattributes contains -crlf for all the file types git lfs is tracking, but this setting is being ignored, apparently. If I change it to -text (which the docs say is what -crlf translates to), I don't get the normalization warnings when adding files.

I'm worried that this means files might be corrupted if they're checked out on non-Windows systems. -crlf exists for compatibility reasons, according to the docs. Maybe this particular version of git doesn't support it anymore (or is broken for this particular flag)? I haven't tested later versions on git on windows so I'm not sure if this also happens on later versions (but seeing as the github for windows app ships with this version and will likely ship with it for a while longer, if this is really broken then it's going to be a potential big problem).

tldr; should probably switch to -text for the .gitattributes template, since that flag is supported on all modern git versions that git lfs runs on :P

Activity

  1. technoweenie commented on Jul 9, 2015

    @technoweenie
    Contributor

    Hey @shana, thanks for reporting. #475 is a simple PR that fixes it. But, it only fixes it for new uses of git lfs track. I'm not yet sure how to handle legacy .gitattributes, or old files already committed using the old -crlf flag. I could have git lfs track commands that look for and automatically fix these old lines. Or, it could be an explicit command that people run, in case some people want to configure how the filters run. Any thoughts?

    At the least, #475 in its current state will be merged for the v0.5.3 release.

  2. shana commented on Jul 9, 2015

    @shana
    Author

    @technoweenie yeah, I'm not sure how to handle existing files either. If they've been committed with bytes changed, then new clones will get corrupted files and existing clones would have to fix the attributes and then re-commit the files to make sure things are ok.

    I think maybe we need to figure out if it is really changing the bytes, or if it's just spewing the warnings but not doing anything. If it's not corrupting files, then updating the attributes automatically is probably fine. If it is corrupting things, then maybe we need to figure out a process for people to fix their repos.
    I haven't run a specific test to see if files are getting mangled, I can do that tomorrow morning (have to run out now) and then we can figure out a course of action, make sense?

    When is v0.5.3 coming out?

  3. technoweenie commented on Jul 9, 2015

    @technoweenie
    Contributor

    @shana: I was hoping to get it out this week. Your help with the testing would be very appreciated. I don't mind holding the release back to get this in. Or we can just ship 0.5.3, and then 0.5.4 a week or so later. This release is just a bunch of small fixes or minor features: #425. Most of those are done in master, but not backported to the 0.5 release branch yet.

  4. shana commented on Jul 9, 2015

    @shana
    Author

    @technoweenie Cool. I'll run tests in the morning (cest) and let you know how it goes, maybe we're lucky and it's just bad warnings :-P

  5. technoweenie commented on Jul 9, 2015

    @technoweenie
    Contributor

    If you check my PR, I found a better way to specify attributes using a custom macro:

    [attr]lfs filter=lfs diff=lfs merge=lfs -text
    *.gif lfs
    *.jpg lfs
    
  6. shana commented on Jul 10, 2015

    @shana
    Author

    I ran some tests with crlf and lf across windows and mac, and although it always says it will replace things, it never actually does. md5sum matches on all files on both systems (and on the lfs-test-server cache) with mixed line endings and changing them on both OSs.

    So looks like this is just a case of misleading warnings on Windows.

    That macro looks great, so much cleaner than the long line of stuff 😄

  7. technoweenie commented on Jul 10, 2015

    @technoweenie
    Contributor

    Thanks for confirming. I'll worry about the macro in the next major release of Git LFS. The current git lfs track command thinks the macro is another tracked file. I want to add the new macro, and have some command to update old gitattributes entries.

  8. shana commented on Jul 10, 2015

    @shana
    Author

    @technoweenie Sounds good ✨ 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions