This commit is contained in:
zardoz 2014-08-02 12:21:38 +00:00 committed by admin
parent 25ac3a4c4a
commit 670f4d43e3

View file

@ -0,0 +1,57 @@
### Please describe the problem.
While the docs say that WORM keys are a function of a files basename,
when doing «git annex add .», the generated keys will actually contain
the relative path (with slashes escaped). Not sure whether this is by
design or a bug in its own right. I suppose that to minimize the chance
of collisions on WORM, having the path within the key is preferable.
A problem about this, however, is that the path in the key is not
stable, but varies with the working dir when doing the «git annex
add». So, when a file is added from one working dir (say, the repo
base), later unlocked, and readded from another working dir (say,
somewhere below the repo base), this will generate a different key
even when the file has not been touched.
Is there a rationale for this variability, or should «add» canonicalize
the encoded paths to the repo root?
### What steps will reproduce the problem?
[[!format sh """
# Init
$ git init /tmp/foo
$ cd /tmp/foo && git annex init
$ mkdir baz
$ touch baz/quux
# Add file with working dir at repo root.
$ git annex add --backend=WORM baz
$ git commit -m "first"
# Key includes relative path.
$ readlink baz/quux
../.git/annex/objects/8x/8V/WORM-s0-m1406981486--baz%quux/WORM-s0-m1406981486--baz%quux
# Unlock and readd with working dir at path below repo root.
$ cd baz
$ git annex unlock quux
$ git annex add quux
$ git com -m "second"
# Relative path is anchored to working dir instead of repo root.
$ readlink quux
../.git/annex/objects/9G/72/WORM-s0-m1406981486--quux/WORM-s0-m1406981486--quux
# End of transcript or log.
"""]]
### What version of git-annex are you using? On what operating system?
Linux 3.15.8
git-annex 5.20140716