From fb88e0f02cb702725556cc741da9b360a9e5db5a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 3 Mar 2014 17:09:53 -0400 Subject: [PATCH] fix 1192d987218fd4ef13aa5e90c5de9091c4466c5d 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 1192d987218fd4ef13aa5e90c5de9091c4466c5d 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. --- Annex/Direct.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Annex/Direct.hs b/Annex/Direct.hs index 2b43ca6805..02766ab181 100644 --- a/Annex/Direct.hs +++ b/Annex/Direct.hs @@ -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 "")