Results 1 to 13 of 13

Thread: Github corrupted FRM file, what settings do you have in .gitattributes?

Threaded View

  1. #10
    New Member
    Join Date
    Jul 2020
    Posts
    15

    Re: Github corrupted FRM file, what settings do you have in .gitattributes?

    Thanks wqweto for the shout-out and yereverluvinuncleber for considering using the .gitattributes template I'm providing.

    However, I just want to clarify something: The main template I'm providing will work well for newly created projects and should ensure that line endings are never a worry as long as the template was there from the begining. Regarding existing projects where commit were already made while * text=auto was enabled, it's not as simple. In that case, you'll have to perform a second step after using the template: line normalization for your code files. Otherwise, they will keep the LF line endings on GitHub, the Git Index and your working directory (after cloning).

    You can double-check that what I'm saying is correct by re-cloning the project and running the following command in the console:
    Code:
    git ls-files --eol
    You'll see that "i/lf" means that the corresponding file has LF endings in the index and "w/lf" would mean that a file has LF endings in the working directory.
    If I clone Steampunk-clock-calendar-vb6 at the moment, that what I get for most code files.

    Now to perform line normalization, there are multiple options. Namely, you can use fafalone's GitHub Linebreak Repair tool, my GitHub Action named Enforce-CRLF or a simple PowerShell script like this:

    Code:
    Get-ChildItem -Recurse -Include *.cls,*.bas,*.frm, *.vbs, *.ctl, *.dsr, *.dob, *.pag, *.vbg, *.vbl, *.vbp, *.vbr, *.vbw | ForEach-Object {
        (Get-Content $_.FullName -Raw) -replace "`r?`n", "`r`n" | Set-Content $_.FullName -NoNewline
    }
    And if you don't want to go through line normalization, you can always use the secondary template I'm providing which is similar to what you had above that you said was working:
    https://github.com/DecimalTurn/VBA-o....gitattributes

    The only downside of the secondary template is that GitHub will serve files with LF line endings if people try to download single files using the GitHub download button. For a large project where people usually perform a full clone of the repo or download the whole repo as a zip file, the risk is minor, but if you take the time to perform line normalization across the board and use the main template, this will never be an issue.
    Last edited by DecimalTurn; May 8th, 2025 at 08:03 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width