user4695271
user4695271

Reputation:

Git doesn't recognize that files don't have changes

I have two files that are showing up as "modified" even when they are not; the reason I'm sure is because if I clone the repository, there shouldn't be any changes related between the remote and local. Isn't it?

Now, I know I have a .gitattributes file:

#
# Set the default behavior, in case people don't have core.autocrlf set
* text eol=lf

#
# Denote all files that are truly binary and should not be modified
*.gif binary
*.ico binary

...that's imposing the line-ends to LF (UN*X), and I know my files are CRLF (Windows), but again, there shouldn't be any differences between them when I clone the repo from the very first time, although I know that file, at checkout imposes it.

So, is there any way I can tell .gitattributes NOT to care about several files, something like:

src/main/resources/db/migration/V1__sample01.sql text eol=crlf

NOTE: I can't delete the files and recreate them because I'm using Flyway and it does recognize if the files are changed just by merely changing the line ends.


UPDATE: I wasn't able to specify that per file (as a work-around); anyway, now I'm able to change those files into LF since we upgraded to Flyway 4.X and it doesn't check file checksums anymore.

Upvotes: 1

Views: 408

Answers (1)

VonC
VonC

Reputation: 1324258

As explained in "Dealing with line endings (Windows)", the .gitattributes directives will be applied on checkout.

So either accept the lf conversion (git add ., git push) in order to have all text files with LF EOL.

Or remove the * text eol=lf directive from the .gitattributes files, add just this file, push it, and clone again the repo to check that no file is changed on checkout.

Upvotes: 0

Related Questions