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

@ -700,8 +700,8 @@ seekExportContent rs (currbranch, _) = or <$> forM rs go
Nothing -> nontracking r
Just cur -> do
Command.Export.changeExport r ea db cur
return [Exported cur []]
Export.closeDb db `after` fillexport r ea db exported
return [mkExported cur []]
Export.closeDb db `after` fillexport r ea db (exportedTreeishes exported)
nontracking r = do
exported <- getExport (Remote.uuid r)
@ -709,7 +709,7 @@ seekExportContent rs (currbranch, _) = or <$> forM rs go
return exported
warnnontracking r exported currb = inRepo (Git.Ref.tree currb) >>= \case
Just currt | not (any (\ex -> exportedTreeish ex == currt) exported) ->
Just currt | not (any (== currt) (exportedTreeishes exported)) ->
showLongNote $ unwords
[ "Not updating export to " ++ Remote.name r
, "to reflect changes to the tree, because export"
@ -721,7 +721,7 @@ seekExportContent rs (currbranch, _) = or <$> forM rs go
fillexport _ _ _ [] = return False
fillexport r ea db (Exported { exportedTreeish = t }:[]) =
fillexport r ea db (t:[]) =
Command.Export.fillExport r ea db t
fillexport r _ _ _ = do
warnExportConflict r