Skip to content

Conversation

Dirksche
Copy link
Contributor

Still for #791.

I've run: git add --renormalize .

Reason: On some, but not all files, when I try to make changes , Github recognises the whole file as modified.
In the Internet it is recommended to run git add --renormalize . and to create a pull request for the result, after the handling of line endings has changed.
This is what I've done.
There are no actual changes in the files. You can check with Beyond Compare.

I've run: `git add --renormalize .`

Reason: On some, but not all files, when I try to make changes , Github recognises the whole file as modified.
In the Internet it is recommended to run `git add --renormalize .`  and to create a pull request for the result, after the handling of line endings has changed.
This is what I've done.
There are no actual changes in the files. You can check with Beyond Compare.
@Dirksche
Copy link
Contributor Author

@stephanstapel Just a bit more background information about why this pull request is required.
Git identifies files by their hash code. Files with the same hash code are identified as the same file. In order for the replacement of line endings to work, git has to calculate the hash code before it does the replacement of the line endings.

What I want to achieve is, that on the server the files are stored with Unix line endings, but when checked out on a Windows system they are converted to Windows line endings. This is what Git does when "core.autocrlf" is set to "true" (although I'm using "core.autocrlf" set to "false").
There is no problem with files which are already stored on the server with Unix line endings (e.g. "ZUGFeRD/AssociatedDocument.cs". Although on Windows the line endings have been converted to "\r\n", Git deems the file as not modified.

The "problem" is that some developers, who have worked on ZUGFeRD-csharp, don't have "core.autocrlf" set to "true", but to "false" (like me).
This had the effect that some files have been checked into the server with Windows line endings. Those are the files in this commit (e.g. "ZUGFeRD/BankAccount.cs").
Because with the explicit setting of the line ending conversion in ".gitattribute", these files will now be checked in on the server with Unix line endings. This means that the whole file seems to be modified.

This means that currently there's on the server a mixture of different line endings. Some files have Unix style line endings, some have Windows style line endings and some even a mixture.

With git cat-file -p <object> you can extract a file exactly as it is stored on the server.
To demonstrate this, I've done this for above mentioned two files "ZUGFeRD/AssociatedDocument.cs" and "ZUGFeRD/BankAccount.cs". I've used an old copy of your repository, to rule out that my changes have any effect:

git cat-file -p 91b0ca85e09e4c5961c811ce40b664cfb34c5521 >ZUGFeRD/AssociatedDocument_raw.cs
git cat-file -p 402d520e10150abf238f0788d950a5170550254c >ZUGFeRD/BankAccount_raw.cs

When you view the files with e.g. Beyond Compare, you will see that "AssociatedDocument_raw.cs" has Unix style line endings, but "BankAccount_raw.cs" has Windows style line endings:
grafik
grafik

This commit cleans this up, so that on the server all files consistently will have Unix style line endings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant