Though cp preserves permissions, those files may be "locked", meaning they are in their symlinked, uneditable state. Before I realized I could just use cp, I wrote a Python program that uses os.walk to copy one file at a time: since that knows about git annex, it gets this correct: it runs rsync -ptgo -dirs to copy directories and cp -Ll and cp -Pl on non-directory annexed files and other non-directory files respectively (the program is entangled a bit with utility code and not carefully tested so I won't post it here). It surprises me that rsync isn't able to replicate this behaviour, but as far as I can tell, it can't.Īny non-annexed symlinks that are either untracked or checked in to git directly will be replaced with whatever files they point to (but I suspect I won't have any). This will quickly copy the files while (sort of) preserving permissions, ownership, timestamps, and hard linking so as not to use more space (as long as the copy is on the same filesystem): git entirely) 3) if desired, switch the original repository to "indirect" mode again.Īlternatively, after switching to direct mode, simply remove the. So if you want to clone the whole file tree, you can 1) switch the repository to "direct" mode 2) hardlink all files using rsync (excluding. The files still remain tracked by git-annex v5 direct mode merely changes how the local checkout is done, so it may be the fastest method because it doesn't actually write new data into Git. This command converts the entire working tree at once. This moves all files out of the object store and exposes them directly, without links. while being at the root of your repository, and all files will be extracted.īut in a v5 format git-annex repository, you have another option: Switch to "direct" mode using git annex direct. The command operates recursively, so you can just run git annex unannex. Git annex's own commands for "unannexing" (such as git annex uninit) are limited: in particular they do not well support quickly turning a git annex repository into a plain directory of files. I tried rsync's -link-dest, like this: rsync -rLptgoD -safe-links -exclude='.git/' -link-dest=annex annex/ copyīut that doesn't produce hard links, presumably because the presence of the symlinks means that rsync doesn't know which files to hard link to. How can I copy a directory of files, de-referencing symlinks, but hard linking to the referents of the symlinks? To save space until I remove the original annex directory, I want the file foo to be a hard link to. What I want is a command to take an annexed repository like that above and create a new directory containing just the (unsymlinked) files: in this case, just the single file foo. git directory would also remove all the actual file content! Lrwxrwxrwx 1 me me 178 Jan 6 15:10 foo ->. Initialised empty Git repository in /tmp/annex/.git/ All "annexed" files are actually symlinks into. I'm experimenting with git annex, and before I import too much to git annex I'd like to figure out how to quickly blow away the "annexed" git repository without losing my annexed file content and its directory structure.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |