cygwin git status and tortoise git commit show different changes

2

On my Win7 Pro 64-bit machine I have TortoiseGit and cygwin with git. If I try to find the pending changes I do get different results from cygwin and TortoiseGit. I'm sure the result of cygwin git is wrong.

Why does git on cygwin report all this files as changed even if I did not touch them?

Output of TortoiseGit (correct): TortoiseGit Output

Output of cygwin git (wrong):

$git status
# On branch 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:   .classpath
#   modified:   .gitignore
#   modified:   belipro.xml
#   modified:   etc/buildnum.properties
#   modified:   etc/db/adjust.sql
#   modified:   etc/db/update11.sql
#   modified:   etc/db/update12.sql
#   modified:   etc/excel-template/Anlagen.xls
#   modified:   etc/projektierbareTemplaes/templateA.rtf
#   modified:   etc/test/belipro.sql.zip
#   modified:   lib/commons-lang-2.6.jar
#   modified:   lib/jacob-1.14.3-x86.dll
#   modified:   lib/jacob.jar
#   modified:   res/ch/pp/belimed/bo/planung/ArbeitsStundenResourcePack.java
#   modified:   res/ch/pp/belimed/bo/planung/AufgabeAuftragResourcePack.java
#   modified:   res/ch/pp/belimed/bo/planung/AufgabeResourcePack.java
#   modified:   res/ch/pp/belimed/bo/planung/arbeitsstunden 32x32.png
#   modified:   res/ch/pp/belimed/bo/planung/arbeitsstunden 64x64.png
#   modified:   res/ch/pp/belimed/bo/planung/aufgabe 32x32.png
#   modified:   res/ch/pp/belimed/bo/planung/aufgabe 64x64.png
#   modified:   res/ch/pp/belimed/bo/planung/aufgabeauftrag 32x32.png
#   modified:   res/ch/pp/belimed/bo/planung/aufgabeauftrag 64x64.png
#   modified:   res/ch/pp/belimed/bo/projekt/DruckbehaelterResourcePack.java
#   modified:   res/ch/pp/belimed/bo/projekt/EldResourcePack.java
#   modified:   res/ch/pp/belimed/bo/projekt/WtdResourcePack.java
#   modified:   res/ch/pp/belimed/bo/projekt/druckbehaelter 32x32.png
#   modified:   res/ch/pp/belimed/bo/projekt/druckbehaelter 64x64.png
#   modified:   res/ch/pp/belimed/bo/projekt/eld 32x32.png
#   modified:   res/ch/pp/belimed/bo/projekt/eld 64x64.png
#   modified:   res/ch/pp/belimed/bo/projekt/projektierbar 32x32.png
#   modified:   res/ch/pp/belimed/bo/projekt/projektierbar 64x64.png
#   modified:   res/ch/pp/belimed/bo/projekt/wtd 32x32.png
#   modified:   res/ch/pp/belimed/bo/projekt/wtd 64x64.png
#   modified:   res/ch/pp/belimed/bo/util/BatchResourcePack.java
#   modified:   res/ch/pp/belimed/bo/util/TypResourcePack.java
#   modified:   res/ch/pp/belimed/explorer/BeliproExplorerComponentFactoryResourcePack.java
#   modified:   res/logging.properties
#   modified:   src/ch/pp/belimed/bo/planung/Aufgabe.java
#   modified:   src/ch/pp/belimed/bo/planung/AufgabeAuftrag.java
#   modified:   src/ch/pp/belimed/bo/planung/Auftrag.java
#   modified:   src/ch/pp/belimed/bo/planung/InternerAuftrag.java
#   modified:   src/ch/pp/belimed/bo/planung/Meilenstein.java
#   modified:   src/ch/pp/belimed/bo/planung/MeilensteinTyp.java
#   modified:   src/ch/pp/belimed/bo/planung/MitarbeiterAuftrag.java
#   modified:   src/ch/pp/belimed/bo/planung/Planung.java
#   modified:   src/ch/pp/belimed/bo/planung/Sammelauftrag.java
#   modified:   src/ch/pp/belimed/bo/projekt/ProjektStatus.java
#   modified:   src/ch/pp/belimed/bo/util/Batch.java
#   modified:   src/ch/pp/belimed/bo/util/Bezeichnung.java
#   modified:   src/ch/pp/belimed/explorer/BeliproExplorerComponentFactory.java
#   modified:   src/ch/pp/belimed/ui/planung/AufgabeSearchPanel.java
#   modified:   src/ch/pp/belimed/ui/planung/InternerAuftragDetailPanel.java
#   modified:   src/ch/pp/belimed/ui/planung/MitarbeiterAuftragDetailPanel.java
#   modified:   src/ch/pp/belimed/ui/planung/MitarbeiterDetailPanel.java
#   modified:   src/ch/pp/belimed/ui/projekt/AnlageSearchPanel.java
#   modified:   src/ch/pp/belimed/ui/projekt/KundeSearchPanel.java
#   modified:   src/ch/pp/belimed/ui/projekt/PlanungAssigner.java
#   modified:   src/ch/pp/belimed/ui/util/BatchDetailPanel.java
#   modified:   src/ch/pp/belimed/util/DbVersion.java
#   modified:   src/ch/pp/belimed/util/ReleaseInfo.java
#   modified:   src/ch/pp/util/DateUtils.java
#   modified:   test/ch/pp/belimed/bo/planung/AufgabeTest.java
#
no changes added to commit (use "git add" and/or "git commit -a")

BetaRide

Posted 2011-04-22T09:33:21.193

Reputation: 2 099

Answers

3

I'd suspect line endings. If Tortoise git works like other native Windows version control clients, it automatically adds carriage returns to checked-out files, and knows to remove them again when comparing against files in the repository. Cygwin git, being a good Unix citizen, doesn't do anything like that, so it sees those carriage returns that Tortoise added as modifications.

Moral of the story: for any particular checkout, stick to either Tortoise git or Cygwin git, otherwise you'll end up with an awful mix of line endings. Another reason not to mix clients is that they might have differences in how they store stuff in the .git directory.

(Much the same advice applies to other version control systems.)

ak2

Posted 2011-04-22T09:33:21.193

Reputation: 3 387

This is outdated, see http://superuser.com/a/975576/353744

– MrTux – 2015-09-20T12:15:42.140

I'm pretty sure, that this is not the problem. If this would be true, than all files would be marked as changed. But it's only a small subset of ~2000 files. – BetaRide – 2011-04-22T11:10:26.523

Fair enough, but it would have been helpful to mention that fact in the question. This still leaves the possibility of incompatibilities in the .git format. What differences does Cygwin git actually think there are though, i.e. what does the output of git diff look like? – ak2 – 2011-04-22T11:30:25.473

@BetaRide, depending on what line endings that set of files were checked in with and the local setting of autocrlf, it could still be possible to have erroneous whitespace changes show up as ak2 suggests. However as you have binary files in this mix, this is probably not the problem. – RJFalconer – 2011-04-23T07:27:07.457

4

I initially thought whitespace, but you have some .pngs in there too.

Perhaps it's file mode changes. Try;

git config core.filemode false

If that doesn't work and if the only difference is the change timestamp, you could try;

git config core.trustctime false

(Of course you can undo either of these by repeating the command changing false to true)

RJFalconer

Posted 2011-04-22T09:33:21.193

Reputation: 9 791

2Setting core.filemode to false worked for me. I was having problems with cygwin incorrectly reporting modified files that cygwin itself cloned, fwiw. – Garrett – 2011-07-13T16:44:28.183

1

TortoiseGit < 1.8.13.0 did not support Cygwin Git. You need a newer version.

1) Select the [CYGWIN-INSTALL-PATH]\bin-folder as git.exe folder.

2) Configure the HOME environment variable in Windows, so that Cygwin and TortoiseGit are using the same home directory and global git-config. Use the normal Windows notation here (e.g., "C:\Users\USERNAME"). By default, TortoiseGit uses the Windows home directory which is normally located under c:\Users and Cygwin uses its own home directories which are located under [CYGWIN-INSTALL-PATH]\home.

3) Configure AutoCrLf, this is necessary as TortoiseGit and Cygwin Git have different defaults. The default in Cygwin Git is true.

4) Go to TortoiseGit the section called “Advanced Settings” and set CygwinHack to true in order to activate cygwin workarounds.

5) Reboot.

Based on https://tortoisegit.org/docs/tortoisegit/tgit-dug-settings.html and https://tortoisegit.org/issue/56

MrTux

Posted 2011-04-22T09:33:21.193

Reputation: 359

Step #4 is crucial, that's what fixed the problem for me (probably because I've already did the other steps since that's how I remembered it) – Gene Pavlovsky – 2016-10-03T01:07:00.807