Let's say I have 2 client repos located in my laptop and desktop and a backup repo located in an external drive.
I want the 2 client repos to only want content that is already present in the repo. So I set their preferred content like this:
git annex wanted . "present"
And let's say the 2 client repos already contain the file test.txt.
When I modify test.txt in the laptop repo and run git annex sync --content
, then go to the desktop repo and run git annex sync
,
the behavior I'm expecting is that test.txt in the desktop repo will be updated when sync is run since clients want content that is already present.
However, what happens is that the file test.txt in the desktop repo is dropped.
Is this the expected behavior when using present
in the preferred content expression?
How can I have the modified content in a client repo automatically copied via git annex sync --content
to another client repo when the preferred content for the client group is to only want content that is already present?
The preferred-content expression
present
operates on the content of a file, not on the file name. So when you modifytest.txt
on laptop, thentest.txt
now links to the new content (say content2). When you sync, desktop sees thattest.txt
now links to content2, content2 is not present on desktop so on your desktoptest.txt
now links to content that isn't there, IEtest.txt
shows as not present on your desktop. But your old content, say content1 is still present on your laptop and desktop if you were to checkout previous versions of git. Nothing was actually dropped anywhere (I don't think) but the new content (content2) was just not wanted on your desktop since it was never present there.I don't think what you are trying to achieve is currently possible with git-annex in the general case. But, for 2 repos you could just do:
git annex wanted . "copies=2"
. This will mean that anytime you create a new version of a file (new content) on one machine that content will be wanted on the other machine as well to increase the copy count to 2.