fix false positive in export conflict detection

Like the earlier fixed one in Command.Export, it occurred when the same
tree was exported by multiple clones. Previous fix was incomplete since
several other places looked at the list of exported trees to detect when
there was an export conflict. Added a single unified function to avoid
missing any places it needed to be fixed.

This commit was sponsored by mo on Patreon.
This commit is contained in:
Joey Hess 2019-01-30 12:36:30 -04:00
parent e3dce20cf5
commit ad1d422dd7
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 46 additions and 14 deletions

View file

@ -103,7 +103,7 @@ changeExport r ea db new = do
startRecoverIncomplete r ea db
(Git.DiffTree.srcsha diff)
(Git.DiffTree.file diff)
forM_ (concatMap incompleteExportedTreeish old) $ \incomplete ->
forM_ (incompleteExportedTreeishes old) $ \incomplete ->
mapdiff recover incomplete new
-- Diff the old and new trees, and delete or rename to new name all
@ -113,7 +113,7 @@ changeExport r ea db new = do
-- When there was an export conflict, this resolves it.
--
-- The ExportTree is also updated here to reflect the new tree.
case nub (map exportedTreeish old) of
case exportedTreeishes old of
[] -> updateExportTree db emptyTree new
[oldtreesha] -> do
diffmap <- mkDiffMap oldtreesha new db
@ -158,7 +158,7 @@ changeExport r ea db new = do
c <- Annex.getState Annex.errcounter
when (c == 0) $ do
recordExport (uuid r) $ ExportChange
{ oldTreeish = map exportedTreeish old
{ oldTreeish = exportedTreeishes old
, newTreeish = new
}
where