Skip to content

Instantly share code, notes, and snippets.

@gioele
Last active August 29, 2015 14:04
Show Gist options
  • Save gioele/dde462df89edfe17c5e3 to your computer and use it in GitHub Desktop.
Save gioele/dde462df89edfe17c5e3 to your computer and use it in GitHub Desktop.
git-annex whereis does not work in direct mode
+ set -e
+ set -u
+ export LC_ALL=C
+ direct=true
+ h=localhost
+ dr=/tmp/annex
+ sync=sync -c annex.alwayscommit=true
+ chmod a+rwx -R pc1 pc2
+ rm -Rf pc1 pc2
+ ssh localhost chmod a+rwx -R /tmp/annex/Docs.git
+ ssh localhost rm -Rf /tmp/annex/Docs.git
+ ssh localhost mkdir -p /tmp/annex/Docs.git
+ ssh localhost cd /tmp/annex/Docs.git ; git init --bare
Initialized empty Git repository in /tmp/annex/Docs.git/
+ pwd
+ d=/home/gioele/Temp/annex
+ mkdir -p pc1/Docs
+ cd pc1/Docs
+ echo AAA
+ echo BBB
+ git init
Initialized empty Git repository in /home/gioele/Temp/annex/pc1/Docs/.git/
+ git remote add origin localhost:/tmp/annex/Docs.git
+ git fetch --all
Fetching origin
+ git config remote.origin.annex-ignore true
+ git annex init pc1
init pc1 ok
+ git annex info
repository mode: indirect
trusted repositories: 0
semitrusted repositories: 2
00000000-0000-0000-0000-000000000001 -- web
1b824247-8b70-4ae6-a809-6478c5ed47cf -- pc1 [here]
untrusted repositories: 0
transfers in progress: none
available local disk space: 472.33 gigabytes (+1 megabyte reserved)
local annex keys: 0
local annex size: 0 bytes
annexed files in working tree: 0
size of annexed files in working tree: 0 bytes
bloom filter size: 16 mebibytes (0% full)
backend usage:
+ true
+ git annex direct
commit On branch master
Initial commit
Untracked files:
fileA
fileB
nothing added to commit but untracked files present
ok
direct ok
+ git annex add .
add fileA ok
add fileB ok
(Recording state in git...)
+ git annex sync -c annex.alwayscommit=true origin
commit ok
pull origin
ok
push origin
To localhost:/tmp/annex/Docs.git
* [new branch] git-annex -> synced/git-annex
* [new branch] annex/direct/master -> synced/master
ok
(Recording state in git...)
+ cd /home/gioele/Temp/annex
+ mkdir -p pc2
+ cd pc2
+ git clone localhost:/tmp/annex/Docs.git
Cloning into 'Docs'...
+ cd Docs
+ git config remote.origin.annex-ignore true
+ git annex init pc2
init pc2 ok
+ git annex info
repository mode: indirect
trusted repositories: (merging origin/synced/git-annex into git-annex...)
(Recording state in git...)
0
semitrusted repositories: 2
00000000-0000-0000-0000-000000000001 -- web
6ede62b4-0db2-4152-8673-acf62553cbaa -- pc2 [here]
untrusted repositories: 0
transfers in progress: none
available local disk space: 472.33 gigabytes (+1 megabyte reserved)
local annex keys: 0
local annex size: 0 bytes
annexed files in working tree: 2
size of annexed files in working tree: 8 bytes
bloom filter size: 16 mebibytes (0% full)
backend usage:
SHA1E: 2
+ git annex whereis
whereis fileA (0 copies) failed
whereis fileB (0 copies) failed
git-annex: whereis: 2 failed
+ true
+ echo I was expecting location info to be available after info (press Enter)
I was expecting location info to be available after info (press Enter)
+ read enter
+ git annex sync -c annex.alwayscommit=true origin
commit ok
pull origin
ok
push origin
To localhost:/tmp/annex/Docs.git
0dab848..a7a92df git-annex -> synced/git-annex
ok
+ git annex whereis
whereis fileA (0 copies) failed
whereis fileB (0 copies) failed
git-annex: whereis: 2 failed
+ true
+ echo Why isn't location info available even after sync? (press Enter)
Why isn't location info available even after sync? (press Enter)
+ set -e
+ set -u
+ export LC_ALL=C
+ direct=false
+ h=localhost
+ dr=/tmp/annex
+ sync=sync -c annex.alwayscommit=true
+ chmod a+rwx -R pc1 pc2
+ rm -Rf pc1 pc2
+ ssh localhost chmod a+rwx -R /tmp/annex/Docs.git
+ ssh localhost rm -Rf /tmp/annex/Docs.git
+ ssh localhost mkdir -p /tmp/annex/Docs.git
+ ssh localhost cd /tmp/annex/Docs.git ; git init --bare
Initialized empty Git repository in /tmp/annex/Docs.git/
+ pwd
+ d=/home/gioele/Temp/annex
+ mkdir -p pc1/Docs
+ cd pc1/Docs
+ echo AAA
+ echo BBB
+ git init
Initialized empty Git repository in /home/gioele/Temp/annex/pc1/Docs/.git/
+ git remote add origin localhost:/tmp/annex/Docs.git
+ git fetch --all
Fetching origin
+ git config remote.origin.annex-ignore true
+ git annex init pc1
init pc1 ok
+ git annex info
repository mode: indirect
trusted repositories: 0
semitrusted repositories: 2
00000000-0000-0000-0000-000000000001 -- web
2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1 [here]
untrusted repositories: 0
transfers in progress: none
available local disk space: 472.33 gigabytes (+1 megabyte reserved)
local annex keys: 0
local annex size: 0 bytes
annexed files in working tree: 0
size of annexed files in working tree: 0 bytes
bloom filter size: 16 mebibytes (0% full)
backend usage:
+ false
+ git annex add .
add fileA ok
add fileB ok
(Recording state in git...)
+ git annex sync -c annex.alwayscommit=true origin
commit (Recording state in git...)
ok
pull origin
ok
push origin
To localhost:/tmp/annex/Docs.git
* [new branch] git-annex -> synced/git-annex
* [new branch] master -> synced/master
ok
+ cd /home/gioele/Temp/annex
+ mkdir -p pc2
+ cd pc2
+ git clone localhost:/tmp/annex/Docs.git
Cloning into 'Docs'...
+ cd Docs
+ git config remote.origin.annex-ignore true
+ git annex init pc2
init pc2 ok
+ git annex info
repository mode: indirect
trusted repositories: (merging origin/synced/git-annex into git-annex...)
(Recording state in git...)
0
semitrusted repositories: 3
00000000-0000-0000-0000-000000000001 -- web
0f9fa775-a5b9-4cee-8d7e-8684705ef4b3 -- pc2 [here]
2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1
untrusted repositories: 0
transfers in progress: none
available local disk space: 472.33 gigabytes (+1 megabyte reserved)
local annex keys: 0
local annex size: 0 bytes
annexed files in working tree: 2
size of annexed files in working tree: 8 bytes
bloom filter size: 16 mebibytes (0% full)
backend usage:
SHA1E: 2
+ git annex whereis
whereis fileA (1 copy)
2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1
ok
whereis fileB (1 copy)
2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1
ok
+ echo I was expecting location info to be available after info (press Enter)
I was expecting location info to be available after info (press Enter)
+ read enter
+ git annex sync -c annex.alwayscommit=true origin
commit ok
pull origin
ok
push origin
To localhost:/tmp/annex/Docs.git
a2d4a50..2ad4bd5 git-annex -> synced/git-annex
ok
+ git annex whereis
whereis fileA (1 copy)
2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1
ok
whereis fileB (1 copy)
2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1
ok
+ echo Why isn't location info available even after sync? (press Enter)
Why isn't location info available even after sync? (press Enter)
--- annex-indirect.log 2014-08-13 08:10:29.796464920 +0200
+++ annex-direct.log 2014-08-13 08:13:13.756460066 +0200
@@ -1,7 +1,7 @@
+ set -e
+ set -u
+ export LC_ALL=C
-+ direct=false
++ direct=true
+ h=localhost
+ dr=/tmp/annex
+ sync=sync -c annex.alwayscommit=true
@@ -31,7 +31,7 @@
trusted repositories: 0
semitrusted repositories: 2
00000000-0000-0000-0000-000000000001 -- web
- 2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1 [here]
+ 1b824247-8b70-4ae6-a809-6478c5ed47cf -- pc1 [here]
untrusted repositories: 0
transfers in progress: none
available local disk space: 472.33 gigabytes (+1 megabyte reserved)
@@ -41,23 +41,36 @@
size of annexed files in working tree: 0 bytes
bloom filter size: 16 mebibytes (0% full)
backend usage:
-+ false
++ true
++ git annex direct
+commit On branch master
+
+Initial commit
+
+Untracked files:
+ fileA
+ fileB
+
+nothing added to commit but untracked files present
+
+ok
+direct ok
+ git annex add .
add fileA ok
add fileB ok
(Recording state in git...)
+ git annex sync -c annex.alwayscommit=true origin
-commit (Recording state in git...)
-ok
+commit ok
pull origin
ok
push origin
To localhost:/tmp/annex/Docs.git
* [new branch] git-annex -> synced/git-annex
- * [new branch] master -> synced/master
+ * [new branch] annex/direct/master -> synced/master
ok
+(Recording state in git...)
+ cd /home/gioele/Temp/annex
+ mkdir -p pc2
+ cd pc2
@@ -72,10 +85,9 @@
trusted repositories: (merging origin/synced/git-annex into git-annex...)
(Recording state in git...)
0
-semitrusted repositories: 3
+semitrusted repositories: 2
00000000-0000-0000-0000-000000000001 -- web
- 0f9fa775-a5b9-4cee-8d7e-8684705ef4b3 -- pc2 [here]
- 2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1
+ 6ede62b4-0db2-4152-8673-acf62553cbaa -- pc2 [here]
untrusted repositories: 0
transfers in progress: none
available local disk space: 472.33 gigabytes (+1 megabyte reserved)
@@ -87,12 +99,10 @@
backend usage:
SHA1E: 2
+ git annex whereis
-whereis fileA (1 copy)
- 2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1
-ok
-whereis fileB (1 copy)
- 2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1
-ok
+whereis fileA (0 copies) failed
+whereis fileB (0 copies) failed
+git-annex: whereis: 2 failed
++ true
+ echo I was expecting location info to be available after info (press Enter)
I was expecting location info to be available after info (press Enter)
+ read enter
@@ -103,15 +113,13 @@
ok
push origin
To localhost:/tmp/annex/Docs.git
- a2d4a50..2ad4bd5 git-annex -> synced/git-annex
+ 0dab848..a7a92df git-annex -> synced/git-annex
ok
+ git annex whereis
-whereis fileA (1 copy)
- 2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1
-ok
-whereis fileB (1 copy)
- 2a1f1130-c0fb-4484-9bda-0211962419d9 -- pc1
-ok
+whereis fileA (0 copies) failed
+whereis fileB (0 copies) failed
+git-annex: whereis: 2 failed
++ true
+ echo Why isn't location info available even after sync? (press Enter)
Why isn't location info available even after sync? (press Enter)
#!/bin/sh -x
set -e ; set -u
export LC_ALL=C
# alwayscommit must be set globally to affects whereis and sync
git config --global annex.alwayscommit false
direct=true # set to false to make the problem disappear
h=${h:-localhost}
dr="/tmp/annex"
sync='sync -c annex.alwayscommit=true'
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 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
$direct && git annex direct
git annex add .
git annex $sync origin
# 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 info
git annex whereis || true
echo "I was expecting location info to be available after info (press Enter)" ; read enter
git annex $sync origin
git annex whereis || true
echo "Why isn't location info available even after sync? (press Enter)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment