This commit is contained in:
Steve 2012-12-22 16:39:14 +00:00 committed by admin
parent da8fbb9e3e
commit ea40b0002b

View file

@ -0,0 +1,100 @@
The "git annex unused" command considers remote branches as well as local branches. This means that an
object may be considered unused or not depending on what remotes are present and when they were last synced.
I ran into this issue when experimenting with using repos on removable storage. I'll post more about
what I was trying to do in the forum. I'm posting this in bugs as I believe the inconsistent behavior
should probably be considered a bug.
#What steps will reproduce the problem?
Here is a sample session illustrating the problem. At the end, you can see that the object is
not shown as unused, then the remote is removed and it is shown as unused, then the remote is added
back and the file is once again not shown as unused.
/tmp/git $ mkdir 1 2
/tmp/git $ cd 1
/tmp/git/1 $ git init
Initialized empty Git repository in /tmp/git/1/.git/
/tmp/git/1 $ git annex init 1
init 1 ok
(Recording state in git...)
/tmp/git/1 $ git remote add 2 ../2
/tmp/git/1 $ dd if=/dev/urandom of=file.bin count=100
100+0 records in
100+0 records out
51200 bytes (51 kB) copied, 0.0113172 s, 4.5 MB/s
/tmp/git/1 $ git annex add file.bin
add file.bin (checksum...) ok
(Recording state in git...)
/tmp/git/1 $ git commit -m 'added file'
[master (root-commit) 3c1ad30] added file
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 120000 file.bin
/tmp/git/1 $ cd ../2
/tmp/git/2 $ git init
Initialized empty Git repository in /tmp/git/2/.git/
/tmp/git/2 $ git annex init 2
init 2 ok
(Recording state in git...)
/tmp/git/2 $ git remote add 1 ../1
/tmp/git/2 $ git fetch 1
warning: no common commits
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 13 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (13/13), done.
From ../1
* [new branch] git-annex -> 1/git-annex
* [new branch] master -> 1/master
/tmp/git/2 $ git checkout -b master 1/master
Branch master set up to track remote branch master from 1.
Already on 'master'
/tmp/git/2 $ cd ../1
/tmp/git/1 $ git fetch 2
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 5 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From ../2
* [new branch] git-annex -> 2/git-annex
* [new branch] master -> 2/master
/tmp/git/1 $ git rm file.bin
rm 'file.bin'
/tmp/git/1 $ git commit -m 'rmed file'
[master ab242b0] rmed file
1 files changed, 0 insertions(+), 1 deletions(-)
delete mode 120000 file.bin
/tmp/git/1 $ git annex unused
unused . (checking for unused data...) (checking master...) (checking 2/master...) ok
/tmp/git/1 $ git remote rm 2
/tmp/git/1 $ git annex unused
unused . (checking for unused data...) (checking master...)
Some annexed data is no longer used by any files:
NUMBER KEY
1 SHA256E-s51200--e400e5abea095ad4364d8f97c5fe1a3f8a6db670b2dfee951d7c9674afc9a21d.bin
(To see where data was previously used, try: git log --stat -S'KEY')
To remove unwanted data: git-annex dropunused NUMBER
ok
/tmp/git/1 $ git remote add 2 ../2
/tmp/git/1 $ git fetch 2
From ../2
* [new branch] git-annex -> 2/git-annex
* [new branch] master -> 2/master
/tmp/git/1 $ git annex unused
unused . (checking for unused data...) (checking master...) (checking 2/master...) ok
/tmp/git/1 $
#What is the expected output? What do you see instead?
I expected that the object's unused status would not change based on which remotes this particular
repo knows about. In other words, I expected the unused status to be based on the local branches
and possibly information in the git-annex branch.
#What version of git-annex are you using? On what operating system?
Gentoo Linux, git annex version 3.20121211
#Please provide any additional information below.