Please describe the problem.
Using adb special remote import/export corrupts all symlinks in main repo (by replacing them by plain text files).
What steps will reproduce the problem?
Primary annex repo contains an absolute symlink to another annex repo (or whatever). Exporting it through adb replaces it by plain text file (as android FS abstraction does not support symlinks). Importing from adb copies that plain text file and deletes symlink already present in the repo, treating it as a new file modified by user.
What version of git-annex are you using? On what operating system?
git-annex version: 8.20211118-g23ee48898
Please provide any additional information below.
Possible solutions:
1) if PC repo contains symlink -- continue to export it as a plain text file (less changes). But on "import" compare its size with symlink size, and then compare content. Don't do anything if they are the same. Cavet: user won't be able to intentionally replace symlinks by plain files on remote. Too esoteric usecase to consider.
2) resolve symlink on PC and export actual file to android (probably most preferred workflow?). But on "import" compare its size against followed symlink file size, and then its content. Don't do anything if they are the same. Replace symlink by actual file if they differ.
This is not adb specific. No special remotes support preserving symlinks (except for git-annex object links). Reproduced using a directory special remote.
Probably export/import should somehow skip symlinks.
Probably skipping symlinks for both import/export is for the best.
My personal expectations (pipe dream?) are to export symlinks as real files -- but only compare during import and warn if different.
Because if I see file/symlink in some repo -- it's placed there for a reason, and after sync I expect to find all the expected files in their folders (even if through multiple copies). Silently ignoring of symlinks forces me to remember to check that whatever I want to sync does not contain them. Otherwise I may be in a very delicate situation, if files needed for work were not synced to phone and I have no access to PC at that moment
On the other hand, I remember literally months I spent debugging and configuring samba, and reading their history of symlinks implementations. It contains so much frustrating corner cases, that banning symlinks completely isn't a bad idea, actually.
The only special remotes that could probably even support symlinks in theory are adb and directory, and those only sometimes.
Supporting them would complicate the special remote API, and I feel unncessarily so.