summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGravatar David Triendl <david@triendl.name>2014-04-12 06:46:08 +0200
committerGravatar David Triendl <david@triendl.name>2014-04-12 06:46:08 +0200
commit5ec67d23c20eaeb222d43f9ec99509e94585978e (patch)
treeeb2dedb9eace6667de793497c03dc3a42c80c44e /doc
parent6e45ca3a50466644260e4f10bc8d3e680b93e95d (diff)
Add doc/bugs/Drop_--from_always_trusts_local_repository.mdwn
Diffstat (limited to 'doc')
-rw-r--r--doc/bugs/Drop_--from_always_trusts_local_repository.mdwn44
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/bugs/Drop_--from_always_trusts_local_repository.mdwn b/doc/bugs/Drop_--from_always_trusts_local_repository.mdwn
new file mode 100644
index 000000000..a1b27cf5b
--- /dev/null
+++ b/doc/bugs/Drop_--from_always_trusts_local_repository.mdwn
@@ -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)
+"""]]