summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-29 13:52:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-29 13:52:42 -0400
commit74d055b23b68d5797120acd257a0000b8262450c (patch)
tree29e5308cad86092a49cd41b6e9f5c446ade9448f
parent31617b2aa1f1435c0d162d80e2018a4d46f58c7b (diff)
glacier: Better handling of the glacier inventory, which avoids duplicate uploads to the same glacier repository by `git annex copy`.
The checkpresent hook can return either True or, False, or fail with a message if it cannot successfully check the remote. Currently for glacier, when --trust-glacier is not set, it always returns False. Crucially, in the case when a file is in glacier, this is telling git-annex it's not there, so copy re-uploads it. This is not desirable; it breaks using glacier-cli to retreive that file later, and it wastes money/bandwidth. What if it instead, when the glacier inventory is missing a file, it returns False. And when the glacier inventory has a file, unless --trust-glacier is set, it *fails*. The result would be: * `git annex copy --to glacier` would only send things not listed in inventory. If a file is listed in the inventory, `copy` would complain that --trust-glacier` is not set, and not re-upload the file. * `git annex drop` would only trust that glacier has a file when --trust-glacier is set. Behavior unchanged. * `git annex move --to glacier`, when the file is not listed in inventory, would send the file, and delete it locally. Behavior unchanged. * `git annex move --to glacier`, when the file is listed in inventory, would only trust that glacier has the file when --trust-glacier is set * `git annex copy --from glacier` / `git annex get`, when the file is located in glacier, would trust the location log, and attempt to get the file from glacier.
-rw-r--r--Remote/Glacier.hs4
-rw-r--r--debian/changelog2
2 files changed, 3 insertions, 3 deletions
diff --git a/Remote/Glacier.hs b/Remote/Glacier.hs
index 65c978bd4..c1a53347d 100644
--- a/Remote/Glacier.hs
+++ b/Remote/Glacier.hs
@@ -195,14 +195,12 @@ checkPresent r k = do
, Param $ archive r k
]
- untrusted = do
- showLongNote $ unlines
+ untrusted = return $ Left $ unlines
[ "Glacier's inventory says it has a copy."
, "However, the inventory could be out of date, if it was recently removed."
, "(Use --trust-glacier if you're sure it's still in Glacier.)"
, ""
]
- return $ Right False
glacierAction :: Remote -> [CommandParam] -> Annex Bool
glacierAction r params = runGlacier (config r) (uuid r) params
diff --git a/debian/changelog b/debian/changelog
index 2c40b472d..3d617f089 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,8 @@ git-annex (4.20130522) UNRELEASED; urgency=low
* XMPP: Fix a file descriptor leak.
* Android: Added an "Open WebApp" item to the terminal's menu.
Should work for Android devices that cannot auto-open the webapp on start.
+ * glacier: Better handling of the glacier inventory, which avoids
+ duplicate uploads to the same glacier repository by `git annex copy`.
-- Joey Hess <joeyh@debian.org> Tue, 21 May 2013 18:22:46 -0400