summaryrefslogtreecommitdiff
path: root/CmdLine
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-11-10 15:36:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-11-10 15:36:24 -0400
commitf00d0f9917cd605f27e29ab5d4cfcfc08bdcb3c2 (patch)
treee6d77b4cf8e5059c2ce01fa17ce70f2fa7d6a990 /CmdLine
parentbf19671a7448479811eb441cdb8a526bbe2b6625 (diff)
pre-commit: Block partial commit of unlocked annexed file, since that left a typechange staged in index
I had hoped that the git devs could change git's handling of partial commits to not use a false index file, but seems not. So, this relies on some git internals to detect that case. The test suite has a test case added to catch it if changes to git break it. This commit was sponsored by Paul Tagliamonte.
Diffstat (limited to 'CmdLine')
-rw-r--r--CmdLine/Seek.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/CmdLine/Seek.hs b/CmdLine/Seek.hs
index 238ed4291..9a874807b 100644
--- a/CmdLine/Seek.hs
+++ b/CmdLine/Seek.hs
@@ -107,9 +107,11 @@ withFilesUnlocked' :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> (F
withFilesUnlocked' typechanged a params = seekActions $
prepFiltered a unlockedfiles
where
- check f = liftIO (notSymlink f) <&&>
- (isJust <$> catKeyFile f <||> isJust <$> catKeyFileHEAD f)
- unlockedfiles = filterM check =<< seekHelper typechanged params
+ unlockedfiles = filterM isUnlocked =<< seekHelper typechanged params
+
+isUnlocked :: FilePath -> Annex Bool
+isUnlocked f = liftIO (notSymlink f) <&&>
+ (isJust <$> catKeyFile f <||> isJust <$> catKeyFileHEAD f)
{- Finds files that may be modified. -}
withFilesMaybeModified :: (FilePath -> CommandStart) -> CommandSeek