I have a git repository containing C# code, and I'm running MSysGit
on Windows.
core.autocrlf
is turned on, and I'm using the .gitattributes
from this question, and I "renormalised" my repo as mentioned at the bottom of this Github guide.
Now for some of the .cs files in my repository, if I change even one character, MSysGit
thinks the whole file has changed.
I cloned the repository fresh. I tried editing the file first in Visual Studio, but then I tried opening it in SciTE which shows me line ending and tab characters, and also I trust it not to do anything weird to the file (like change the encoding).
So, I clone the repository fresh:
$ git clone git clone git@git.assembla.com:my-repo.v2.git
$ cd my-repo/
I check the repository and the file:
$ git status
# On branch master
nothing to commit (working directory clean)
$ git diff path/to/myfile.cs
$
I open the file in SciTE (note that the line endings are CRLF
and there are no tabs):
using System;
using System.Collections.Generic;
...
and change one character (and note that CRLF
and no tabs are still true):
using System;
!using System.Collections.Generic;
...
and now git thinks everything's changed:
$ git diff path/to/myfile.cs
diff --git a/path/to/myfile.cs b/Dpath/to/myfile.cs
--- a/path/to/myfile.cs
+++ b/path/to/myfile.cs
@@ -1,116 +1,116 @@
-<U+FEFF>using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Practices.EnterpriseLibrary.Data;
-using DataModel.Models;
-using DataModel.Mappers.Interfaces;
-using System.Data.Common;
-using System.Data;
...
A normal diff program doesn't think the two files are so different, and git diff
on Unix doesn't think they're too different, but msysgit
does.
Anyone ever encounter this before or have any ideas?