1

I'm working in a large corporate enterprise where all the developer machines are Windows 7 Enterprise SP1.

I'm running major migration project from RTC to git (resulting in something like 1200 git repos). There are no Windows servers in the production environment, build or test environments - everything is either Solaris or RedHat. The solution will be rolled out to ~200 developers.

There is generally a push to use more Unix-command line tools and there are a few different alternatives on Windows such as: Cygwin, git-bash, cmder. I have avoided running a full linux VM because that introduces too many other problems (most developers don't have local admin rights and the internet proxy is a constant hassle so I don't want to make networking a bigger problem with NAT).

I've been running Cygwin (mintty 2.6.2) for the past 8 months and it's been ok until today where I hit a very concerning issue with git (v2.8.3) where git status reported a clean working directory even though multiple files and folders had been deleted in the repo. Only after I recreated a folder with the same name as one of the deleted folders did all the deleted files appear correctly with git status.

I'll explain the symptoms and what I was doing but so far I have not reproduced the issue. My suspicion is that the problem lays somewhere between the emulated linux file system and the actual windows file system. Is there any difference in the way the various emulators achieve this?

The specific problem I hit had these symptoms:

Client side:

  1. git status showed a clean working directory
  2. git log showed 3 commits A, B and C (commit C checked out)
  3. The repo contents was one folder containing a file, 2 more files in the root folder, plus the .git folder with contents
  4. git stash list was empty
  5. git branch -a reports only master, HEAD and origin/master

Server side:

  1. The origin contained 13 additional folders, each with one file
  2. The origin also contained commits A, B and C
  3. Only master branch is present

Commit A was the initial empty commit. Commit B was where all contents was added, 14 folders and 16 files. Commit C was another empty commit

Commit A and Commit C were both created using tools to assist with the migration. It runs two commands: "git init" and "git commit --allow-empty -m 'initial commmit'"

I could not understand how git status did not report the deleted files (I remember deleting them, but it was some days previously with multiple computer hibernates, and probably a restart or two from resuming my work)

Trying to figure out what had happened I did this:

  1. I created a new file then ran "git add", "git commit" (creating D) and "git push."
  2. Commit D appeared on the server with the new file. The 13 additional folders and files were still present on the server.
  3. I ran "git pull" which returned "already up to date"
  4. I checked the changes for every commit on the client side and on the server side and every diff was the same
  5. I cloned a new copy of the repo and the contents matched the server with the 13 additional files and folders with the additional commit D and extra file
  6. I then recreated a folder with the same name as one of the deleted folders and ran "git status" where finally all of the deleted files and folders were reported correctly.

I cannot explain this any other way except for a serious bug which simply makes it unsafe to use git in Cygwin. I hope the community may have some advice for me in this area and that this is phrased as a clear enough question that the mods don't flag my post.

I will do my best to try and reproduce the problem and update the issue with more info when I have some.

Edit: Update 2016-12-08

My attempts to reproduce the error have been unsuccessful. If I see it again during my work I will update this issue.

philbert
  • 478
  • 4
  • 15
  • Why don't you just use the native [Git for Windows](http://git-for-windows.github.io/) port? Since some time its development is even backed by the proptietors of Windows™. It comes with `MinTTY` and a port of `bash` for those who like to get more "Unix-like" experience. At the same time it works OK in the native Windows console. – kostix Dec 02 '16 at 13:56
  • @kostix I do have git for windows installed but my git bash runs in an older version of mintty (2.0.6) than in cygwin. My main reason for preferring cygwin is that it was easier to install other tools like tmux + vim. – philbert Dec 06 '16 at 10:15

2 Answers2

1

I've never seen such behaviour with Git on Cygwin. Actually currently I use Git for Windows from within Cygwin and it also works fine. I used to use the Cygwin Git, but I had the feeling that it is slower than Git for Windows, such I switched to Git for Windows used from within Cygwin and it works great.

If you at some point update the Windows boxes to Windows 10, you can also consider another option, the Windows Subsytem for Linux which is an Ubuntu based virutal Linux environment developed by MS together with Canonical. It is still in the process of getting mature and not fully usable yet in my opinion, but there you then have a natively supported virutal Linux environment where you can use apt-get and so on.

Vampire
  • 35,631
  • 4
  • 76
  • 102
1

Issue you mentioned are really unexpected, and I doubt Cygwin can cause it. But you have following options

  • git comes with git bash, which support all major unix commands and it looks completely like unix shell. I am using git version 2.9 on windows 10 and heavily use major unix command like grep, sed & find , and they all work excellent. Even it support vi but I don't use it

  • git comes with git CMD, and same git commands will work on windows command prompt as they do on unix. You shouldn't need a separate emulator with this.

  • Though you mention you are using Windows 7, but now Windows 10 comes with native support for Unix Bash

  • You can use gnuwin32 but I doubt it will be better than Cygwin

  • Thanks for the tip on gnuwin32. I managed to google this helpful answer too: http://stackoverflow.com/questions/10712550/difference-between-gnuwin32-and-cygwin – philbert Dec 06 '16 at 09:29