git clone git@github.com:erocarrera/pydot
(35a8d858b) in a Debian with git config core.autocrlf input
shows:
modified: test/graphs/b545.dot
modified: test/graphs/b993.dot
modified: test/graphs/cairo.dot
These files have CRLF line endings, for example:
$ file test/graphs/cairo.dot
test/graphs/cairo.dot: UTF-8 Unicode text, with CRLF line terminators
The .gitattributes
file contains:
*.py eol=lf
*.dot eol=lf
*.txt eol=lf
*.md eol=lf
*.yml eol=lf
*.png binary
*.ps binary
Changing core.autocrlf
has no effect on the status of these files. Deleting the .gitattributes
has no effect either. Changing these files with dos2unix
does not change their status (as expected), and back with unix2dos
shows no difference with diff
versus an older copy. File permissions look unchanged with ls -lsa
. Also, the files have uniform line endings as far as I can tell with vi -b
(thus it shouldn't be the case that unix2dos
or dos2unix
convert from mixed to uniform line endings, which could have explained this strange behavior). I'm using git
version 2.11.0.
What does git
think has changed?
Somewhat relevant:
- Git status shows files as changed even though contents are the same
- Files showing as modified directly after git clone
- Cloning a git repo, and it already has a dirty working directory... Whaaaaa?
I didn't find an answer that explains this behavior during my search over several discussions. This issue arose from pydot
# 163.
In more detail:
git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: test/graphs/b545.dot
modified: test/graphs/b993.dot
modified: test/graphs/cairo.dot
no changes added to commit (use "git add" and/or "git commit -a")
git diff test/graphs/b993.dot
warning: CRLF will be replaced by LF in test/graphs/b993.dot.
The file will have its original line endings in your working directory.
diff --git a/test/graphs/b993.dot b/test/graphs/b993.dot
index e87e112..8aa0872 100644
--- a/test/graphs/b993.dot
+++ b/test/graphs/b993.dot
@@ -1,10 +1,10 @@
-diGraph G{
-graph [charset="utf8"]
-1[label="Umlaut"];
-2[label="ü"];
-3[label="ä"];
-4[label="ö"];
-1->2;
-1->3;
-1->4;
-}
+diGraph G{
+graph [charset="utf8"]
+1[label="Umlaut"];
+2[label="ü"];
+3[label="ä"];
+4[label="ö"];
+1->2;
+1->3;
+1->4;
+}
UPDATE:
Out of curiosity, I committed one of these files, dumped git log -1 -p > diff
, and vi -b diff
shows that git
normalized
1 commit 2021d6adc1bc8978fa08d729b3f4d565f9b89651
2 Author:
3 Date:
4
5 DRAFT: experiment to see what changed
6
7 diff --git a/test/graphs/b545.dot b/test/graphs/b545.dot
8 index ebd3e8f..2c33f91 100644
9 --- a/test/graphs/b545.dot
10 +++ b/test/graphs/b545.dot
11 @@ -1,9 +1,9 @@
12 -digraph g {^M
13 -^M
14 -"N11" ^M
15 - [^M
16 - shape = record^M
17 - label = "<p0>WFSt|1571 as Ref: 1338 D"^M
18 -]^M
19 -N11ne -> N11:p0^M
20 -}^M
21 +digraph g {
22 +
23 +"N11"
24 + [
25 + shape = record
26 + label = "<p0>WFSt|1571 as Ref: 1338 D"
27 +]
28 +N11ne -> N11:p0
29 +}
Other weird observations: git checkout
any of these files after cloning does not have any effect. After the above commit, the file b545.dot
continued to have CLRF line endings in the working directory. Applying dos2unix
followed by unix2dos
didn't make git
think that it has changed (whereas before the commit it did, probably because the committed file had CLRF line endings).