From 3e6dba097ea293f7cb40bb335cf8d2249b39e039 Mon Sep 17 00:00:00 2001 From: kolam Date: Mon, 4 Dec 2023 19:32:28 +0000 Subject: [PATCH] --- ...transfer_repo_not_auto_dropping_files.mdwn | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 doc/forum/transfer_repo_not_auto_dropping_files.mdwn diff --git a/doc/forum/transfer_repo_not_auto_dropping_files.mdwn b/doc/forum/transfer_repo_not_auto_dropping_files.mdwn new file mode 100644 index 0000000000..c429099f5e --- /dev/null +++ b/doc/forum/transfer_repo_not_auto_dropping_files.mdwn @@ -0,0 +1,88 @@ +I'm trying to set up two client repositories that don't communicate directly with one another, but sync their data using a transfer repository. + +Here's the script I used for creating a reproducible environment: + +``` +#/usr/bin/env bash + +# Just a way to access the script's directory +cd "$(dirname "$0")" +DIR="$(pwd)" + +# Create the 1st client repository +mkdir $DIR/client1 +cd $DIR/client1 +git init && git annex init + +# Create the 2nd client repository +mkdir $DIR/client2 +cd $DIR/client2 +git init && git annex init + +# Create the transfer repository +mkdir $DIR/share +cd $DIR/share +git init && git annex init + +# Setup the remotes and groups for the transfer repository +cd $DIR/share +git remote add client1 $DIR/client1 +git remote add client2 $DIR/client1 +git annex group . transfer +git annex group client1 client +git annex group client2 client +git co -b main + +# Setup the remotes and groups for the 1st client repository. +cd $DIR/client1 +git remote add share $DIR/share +git annex group . client +git annex group share transfer +git annex config --set annex.addunlocked true +git co -b main + +# Setup the remotes and groups for the 2nd client repository. +cd $DIR/client2 +git remote add share $DIR/share +git annex group . client +git annex group share transfer +git annex config --set annex.addunlocked true +git co -b main + +# Run git-annex assistant for each repository +cd $DIR/client1 && git annex assistant +cd $DIR/client2 && git annex assistant +cd $DIR/share && git annex assistant + +# Add a single file to the 1st client. +cd $DIR/client1 +touch file.txt + +# Need to do this if there are no commits in the 'client2' and 'share' repositories. +# Or else, I'll get the following logs: +# +# merge: refs/remotes/share/main - not something we can merge +# merge: refs/remotes/share/synced/main - not something we can merge +sleep 3; +cd $DIR/share +git pull client1 main +sleep 3; +cd $DIR/client2 +git pull share main + +cd $DIR/client1 +echo "My first line" >> file.txt +``` + +However, after letting `git-annex assistant` do it's thing, `file.txt` seems to never be dropped from the `share` transfer repository. +Event after running `git-annex sync --content`, the `git-annex whereis file.txt` gives: + +``` +whereis file.txt (3 copies) + 274b3417-1bf3-47b3-a75e-53ebe7ca20d8 -- user@server:~/share [share] + 7cc7d6a8-6230-4d2c-8414-1b45b2fc14d8 -- user@server:~/client2 + bdfea36f-d011-4950-8be0-1668f5e56f5c -- user@server:~/client1 [here] +ok +``` + +The documentation says that the file should be automatically dropped, but that doesn't happen here.