summaryrefslogtreecommitdiff
path: root/Core.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-12-20 14:57:43 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-12-20 14:57:43 -0400
commitc4a357d5d13e6c2f09ee98ee6ef8b18104e5d167 (patch)
tree44d37ce34184a4cdf30bccddc9104daaf4a8171a /Core.hs
parentea70873b112c9a1a4471bbd263001975e69e6bdf (diff)
Bugfix to git annex unused in a repository with nothing yet annexed.
Diffstat (limited to 'Core.hs')
-rw-r--r--Core.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Core.hs b/Core.hs
index e3702044e..9da4f3f2e 100644
--- a/Core.hs
+++ b/Core.hs
@@ -185,9 +185,13 @@ getKeysPresent = do
getKeysPresent' $ annexObjectDir g
getKeysPresent' :: FilePath -> Annex [Key]
getKeysPresent' dir = do
- contents <- liftIO $ getDirectoryContents dir
- files <- liftIO $ filterM present contents
- return $ map fileKey files
+ exists <- liftIO $ doesDirectoryExist dir
+ if (not exists)
+ then return []
+ else do
+ contents <- liftIO $ getDirectoryContents dir
+ files <- liftIO $ filterM present contents
+ return $ map fileKey files
where
present d = do
result <- try $