diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-08 13:54:42 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-08 13:55:11 -0400 |
commit | 84ffc8f7d265c8a685c1ea081c8a8871c7ee1b44 (patch) | |
tree | 10c36135ebc8b298d18ee7f633fed61a5d31a2e4 /Annex/CatFile.hs | |
parent | 069e875da6d98f0d10c390541ccac733bea41e2b (diff) |
Fix bug in automatic merge conflict resolution
When one side is an annexed symlink, and the other side is a non-annexed symlink.
In this case, git-merge does not replace the annexed symlink in the work
tree with the non-annexed symlink, which is different from it's handling of
conflicts between annexed symlinks and regular files or directories.
So, while git-annex generated the correct merge commit, the work tree
didn't get updated to reflect it.
See comments on bug for additional analysis.
Did not add this to the test suite yet; just unloaded a truckload of firewood
and am feeling lazy.
This commit was sponsored by Adam Spiers.
Diffstat (limited to 'Annex/CatFile.hs')
-rw-r--r-- | Annex/CatFile.hs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Annex/CatFile.hs b/Annex/CatFile.hs index 6a778db03..2f8c43079 100644 --- a/Annex/CatFile.hs +++ b/Annex/CatFile.hs @@ -15,6 +15,7 @@ module Annex.CatFile ( catKey, catKeyFile, catKeyFileHEAD, + catLink, ) where import qualified Data.ByteString.Lazy as L @@ -77,21 +78,25 @@ catFileHandle = do catKey :: Ref -> FileMode -> Annex (Maybe Key) catKey = catKey' True -catKey' :: Bool -> Ref -> FileMode -> Annex (Maybe Key) -catKey' modeguaranteed ref mode +catKey' :: Bool -> Sha -> FileMode -> Annex (Maybe Key) +catKey' modeguaranteed sha mode | isSymLink mode = do - l <- fromInternalGitPath . decodeBS <$> get + l <- catLink modeguaranteed sha return $ if isLinkToAnnex l then fileKey $ takeFileName l else Nothing | otherwise = return Nothing + +{- Gets a symlink target. -} +catLink :: Bool -> Sha -> Annex String +catLink modeguaranteed sha = fromInternalGitPath . decodeBS <$> get where -- If the mode is not guaranteed to be correct, avoid -- buffering the whole file content, which might be large. -- 8192 is enough if it really is a symlink. get - | modeguaranteed = catObject ref - | otherwise = L.take 8192 <$> catObject ref + | modeguaranteed = catObject sha + | otherwise = L.take 8192 <$> catObject sha {- Looks up the key corresponding to the Ref using the running cat-file. - |