aboutsummaryrefslogtreecommitdiff
path: root/Annex/Direct.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-03 17:09:53 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-03 17:09:53 -0400
commit7ae14619cd4466fbb17ef1318821a6fba41c28b6 (patch)
treeb17261c513257ab55d3bfd539da99e8acd38e494 /Annex/Direct.hs
parenta2b4e229a4a33ecfbf1714aa1c1602bcb118d91e (diff)
fix a9067868a8594577ead2ecbe55f9563bef12f26d 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 a9067868a8594577ead2ecbe55f9563bef12f26d 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.
Diffstat (limited to 'Annex/Direct.hs')
-rw-r--r--Annex/Direct.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Annex/Direct.hs b/Annex/Direct.hs
index 2b43ca680..02766ab18 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 "")