Fix display of warning message when encountering a file that uses an unsupported backend.

This commit is contained in:
Joey Hess 2012-05-31 21:03:24 -04:00
parent d4a95faeb2
commit 6fd83851c1
3 changed files with 9 additions and 5 deletions

View file

@ -75,16 +75,16 @@ genKey' (b:bs) file = do
- by examining what the file symlinks to. -} - by examining what the file symlinks to. -}
lookupFile :: FilePath -> Annex (Maybe (Key, Backend)) lookupFile :: FilePath -> Annex (Maybe (Key, Backend))
lookupFile file = do lookupFile file = do
tl <- liftIO $ tryIO getsymlink tl <- liftIO $ tryIO $ readSymbolicLink file
case tl of case tl of
Left _ -> return Nothing Left _ -> return Nothing
Right l -> makekey l Right l -> makekey l
where where
getsymlink = takeFileName <$> readSymbolicLink file makekey l = maybe (return Nothing) (makeret l) (fileKey $ takeFileName l)
makekey l = maybe (return Nothing) (makeret l) (fileKey l)
makeret l k = let bname = keyBackendName k in makeret l k = let bname = keyBackendName k in
case maybeLookupBackendName bname of case maybeLookupBackendName bname of
Just backend -> return $ Just (k, backend) Just backend -> do
return $ Just (k, backend)
Nothing -> do Nothing -> do
when (isLinkToAnnex l) $ warning $ when (isLinkToAnnex l) $ warning $
"skipping " ++ file ++ "skipping " ++ file ++

View file

@ -155,7 +155,9 @@ gitAnnexRemotesDir r = addTrailingPathSeparator $ gitAnnexDir r </> "remotes"
{- Checks a symlink target to see if it appears to point to annexed content. -} {- Checks a symlink target to see if it appears to point to annexed content. -}
isLinkToAnnex :: FilePath -> Bool isLinkToAnnex :: FilePath -> Bool
isLinkToAnnex s = ("/.git/" ++ objectDir) `isInfixOf` s isLinkToAnnex s = ("/" ++ d) `isInfixOf` s || d `isPrefixOf` s
where
d = ".git" </> objectDir
{- Converts a key into a filename fragment without any directory. {- Converts a key into a filename fragment without any directory.
- -

2
debian/changelog vendored
View file

@ -4,6 +4,8 @@ git-annex (3.20120523) UNRELEASED; urgency=low
* lock: Reset unlocked file to index, rather than to branch head. * lock: Reset unlocked file to index, rather than to branch head.
* import: New subcommand, pulls files from a directory outside the annex * import: New subcommand, pulls files from a directory outside the annex
and adds them. and adds them.
* Fix display of warning message when encountering a file that uses an
unsupported backend.
-- Joey Hess <joeyh@debian.org> Sun, 27 May 2012 20:55:29 -0400 -- Joey Hess <joeyh@debian.org> Sun, 27 May 2012 20:55:29 -0400