From 03dee56546e54d178ec7fbfc1f90389e4aaf28d3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 7 Sep 2020 15:41:16 -0400 Subject: [PATCH] revert change that broke test suite Opened a new bug about it. This commit was sponsored by Ethan Aubin. --- Annex/AutoMerge.hs | 35 +++++---------------- doc/bugs/automerge_leaves_cruft_behind.mdwn | 6 ++++ 2 files changed, 13 insertions(+), 28 deletions(-) create mode 100644 doc/bugs/automerge_leaves_cruft_behind.mdwn diff --git a/Annex/AutoMerge.hs b/Annex/AutoMerge.hs index 2d7c8e93d1..f4c3b12652 100644 --- a/Annex/AutoMerge.hs +++ b/Annex/AutoMerge.hs @@ -167,7 +167,7 @@ resolveMerge' unstagedmap (Just us) them inoverlay u = do kthem <- getkey LsFiles.valThem case (kus, kthem) of -- Both sides of conflict are annexed files - (Right (Just keyUs), Right (Just keyThem)) + (Just keyUs, Just keyThem) | keyUs /= keyThem -> resolveby [keyUs, keyThem] $ do makevariantannexlink keyUs LsFiles.valUs makevariantannexlink keyThem LsFiles.valThem @@ -187,44 +187,23 @@ resolveMerge' unstagedmap (Just us) them inoverlay u = do return ([keyUs, keyThem], Just file) -- Our side is annexed file, other side is not. -- Make the annexed file into a variant file and graft in the - -- other file as it was. - (Right (Just keyUs), Right Nothing) -> resolveby [keyUs] $ do + -- other file/directory as it was. + (Just keyUs, Nothing) -> resolveby [keyUs] $ do graftin them file LsFiles.valThem LsFiles.valThem LsFiles.valUs makevariantannexlink keyUs LsFiles.valUs -- Our side is not annexed file, other side is. - (Right Nothing, Right (Just keyThem)) -> resolveby [keyThem] $ do + (Nothing, Just keyThem) -> resolveby [keyThem] $ do graftin us file LsFiles.valUs LsFiles.valUs LsFiles.valThem makevariantannexlink keyThem LsFiles.valThem -- Neither side is annexed file; cannot resolve. - (Right Nothing, Right Nothing) -> cannotresolve - -- Other side deleted the file, our side is an annexed - -- file. Make it a variant. - (Right (Just keyUs), Left ()) -> resolveby [keyUs] $ do - unless inoverlay $ - liftIO $ nukeFile file - makevariantannexlink keyUs LsFiles.valThem - -- Our side deleted the file, other side is an annexed - -- file. Make it a variant. - (Left (), Right (Just keyThem)) -> resolveby [keyThem] $ do - unless inoverlay $ - liftIO $ nukeFile file - makevariantannexlink keyThem LsFiles.valThem - -- One side deleted the file, other side is not an annexed - -- file; cannot resolve. - (Left (), Right Nothing) -> cannotresolve - (Right Nothing, Left()) -> cannotresolve - -- Both deleted, so it's not really a conflict. Probably - -- impossible for this to happen. - (Left (), Left ()) -> cannotresolve + (Nothing, Nothing) -> return ([], Nothing) where file = fromRawFilePath $ LsFiles.unmergedFile u - cannotresolve = return ([], Nothing) - getkey select = case select (LsFiles.unmergedSha u) of - Just sha -> Right <$> catKey sha - Nothing -> return (Left ()) + Just sha -> catKey sha + Nothing -> pure Nothing islocked select = select (LsFiles.unmergedTreeItemType u) == Just TreeSymlink diff --git a/doc/bugs/automerge_leaves_cruft_behind.mdwn b/doc/bugs/automerge_leaves_cruft_behind.mdwn new file mode 100644 index 0000000000..8f4daa3861 --- /dev/null +++ b/doc/bugs/automerge_leaves_cruft_behind.mdwn @@ -0,0 +1,6 @@ +Seeing `git-annex sync` after resolving a merge conflict between a +directory and an annexed file leave behind +files like `foo~refs_remotes_origin_master`, which are not checked into +git. + +Also happens with merge.directoryRenames=conflict --[[Joey]]