Add doc/bugs/Drop_--from_always_trusts_local_repository.mdwn
This commit is contained in:
parent
0f609b1f7f
commit
ea5166ea96
1 changed files with 44 additions and 0 deletions
44
doc/bugs/Drop_--from_always_trusts_local_repository.mdwn
Normal file
44
doc/bugs/Drop_--from_always_trusts_local_repository.mdwn
Normal 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)
|
||||
"""]]
|
Loading…
Add table
Reference in a new issue