New bug "sync does not commit with alwasycommit = false"

This commit is contained in:
http://svario.it/gioele 2014-07-12 10:59:49 +00:00 committed by admin
parent 2f54ec7727
commit 68455bbe4e

View file

@ -0,0 +1,85 @@
### Please describe the problem.
The documentation of `git annex sync` states
> The sync process involves first committing all local changes, then fetching and merging […]
> You can use standard git commands to do each of those steps by hand, or if you
> don't want to worry about the details, you can use sync.
The documentation of `alwasycommit` states
> By default, git-annex automatically commits data to the git-annex branch after each
> command is run. To disable these commits, set to false. Then data will only be
> committed when running `git annex merge` (or by automatic merges) or `git annex sync`.
In fact, however, `git annex sync` will not commit or will not commit some pieces of information when `alwasycommit` is false. This leads to various problems, the first of which is that cloned repositories do not have information about the other remotes.
It is hard to work around this problem because `git commit` cannot be used in direct mode.
This problem does not show up when using local, non over-the-network, remotes.
### What steps will reproduce the problem?
The following script (available at <https://gist.github.com/gioele/5ffeff8988a535164e5b>) will reproduce this problem. If you do not have SSH running on localhost, you can change the `h` variable to point to another host.
#!/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?
### What version of git-annex are you using? On what operating system?
git-annex version: 5.20140708-g8c9c55c on Ubuntu 12.04.4