fix 1192d98721 to handle annexed files in conflicted merge

In the case of a conflicted merge where the remote adds a directory, and we
have a file (which is checked in), resolveMerge' will create the link,
and so the fix for 1192d98721 looked at that,
thought it was an unannexed file (it's not in the oldref), and preserved
it.

This is a hacky fix. It would be better for resolveMerge' to not update the
work tree, at least in direct mode, and only stage the changes, which
mergeDirectCleanUp could then move into tree. I want to make that change,
but this is not the time to do it.
This commit is contained in:
Joey Hess 2014-03-03 17:09:53 -04:00
parent 6dc8bfad0b
commit fb88e0f02c

View file

@ -214,11 +214,15 @@ mergeDirectCleanup d oldsha newsha = do
{- If the file is present in the work tree, but did not exist in
- the oldsha branch, preserve this local, unannexed file. -}
preserveUnannexed f = whenM (liftIO $ exists f) $
preserveUnannexed f = whenM unannexed $
whenM (isNothing <$> catFileDetails oldsha f) $
liftIO $ findnewname (0 :: Int)
where
exists = isJust <$$> catchMaybeIO . getSymbolicLinkStatus
unannexed = liftIO (exists f)
<&&> (isNothing <$> isAnnexLink f)
findnewname n = do
let localf = mkVariant f
("local" ++ if n > 0 then show n else "")