I have a case where whereis knows that a file is present in an exporttree remote, but get fails:

joey@darkstar:/tmp/bench/repoclone>git annex whereis bar
whereis bar (1 copy)
    b1a73a91-5f79-4b4b-b838-683e602b2888 -- joey@darkstar:/tmp/bench/repo

  The following untrusted locations may also have copies:
    163219a6-fdc1-4d3e-98a6-7aed3e9d605d -- [dir]
ok
joey@darkstar:/tmp/bench/repoclone>git annex get bar
get bar
  Unable to access these remotes: dir

  Try making some of these repositories available:
    163219a6-fdc1-4d3e-98a6-7aed3e9d605d -- [dir]
    b1a73a91-5f79-4b4b-b838-683e602b2888 -- joey@darkstar:/tmp/bench/repo
failed
git-annex: get: 1 failed
- exit 1

Reproducible with git-annex 7.20181106-g58d1b2510 using this script.

It looks like the export database is not getting updated to reflect the export that was made in the other clone of the repository.

--Joey

Hmm, git annex sync --content complains that there was an export conflict, and unexports bar to resolve it. And indeed, there is a conflict, since export was run in the two different repos without syncing in between.

When there's no conflict, the git annex get does succeed.

So the real problem here is that, during an export conflict, there is no indication in git annex get about why retrival from the export fails.

Also, git annex get --from dir / git annex copy --from dir silently does nothing.

Both turn out to only happen with a directory special remote, because it has checkPresentCheap = True. Other special remotes will fail with "unknown export location", which is not a great error message either but at least hints at the problem.

Made it display a better error message. done

#!/bin/sh
set -e
mkdir /tmp/bench
cd /tmp/bench
mkdir d
git init repo
cd repo
git annex init
echo foo > foo
git add foo
git commit -m add
git annex initremote dir type=directory directory=../d encryption=none exporttree=yes
cd ..
git clone repo repoclone
cd repoclone
git annex enableremote dir directory=../d
set +e
git-annex export --tracking master --to dir
echo "above expected to fail as foo's content is not present"
set -e
cd ../repo
git-annex export --tracking master --to dir
cd ../repoclone
git fetch
git annex whereis foo
git annex get foo
git-annex export --tracking master --to dir

cd ../repo
echo bar > bar
git annex add
git commit -m add
git-annex export --tracking master --to dir

cd ../repoclone
git fetch
git merge
git annex whereis bar
git remote rm origin
git annex get bar