Created
August 9, 2013 20:41
-
-
Save anonymous/6197019 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
A=`mktemp -d` | |
B=`mktemp -d` | |
GIT_HOOK=post-receive | |
set -e | |
cd $A | |
git init | |
git annex init a | |
# make a commit so we can clone | |
echo dummy > dummy | |
git annex add dummy | |
git commit -m "initial commit" | |
cd $B | |
git clone $A . | |
git annex init b | |
git remote add a $A | |
cd $A | |
git remote add b $B | |
echo "1st file" > file1 | |
git annex add file1 | |
git annex sync | |
cd $B | |
git annex merge | |
if [ -h file1 ]; then | |
echo file1 exists after manual 'git annex merge' | |
else | |
echo file1 does not exist after manual 'git annex merge' | |
fi | |
cat > .git/hooks/$GIT_HOOK <<END | |
#!/bin/sh | |
git annex merge | |
END | |
chmod +x .git/hooks/$GIT_HOOK | |
cd $A | |
echo "2nd file" > file2 | |
git annex add file2 | |
git annex sync | |
cd $B | |
if [ -h file2 ]; then | |
echo file2 exists after 'git annex merge' in $GIT_HOOK | |
else | |
echo file2 does not exist after 'git annex merge' in $GIT_HOOK | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment