1

Hello i have a little project that i manage with git and gitlab.

I now ran into a weird problem that git recognise a changed file two times in the current directory but sees a change in another folder which weirdly points to the same location. Its hard to explain so i show:

Sebastian-Scholzs-MacBook-Pro:Anleitung Sebastian$ pwd
/Users/Sebastian/Projekte/Arbeit/Spreeakademie/test/hochbeete/Bankbeet/Pläne/Anleitung

Sebastian-Scholzs-MacBook-Pro:Anleitung Sebastian$ ls -l
total 3672
-rw-r--r--    1 Sebastian  staff  1334587 18 Feb 20:46 Anleitung.pdf
-rw-r--r--    1 Sebastian  staff     2811 18 Feb 20:53 Bauanleitung.md
-rw-r--r--    1 Sebastian  staff   487104 18 Feb 20:46 Bauanleitung.pdf
-rw-r--r--    1 Sebastian  staff    50168 18 Feb 20:46 Bauanleitung.sla
drwxr-xr-x  299 Sebastian  staff     9568 18 Feb 20:46 Bilder
drwxr-xr-x   10 Sebastian  staff      320 18 Feb 20:46 Videos

Sebastian-Scholzs-MacBook-Pro:Anleitung Sebastian$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Bauanleitung.md
    modified:   ../../Pläne/Anleitung/Bauanleitung.md

no changes added to commit (use "git add" and/or "git commit -a")

You already see here that the file Bauanleitung.md is mentioned as modified two times. Both paths point to the same file on the disk...

Sebastian-Scholzs-MacBook-Pro:Anleitung Sebastian$ git add Bauanleitung.md

Sebastian-Scholzs-MacBook-Pro:Anleitung Sebastian$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   Bauanleitung.md

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   ../../Pläne/Anleitung/Bauanleitung.md

Staging the first file will not stage the second which in fact is the same file. What could be the root of the issue? Can i repair it or... should i burn it with fire?

i also noticed after pushing to my gitlab remote, that there are now two folders.Pläne/Anleitung/ contains the Bauanleitung.mdwhile

GITLABREMOTE

Also in the commit it showes that the two files also have the same index

enter image description here

  • 1
    I am guessing you have run into the same problem I outline in footnote 2 in [this answer](https://stackoverflow.com/a/66254147/1256452), though in this case with the `ä` character. If that's true, well, these things are very hard to deal with on macOS. Bring up a Linux VM and inspect the repository there. – torek Feb 18 '21 at 21:58
  • Hm, yea i had a feeling in the back of my mind that this could be the case. Can this break anything in the future? Since i am alone on this project and i really care just about keeping track of changes and using issues in gitlab for projectmanaging i would just rename the folder like `git mv Pläne Plaene` then the problem is present in the history but i dont really care... maybe it happended because gitlab internally runs on linux and when i changed files in the gitlabUI and pulled them afterwards it had a different kind of `ä` in it – Sebastian Scholz Feb 18 '21 at 22:15
  • If you never go back to the old commits, they won't hurt you on the Mac. (But remember that things like `git merge` work back through the commit history to find the merge base: that might be back in the old commits...) I would be unsurprised if the GitLab UI did that, too—it's so easy for this kind of thing to happen! – torek Feb 18 '21 at 23:40
  • FWIW : you can use `git ls-tree` to see what paths are stored within git. For example : `git ls-tree -r --name-only | grep -i Bauanleitung.md`. To confirm that the problem comes from two encodings of `ä`, check the hexdump of previous command : `... | hd` – LeGEC Feb 19 '21 at 09:26

0 Answers0