convert PendingAddChange back to Change when an add fails

If an add failed, we should lose the KeySource, since it, presumably,
differs due to a change that was made to the file.

(The locked down file is already deleted.)
This commit is contained in:
Joey Hess 2013-04-24 16:26:55 -04:00
parent 76431520e4
commit bda237f14a
2 changed files with 6 additions and 1 deletions

View file

@ -302,7 +302,7 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
recordedInodeCache k
failedingest change = do
refill [change]
refill [retryChange change]
liftAnnex showEndFail
return Nothing

View file

@ -63,6 +63,11 @@ isInProcessAddChange :: Change -> Bool
isInProcessAddChange (InProcessAddChange {}) = True
isInProcessAddChange _ = False
retryChange :: Change -> Change
retryChange (InProcessAddChange time ks) =
Change time (keyFilename ks) AddFileChange
retryChange c = c
finishedChange :: Change -> Key -> Change
finishedChange c@(InProcessAddChange { keySource = ks }) k = Change
{ changeTime = changeTime c