Skip to content

Instantly share code, notes, and snippets.

@gioele
Last active August 29, 2015 14:03
Show Gist options
  • Save gioele/5ffeff8988a535164e5b to your computer and use it in GitHub Desktop.
Save gioele/5ffeff8988a535164e5b to your computer and use it in GitHub Desktop.
git-annex repositories not seen when using sync without alwayscommit
#!/bin/sh -x
set -e ; set -u
export LC_ALL=C
h=${h:-localhost}
dr="/tmp/annex"
chmod a+rwx -R pc1 pc2 || true
rm -Rf pc1 pc2
# create central git repo
ssh $h "chmod a+rwx -R ${dr}/Docs.git" || true
ssh $h "rm -Rf ${dr}/Docs.git"
ssh $h "mkdir -p ${dr}/Docs.git"
ssh $h "cd ${dr}/Docs.git ; git init --bare"
d=$(pwd)
# populate repo in PC1
mkdir -p pc1/Docs
cd pc1/Docs
echo AAA > fileA
echo BBB > fileB
git init
git config annex.alwayscommit false # change to true to solve this problem
git remote add origin $h:$dr/Docs.git
git fetch --all
# simulate a host without git-annex
git config remote.origin.annex-ignore true
git annex init "pc1"
git annex info
git annex direct
git annex sync origin
git annex add .
git annex sync
# re-create repo on PC2
cd $d
mkdir -p pc2
cd pc2
git clone $h:$dr/Docs.git
cd Docs
git config remote.origin.annex-ignore true
git annex init "pc2"
git annex direct
git annex info
# git annex info shows only pc2, shouldn't pc1 be there as well?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment