summaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-07 16:53:53 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-07 16:53:53 -0400
commit8047bba5b92a6f77ef305c1a74e59b5dacbcc9a2 (patch)
tree79d39ea3299dd356864a6e6539c8ba667356b9dc /Command.hs
parentd2ff311a3496fc498ad540b194767853ffdc1fc0 (diff)
add: If interrupted, add can leave files converted to symlinks but not yet added to git. Running the add again will now clean up this situtation.
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Command.hs b/Command.hs
index 4d5bbeb36..0cd0bf491 100644
--- a/Command.hs
+++ b/Command.hs
@@ -13,7 +13,7 @@ module Command (
prepCommand,
doCommand,
whenAnnexed,
- notAnnexed,
+ ifAnnexed,
notBareRepo,
isBareRepo,
autoCopies,
@@ -71,10 +71,10 @@ doCommand = start
{- Modifies an action to only act on files that are already annexed,
- and passes the key and backend on to it. -}
whenAnnexed :: (FilePath -> (Key, Backend Annex) -> Annex (Maybe a)) -> FilePath -> Annex (Maybe a)
-whenAnnexed a file = maybe (return Nothing) (a file) =<< Backend.lookupFile file
+whenAnnexed a file = ifAnnexed file (a file) (return Nothing)
-notAnnexed :: FilePath -> Annex (Maybe a) -> Annex (Maybe a)
-notAnnexed file a = maybe a (const $ return Nothing) =<< Backend.lookupFile file
+ifAnnexed :: FilePath -> ((Key, Backend Annex) -> Annex a) -> (Annex a) -> Annex a
+ifAnnexed file yes no = maybe no yes =<< Backend.lookupFile file
notBareRepo :: Annex a -> Annex a
notBareRepo a = do