This commit is contained in:
kolam 2023-12-06 21:08:52 +00:00 committed by admin
parent f0c14b0e56
commit db805b1954

View file

@ -1,88 +0,0 @@
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.