aboutsummaryrefslogtreecommitdiff
path: root/Command/InAnnex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-09 18:33:15 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-09 18:33:15 -0400
commitd3e1a3619ff6939367f43cbd46131b7f60ef6bd0 (patch)
treebc7e29364f11d3369730b0b61ad58e942b95d1cf /Command/InAnnex.hs
parent2934a65ac5bbab5ac127c495c8c2492e729c2b67 (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 'Command/InAnnex.hs')
-rw-r--r--Command/InAnnex.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/Command/InAnnex.hs b/Command/InAnnex.hs
index 9c169d0d7..c41f9a92c 100644
--- a/Command/InAnnex.hs
+++ b/Command/InAnnex.hs
@@ -19,8 +19,9 @@ seek :: [CommandSeek]
seek = [withKeys start]
start :: Key -> CommandStart
-start key = do
- present <- inAnnex key
- if present
- then stop
- else liftIO exitFailure
+start key = inAnnexSafe key >>= dispatch
+ where
+ dispatch (Just True) = stop
+ dispatch (Just False) = exit 1
+ dispatch Nothing = exit 100
+ exit n = liftIO $ exitWith $ ExitFailure n