fix removing simulated file

This commit is contained in:
Joey Hess 2024-09-09 14:07:52 -04:00
parent bbd5390fa3
commit 52c6434b87
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -465,8 +465,6 @@ cloneSimRepo simreponame u parent dest st = do
, Param "--shared" , Param "--shared"
, Param "--quiet" , Param "--quiet"
-- Avoid overhead of checking out the working tree. -- Avoid overhead of checking out the working tree.
-- Note that, on visiting the simulated repo,
-- the working tree needs to be reset.
, Param "--no-checkout" , Param "--no-checkout"
-- Make sure the origin gets that name. -- Make sure the origin gets that name.
, Param "--origin", Param "origin" , Param "--origin", Param "origin"
@ -550,9 +548,9 @@ updateSimRepoState newst sr = do
} }
-- XXX TODO update location logs from simLocations -- XXX TODO update location logs from simLocations
updateField oldst newst simFiles $ DiffUpdate updateField oldst newst simFiles $ DiffUpdate
{ replaceDiff = addannexedfile { replaceDiff = stageannexedfile
, addDiff = addannexedfile , addDiff = stageannexedfile
, removeDiff = liftIO . removeWhenExistsWith R.removeLink , removeDiff = unstageannexedfile
} }
Annex.Queue.flush Annex.Queue.flush
let ard' = ard { Annex.rebalance = simRebalance newst } let ard' = ard { Annex.rebalance = simRebalance newst }
@ -563,10 +561,14 @@ updateSimRepoState newst sr = do
where where
setdesc r u = describeUUID u $ toUUIDDesc $ setdesc r u = describeUUID u $ toUUIDDesc $
simulatedRepositoryDescription r simulatedRepositoryDescription r
addannexedfile f k = do stageannexedfile f k = do
let f' = repoPath (simRepoGitRepo sr) P.</> f let f' = annexedfilepath f
l <- calcRepo $ gitAnnexLink f' k l <- calcRepo $ gitAnnexLink f' k
addAnnexLink l f' addAnnexLink l f'
unstageannexedfile f = do
liftIO $ removeWhenExistsWith R.removeLink $
annexedfilepath f
annexedfilepath f = repoPath (simRepoGitRepo sr) P.</> f
data DiffUpdate a b m = DiffUpdate data DiffUpdate a b m = DiffUpdate
{ replaceDiff :: a -> b -> m () { replaceDiff :: a -> b -> m ()