From c4a357d5d13e6c2f09ee98ee6ef8b18104e5d167 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Dec 2010 14:57:43 -0400 Subject: Bugfix to git annex unused in a repository with nothing yet annexed. --- Core.hs | 10 +++++++--- debian/changelog | 6 ++++++ doc/bugs/git_annex_unused_failes_on_empty_repository.mdwn | 2 ++ 3 files changed, 15 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 $ diff --git a/debian/changelog b/debian/changelog index af63601ba..70d375f30 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +git-annex (0.14) UNRELEASED; urgency=low + + * Bugfix to git annex unused in a repository with nothing yet annexed. + + -- Joey Hess Mon, 20 Dec 2010 14:54:49 -0400 + git-annex (0.13) unstable; urgency=low * Makefile: Install man page and html (when built). diff --git a/doc/bugs/git_annex_unused_failes_on_empty_repository.mdwn b/doc/bugs/git_annex_unused_failes_on_empty_repository.mdwn index 9be98104a..05aa69572 100644 --- a/doc/bugs/git_annex_unused_failes_on_empty_repository.mdwn +++ b/doc/bugs/git_annex_unused_failes_on_empty_repository.mdwn @@ -11,3 +11,5 @@ The ``git annex unused`` command fails on a git-annex repository, if there are n This can give a user (especially one that wants to try out simple commands with his newly created repo) the impression that something is wrong, while it is not. I'd expect the program either to show the same message ``git annex unused`` shows when everything is ok (since it is, or should be). This can be a bug in the ``unused`` subcommand (that fails to accept the absence of an objects directory) or in the ``init`` subcommand (that fails to create it). + +> [[fixed|done]] --[[Joey]] -- cgit v1.2.3