diff options
author | Joey Hess <joey@kitenet.net> | 2010-11-11 17:58:55 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-11-11 17:58:55 -0400 |
commit | ce62f5abf16e578f9f4b86cd140ea2ddfb1e4217 (patch) | |
tree | d50e4c639c2eb5a16ff292827378608f4ee6d68d /Core.hs | |
parent | b5ce88dd2aa2d6cc5eac6fd014f94d387c38bce0 (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.hs | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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 |