diff options
author | Joey Hess <joey@kitenet.net> | 2011-11-09 18:33:15 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-11-09 18:33:15 -0400 |
commit | d3e1a3619ff6939367f43cbd46131b7f60ef6bd0 (patch) | |
tree | bc7e29364f11d3369730b0b61ad58e942b95d1cf /Remote/Bup.hs | |
parent | 2934a65ac5bbab5ac127c495c8c2492e729c2b67 (diff) |
safer inannex checking
git-annex-shell inannex now returns always 0, 1, or 100 (the last when
it's unclear if content is currently in the index due to it currently being
moved or dropped).
(Actual locking code still not yet written.)
Diffstat (limited to 'Remote/Bup.hs')
-rw-r--r-- | Remote/Bup.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs index b8d7cd317..866d4b42d 100644 --- a/Remote/Bup.hs +++ b/Remote/Bup.hs @@ -139,17 +139,21 @@ remove _ = do - in a bup repository. One way it to check if the git repository has - a branch matching the name (as created by bup split -n). -} -checkPresent :: Git.Repo -> Git.Repo -> Key -> Annex (Either IOException Bool) +checkPresent :: Git.Repo -> Git.Repo -> Key -> Annex (Either String Bool) checkPresent r bupr k | Git.repoIsUrl bupr = do showAction $ "checking " ++ Git.repoDescribe r ok <- onBupRemote bupr boolSystem "git" params return $ Right ok - | otherwise = liftIO $ try $ boolSystem "git" $ Git.gitCommandLine params bupr + | otherwise = dispatch <$> localcheck where params = [ Params "show-ref --quiet --verify" , Param $ "refs/heads/" ++ show k] + localcheck = liftIO $ try $ + boolSystem "git" $ Git.gitCommandLine params bupr + dispatch (Left e) = Left $ show e + dispatch (Right v) = Right v {- Store UUID in the annex.uuid setting of the bup repository. -} storeBupUUID :: UUID -> BupRepo -> Annex () |