I have an old repository, and I'm not sure what I have done with it, but it seems to be broken in an interesting fashion.
$ ls -l pix/image001.jpg
lrwxrwxrwx 1 la la 187 Sep 5 11:31 pix/image001.jpg -> ../.git/annex/objects/G7/J7/SHA256-s99372--0458b0b72b394a719b72032971b880a8dfafa65e8048ec6fc6c861fc3ea5e702/SHA256-s99372--0458b0b72b394a719b72032971b880a8dfafa65e8048ec6fc6c861fc3ea5e702
$ ls -lL pix/image001.jpg
ls: cannot access pix/image001.jpg: No such file or directory
$ find .git/annex/objects/ -type f -name '*0458b0b72*'
.git/annex/objects/477/75c/SHA256-s99372--0458b0b72b394a719b72032971b880a8dfafa65e8048ec6fc6c861fc3ea5e702/SHA256-s99372--0458b0b72b394a719b72032971b880a8dfafa65e8048ec6fc6c861fc3ea5e702
$ git config annex.version
5
So the symlinks use a layout where index directories have two-letter names, but the actual layout in the annex uses directory names with three hexadecimal digits.
Is there some straightforward way to fix this or do I need to figure the index format and hack up a script to convert the annex repository?
I think I figured it out: the repository was originally bare, and I converted it to non-bare manually. But that doesn't work, because bare annex repositories use a different directory layout.
I can understand why the hex-based layout is preferred (it's more portable), but deliberate incompatibility with the symlinks isn't very nice. I wish there was a way to upgrade the entire repository to a format that used the hex paths for symlinks, so bare and non-bare repositories used the same layout.
I wish this incompatibility didn't exist either, but the transition to use consistently 3 letter hash directories would be too much to ask of all the users. And there are ways to convert a bare to non-bare that don't have this problem, like making a clone and using
git annex move --all --from origin
There's an easy way to finish your conversion from bare to non-bare. Just move .git/annex/objects to old-objects, and run
git annex add old-objects --backend=SHA256
. That will rename all the files into the right places for a non-bare repository, so your existing symlinks will work. You can thenrm -rf old-objects
to clean up.Note that method assumes that SHA256 is the backend of everything in that repo. If not, it gets a bit trickier; you'd need to use `git-annex setkey'