1

I have a GIT repository on a Linux machine where the HEAD commit's SHA1 is let's say 12345abcde. This repository has several subfolders:

  ./
  |-foo
  |  |-bar2
  |-baz

When I clone this repository onto a Windows machine, I get the same history, but a different directory structure:

  ./
  |-foo
  |  |-bar1
  |  |-bar2
  |-baz

The SHA1 of the HEAD commit is the same value: 12345abcde.

How is this possible? I was under the understanding that if the directory structure is different, the commit hash should be different.

bar1 used to exist at one point in history and it got deleted and renamed to bar2. Therefore, the directory structure on the Linux machine is correct.

Has anyone else seen this? Does anyone know why this can occur? I have gone back through history and compared the commit hashes of every single commit on the Windows and Linux machines. They match.

How is this possible?

EDIT:

Version on Windows (MSYSGit) : 1.8.5.2
Version on Linux (Ubuntu 12.04): 1.7.9.5

EDIT2:

After updating the version on Linux to 2.0.0, re-creating the repository 
and doing a clone to Windows, the directory trees and SHA1 hashes are consistent.
However, the SHA1 of HEAD on both Linux and Windows is now different - let's say
`67890defgh`

If somebody has any insight into why this happens, I'd be happy to accept the answer. The fundamental question here is how can different directory structures be created from the same list of commits with the same hashes?

Carl
  • 43,122
  • 10
  • 80
  • 104
  • Different versions of Git? – Giacomo1968 Jun 04 '14 at 00:49
  • They are different, but how would that affect the commit SHAs? – Carl Jun 04 '14 at 01:40
  • Does `bar1` actually have content in it? And what versions of git on both machines? I have seen odd “ghost” folders pop up when jumping between my Mac OS X setup running git 1.8 and Ubuntu running git 1.7. – Giacomo1968 Jun 04 '14 at 01:43
  • Was this a fresh clone on the Windows machine? Is it possible that the file bar1 isn't tracked in the repo? – Wally Altman Jun 04 '14 at 01:47
  • @JakeGould: yes, bar1 has content in it. Funnily enough, I'm running 1.7 too on Ubuntu. WallyAltman: Yes, this was a fresh clone. Just to check I created a bare clone on the Linux machine and fresh cloned that too to the Windows machine. Same result. – Carl Jun 04 '14 at 01:51
  • I should also note that the clone was done over SSH, if it matters. – Carl Jun 04 '14 at 01:52
  • @Carl Can you edit your questions with the versions of Git you are using on Ubuntu as well as Windows? – Giacomo1968 Jun 04 '14 at 01:55
  • Is/was there a Foo/bar1/file, or FOO/bar1, perhaps, on the Linux box? On Windows with case-folding it will wind up in the lowercase version. – torek Jun 04 '14 at 02:49
  • does one machine have a global `gitignore` that is ignoring `bar1`? – M.M Jun 04 '14 at 03:15
  • @torek: At a past point in history yes. But not at HEAD. – Carl Jun 04 '14 at 04:10
  • @MattMcNabb: No. Both machines do not have global git ignores set. Only per repo. – Carl Jun 04 '14 at 04:11
  • Is `bar1` a submodule? (`git ls-files -s|grep ^16`, as in http://stackoverflow.com/a/23976971/6309) – VonC Jun 04 '14 at 06:23
  • No it's not. Just a regular sub folder. – Carl Jun 04 '14 at 07:28

0 Answers0