diff options
author | Joey Hess <joey@kitenet.net> | 2014-11-24 16:14:01 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-11-24 16:14:06 -0400 |
commit | 3a812f5368b8e715c87d00089ced2c67a127247f (patch) | |
tree | 9138c6b65f05060a19991c18089c3a290cbef220 /Annex/Link.hs | |
parent | 67239c88fd84c0d18645ca75faca37a46c23a278 (diff) |
diffdriver: New git-annex command, to make git external diff drivers work with annexed files.
Diffstat (limited to 'Annex/Link.hs')
-rw-r--r-- | Annex/Link.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Annex/Link.hs b/Annex/Link.hs index 25166bff5..e50b97447 100644 --- a/Annex/Link.hs +++ b/Annex/Link.hs @@ -35,13 +35,17 @@ isAnnexLink file = maybe Nothing (fileKey . takeFileName) <$> getAnnexLinkTarget - content. -} getAnnexLinkTarget :: FilePath -> Annex (Maybe LinkTarget) -getAnnexLinkTarget file = ifM (coreSymlinks <$> Annex.getGitConfig) - ( check readSymbolicLink $ +getAnnexLinkTarget f = getAnnexLinkTarget' f + =<< (coreSymlinks <$> Annex.getGitConfig) + +{- Pass False to force looking inside file. -} +getAnnexLinkTarget' :: FilePath -> Bool -> Annex (Maybe LinkTarget) +getAnnexLinkTarget' file coresymlinks = if coresymlinks + then check readSymbolicLink $ return Nothing - , check readSymbolicLink $ + else check readSymbolicLink $ check probefilecontent $ return Nothing - ) where check getlinktarget fallback = do v <- liftIO $ catchMaybeIO $ getlinktarget file |