summaryrefslogtreecommitdiff
path: root/Core.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-11 17:58:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-11 17:58:55 -0400
commitce62f5abf16e578f9f4b86cd140ea2ddfb1e4217 (patch)
treed50e4c639c2eb5a16ff292827378608f4ee6d68d /Core.hs
parentb5ce88dd2aa2d6cc5eac6fd014f94d387c38bce0 (diff)
rework command dispatching for add and pre-commit
Both subcommands do two different operations on different sets of files, so allowing a subcommand to perform a list of operations cleans things up.
Diffstat (limited to 'Core.hs')
-rw-r--r--Core.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Core.hs b/Core.hs
index 8497a7f36..0c06d2310 100644
--- a/Core.hs
+++ b/Core.hs
@@ -224,6 +224,20 @@ getKeysReferenced = do
keypairs <- mapM Backend.lookupFile files
return $ map fst $ catMaybes keypairs
+{- Passed a location (a directory or a single file, returns
+ - files there that are unlocked for editing. -}
+unlockedFiles :: FilePath -> Annex [FilePath]
+unlockedFiles l = do
+ -- unlocked files have changed type from a symlink to a regular file
+ g <- Annex.gitRepo
+ typechangedfiles <- liftIO $ Git.typeChangedFiles g l
+ unlockedfiles <- filterM notsymlink typechangedfiles
+ return unlockedfiles
+ where
+ notsymlink f = do
+ s <- liftIO $ getSymbolicLinkStatus f
+ return $ not $ isSymbolicLink s
+
{- Uses the annex.version git config setting to automate upgrades. -}
autoUpgrade :: Annex ()
autoUpgrade = do