Merge branch 'master' of ssh://git-annex.branchable.com

This commit is contained in:
Joey Hess 2014-04-12 13:31:45 -04:00
commit 09fa46f94f
2 changed files with 44 additions and 22 deletions

View file

@ -0,0 +1,44 @@
### Please describe the problem.
The command `git annex drop --from` always trusts the local repository, even if
it is marked as untrusted.
### What steps will reproduce the problem?
[[!format sh """
mkdir t u; cd t; git init; git commit --allow-empty -m "Initial commit"; git annex init "Trusted"; date > file; git annex add file; git commit -m "Add file"; cd ../u; git init; git remote add t ../t; git fetch t; git merge t/master; git annex init "Untrusted"; git annex untrust .; git annex get file; cd ../t; git remote add u ../u; git fetch u; cd ..
"""]]
Create two repositories, *t* (trusted) and *u* (untrusted). A file is in both
repositories. When performing `git annex drop file` in repository *t*, `git
annex` will abort because there are not enough copies. But when performing `git
annex drop --from t file` in *u*, git annex will delete the copy.
### What version of git-annex are you using? On what operating system?
Bug was introduced with 6c31e3a8 and still exists in current master (d955cfe7).
### Please provide any additional information below.
The following change seems to solve the problem. (First time working with
Haskell, please excuse the crude code.)
[[!format diff """
diff --git a/Command/Drop.hs b/Command/Drop.hs
index 269c4c2..09ea99a 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -82,8 +82,9 @@ performRemote key afile numcopies remote = lockContent key $ do
(remotes, trusteduuids) <- Remote.keyPossibilitiesTrusted key
present <- inAnnex key
u <- getUUID
+ level <- lookupTrust u
let have = filter (/= uuid) $
- if present then u:trusteduuids else trusteduuids
+ if present && level <= SemiTrusted then u:trusteduuids else trusteduuids
untrusteduuids <- trustGet UnTrusted
let tocheck = filter (/= remote) $
Remote.remotesWithoutUUID remotes (have++untrusteduuids)
"""]]

View file

@ -1,22 +0,0 @@
[[!comment format=mdwn
username="https://openid.stackexchange.com/user/e65e6d0e-58ba-41de-84cc-1f2ba54cf574"
nickname="Mica Semrick"
subject="Encrypt with pub or sub?"
date="2014-04-08T03:56:36Z"
content="""
Forgive me, I'm a bit new to PGP.
I do:
$ gpg --list-keys
/home/user/.gnupg/pubring.gpg
------------------------------
pub 2048R/41363A6A 2014-04-03
uid A Guy (git-annex key) <A@guy.com>
sub 2048R/77998J8TDY 2014-04-03
and see the pub and the sub key.
When I init a new special remote and want encryption, should I give the init command the pub or the sub key? Or does git annex sort that out itself?
"""]]