0

I have some (binary) files which I recently added (as LFS files) to a project, everything is committed and pushed (to GitLab, not sure if that's relevant) from my home machine. There I run git status and see that everything is up-to-date. I then sync (via rsync over ssh) the entire repo to another machine, but find that there, git status reports that the files differ:

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:   pkg/site-cs/src/cs-dem.grd

and for git diff

diff --git a/pkg/site-cs/src/cs-dem.grd b/pkg/site-cs/src/cs-dem.grd
index 9d52a1f..1c86687 100644
Binary files a/pkg/site-cs/src/cs-dem.grd and b/pkg/site-cs/src/cs-dem.grd differ

Running md5sum on the file gives the same result on both machines. If I run

git revert pkg/site-cs/src/cs-dem.grd

on the remote machine, then the md5sum no longer matches that on my home machine, but the remote machine's git reports that this file is now not modified.

I'm a bit baffled by this seeming inconsistency. Does anyone have an explanation (even better, a fix).

[edit]

Oh even stranger, on the remote machine after the sync

> ls -l pkg/site-cs/src/cs-dem.grd
-rw-rw-r-- 1 jjg jjg 652304 Jan 13 00:09 pkg/site-cs/src/cs-dem.grd

> hd pkg/site-cs/src/cs-dem.grd | head
00000000  43 44 46 01 00 00 00 00  00 00 00 0a 00 00 00 02  |CDF.............|
00000010  00 00 00 01 78 00 00 00  00 00 01 e1 00 00 00 01  |....x...........|
00000020  79 00 00 00 00 00 01 51  00 00 00 0c 00 00 00 05  |y......Q........|

> git checkout pkg/site-cs/src/cs-dem.grd

> ls -l pkg/site-cs/src/cs-dem.grd
-rw-rw-r-- 1 jjg jjg 131 Jan 15 12:03 pkg/site-cs/src/cs-dem.grd

> cat pkg/site-cs/src/cs-dem.grd
version https://git-lfs.github.com/spec/v1
oid sha256:8ccf1b5183566dd44d05bcec97940bc70c0a7b348a07c2e659c0d64db0db253e
size 652304

which is the LFS pointer file, and now ls-files incorrectly reports the file size.

> git lfs ls-files -d
filepath: pkg/site-cs/src/cs-dem.grd
    size: 652304
checkout: false
download: true
     oid: sha256 8ccf1b5183566dd44d05bcec97940bc70c0a7b348a07c2e659c0d64db0db253e
 version: https://git-lfs.github.com/spec/v1

What I find puzzling is how two identical copies of the repo behave differently, as if there is some state held exterior to them.

Both machines have the git-lsf executable on the path.

jjg
  • 907
  • 8
  • 18
  • 1
    It could be that there's some line-ending magic happening, especially if your repository does *not* have a `.gitattributes` file with a strict configuration and `cs-dem.grd` is auto-detected as a text file. Then the (user- or site-wide) git configuration of the two machines could differ in a way to expect different outcomes. – Joachim Sauer Jan 15 '20 at 10:16
  • My `.gitattributes` has `pkg/site-*/src/*-dem.grd filter=lfs diff=lfs merge=lfs -text`, which I think is right. I'd not though of per-user or global settings, will investigate -- thanks – jjg Jan 15 '20 at 10:33

0 Answers0