aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/Sync.hs18
-rw-r--r--debian/changelog3
-rw-r--r--doc/bugs/git_annex_sync_--content_may_copy_then_drop_a_file_to_a_remote.mdwn2
-rw-r--r--doc/bugs/git_annex_sync_--content_may_copy_then_drop_a_file_to_a_remote/comment_1_56eaabb5988caa043ab2e9c1429f8595._comment35
4 files changed, 50 insertions, 8 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index a5b601076..3411c9405 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -414,7 +414,7 @@ syncFile ebloom rs af k = do
let (have, lack) = partition (\r -> Remote.uuid r `elem` locs) rs
got <- anyM id =<< handleget have
- putrs <- catMaybes . snd . unzip <$> (sequence =<< handleput lack)
+ putrs <- handleput lack
u <- getUUID
let locs' = concat [[u | got], putrs, locs]
@@ -455,12 +455,14 @@ syncFile ebloom rs af k = do
wantput r
| Remote.readonly r || remoteAnnexReadOnly (Remote.gitconfig r) = return False
| otherwise = wantSend True (Just k) af (Remote.uuid r)
- handleput lack = ifM (inAnnex k)
- ( map put <$> filterM wantput lack
+ handleput lack = catMaybes <$> ifM (inAnnex k)
+ ( forM lack $ \r ->
+ ifM (wantput r <&&> put r)
+ ( return (Just (Remote.uuid r))
+ , return Nothing
+ )
, return []
)
- put dest = do
- ok <- includeCommandAction $ do
- showStart' "copy" k af
- Command.Move.toStart' dest False af k
- return (ok, if ok then Just (Remote.uuid dest) else Nothing)
+ put dest = includeCommandAction $ do
+ showStart' "copy" k af
+ Command.Move.toStart' dest False af k
diff --git a/debian/changelog b/debian/changelog
index f74439004..e8064900b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,9 @@ git-annex (5.20150714) UNRELEASED; urgency=medium
* version --raw now works when run outside a git repository.
* assistant --startdelay now works when run outside a git repository.
* dead now accepts multiple --key options.
+ * sync --content: Fix bug that caused files to be uploaded to eg,
+ more archive remotes than wanted copies, only to later be dropped
+ to satisfy the preferred content settings.
-- Joey Hess <id@joeyh.name> Fri, 10 Jul 2015 16:36:42 -0400
diff --git a/doc/bugs/git_annex_sync_--content_may_copy_then_drop_a_file_to_a_remote.mdwn b/doc/bugs/git_annex_sync_--content_may_copy_then_drop_a_file_to_a_remote.mdwn
index 3ec60cacf..ff3a3b7e2 100644
--- a/doc/bugs/git_annex_sync_--content_may_copy_then_drop_a_file_to_a_remote.mdwn
+++ b/doc/bugs/git_annex_sync_--content_may_copy_then_drop_a_file_to_a_remote.mdwn
@@ -31,3 +31,5 @@ drop hubic3 Avatars/archer.jpg ok
# End of transcript or log.
"""]]
+
+> [[fixed|done]] --[[Joey]]
diff --git a/doc/bugs/git_annex_sync_--content_may_copy_then_drop_a_file_to_a_remote/comment_1_56eaabb5988caa043ab2e9c1429f8595._comment b/doc/bugs/git_annex_sync_--content_may_copy_then_drop_a_file_to_a_remote/comment_1_56eaabb5988caa043ab2e9c1429f8595._comment
new file mode 100644
index 000000000..a6a7f7782
--- /dev/null
+++ b/doc/bugs/git_annex_sync_--content_may_copy_then_drop_a_file_to_a_remote/comment_1_56eaabb5988caa043ab2e9c1429f8595._comment
@@ -0,0 +1,35 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2015-07-20T18:07:04Z"
+ content="""
+A good bug report that I didn't get to for far too long..
+
+I reproduced this fairly easily; both remotes set to be
+in the archive group and both set to use the "standard" preferred content
+expression.
+
+ joey@darkstar:~/tmp/bench/local>git annex sync --content
+ commit ok
+ copy file copy file (to hubic3...)
+ ok
+ copy file copy file (to hubic2...)
+ ok
+ drop hubic3 file ok
+
+It wants to drop the file from hubic3 once it's present on hubic2,
+since archive remotes only want files not on other archive remotes.
+
+So, why does it send the file to hubic2, given that it's already in hubic3?
+
+If I manually copy the file to one of the remotes, sync --content won't
+send it to the other. So, I suspect it's getting a list of remotes that
+want the file first, and then copying the file to all of them.
+
+Aha, indeed:
+
+ map put <$> filterM wantput lack
+
+Fixed by making it check if each remote wants the file inside the loop,
+rather than checking when getting the list of remotes to loop over.
+"""]]