summaryrefslogtreecommitdiff
path: root/Seek.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-08-22 13:57:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-08-22 13:57:07 -0400
commitbc684aaac8572aaaa322ccb49a076bcf6d8faf1a (patch)
tree92ff749fef920aeefaf321023bd9fe10e273b9f2 /Seek.hs
parent274630ac8460425a291ae122f0d5b390a87e5534 (diff)
Fix bug that caused typechanged symlinks to be assumed to be unlocked files, so they were added to the annex by the pre-commit hook.
Diffstat (limited to 'Seek.hs')
-rw-r--r--Seek.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/Seek.hs b/Seek.hs
index 817687b45..b0a634564 100644
--- a/Seek.hs
+++ b/Seek.hs
@@ -26,6 +26,7 @@ import qualified Option
import Config
import Logs.Location
import Logs.Unused
+import Annex.CatFile
seekHelper :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> [FilePath] -> Annex [FilePath]
seekHelper a params = do
@@ -86,12 +87,16 @@ withFilesUnlocked = withFilesUnlocked' LsFiles.typeChanged
withFilesUnlockedToBeCommitted :: (FilePath -> CommandStart) -> CommandSeek
withFilesUnlockedToBeCommitted = withFilesUnlocked' LsFiles.typeChangedStaged
+{- Unlocked files have changed type from a symlink to a regular file.
+ -
+ - Furthermore, unlocked files used to be a git-annex symlink,
+ - not some other sort of symlink.
+ -}
withFilesUnlocked' :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> (FilePath -> CommandStart) -> CommandSeek
-withFilesUnlocked' typechanged a params = do
- -- unlocked files have changed type from a symlink to a regular file
- typechangedfiles <- seekHelper typechanged params
- let unlockedfiles = liftIO $ filterM notSymlink typechangedfiles
- prepFiltered a unlockedfiles
+withFilesUnlocked' typechanged a params = prepFiltered a unlockedfiles
+ where
+ check f = liftIO (notSymlink f) <&&> isJust <$> catKeyFileHEAD f
+ unlockedfiles = filterM check =<< seekHelper typechanged params
{- Finds files that may be modified. -}
withFilesMaybeModified :: (FilePath -> CommandStart) -> CommandSeek