summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
Diffstat (limited to 'Annex')
-rw-r--r--Annex/AdjustedBranch/Name.hs2
-rw-r--r--Annex/Content/PointerFile.hs17
-rw-r--r--Annex/FileMatcher.hs14
-rw-r--r--Annex/Hook.hs18
-rw-r--r--Annex/Init.hs4
-rw-r--r--Annex/Magic.hs9
6 files changed, 45 insertions, 19 deletions
diff --git a/Annex/AdjustedBranch/Name.hs b/Annex/AdjustedBranch/Name.hs
index 8c074af..5987662 100644
--- a/Annex/AdjustedBranch/Name.hs
+++ b/Annex/AdjustedBranch/Name.hs
@@ -49,7 +49,7 @@ instance SerializeAdjustment LinkAdjustment where
serializeAdjustment FixAdjustment = "fixed"
serializeAdjustment UnFixAdjustment = "unfixed"
deserializeAdjustment "unlocked" = Just UnlockAdjustment
- deserializeAdjustment "locked" = Just UnlockAdjustment
+ deserializeAdjustment "locked" = Just LockAdjustment
deserializeAdjustment "fixed" = Just FixAdjustment
deserializeAdjustment "unfixed" = Just UnFixAdjustment
deserializeAdjustment _ = Nothing
diff --git a/Annex/Content/PointerFile.hs b/Annex/Content/PointerFile.hs
index 2949ac9..2ed0db5 100644
--- a/Annex/Content/PointerFile.hs
+++ b/Annex/Content/PointerFile.hs
@@ -9,15 +9,20 @@
module Annex.Content.PointerFile where
+#if ! defined(mingw32_HOST_OS)
+import System.Posix.Files
+#else
import System.PosixCompat.Files
+#endif
import Annex.Common
import Annex.Perms
import Annex.Link
import Annex.ReplaceFile
import Annex.InodeSentinal
-import Utility.InodeCache
import Annex.Content.LowLevel
+import Utility.InodeCache
+import Utility.Touch
{- Populates a pointer file with the content of a key.
-
@@ -48,10 +53,18 @@ populatePointerFile restage k obj f = go =<< liftIO (isPointerFile f)
- Does not check if the pointer file is modified. -}
depopulatePointerFile :: Key -> FilePath -> Annex ()
depopulatePointerFile key file = do
- mode <- liftIO $ catchMaybeIO $ fileMode <$> getFileStatus file
+ st <- liftIO $ catchMaybeIO $ getFileStatus file
+ let mode = fmap fileMode st
secureErase file
liftIO $ nukeFile file
ic <- replaceFile file $ \tmp -> do
liftIO $ writePointerFile tmp key mode
+#if ! defined(mingw32_HOST_OS)
+ -- Don't advance mtime; this avoids unncessary re-smudging
+ -- by git in some cases.
+ liftIO $ maybe noop
+ (\t -> touch tmp t False)
+ (fmap modificationTimeHiRes st)
+#endif
withTSDelta (liftIO . genInodeCache tmp)
maybe noop (restagePointerFile (Restage True) file) ic
diff --git a/Annex/FileMatcher.hs b/Annex/FileMatcher.hs
index 6358049..b41a4a4 100644
--- a/Annex/FileMatcher.hs
+++ b/Annex/FileMatcher.hs
@@ -113,14 +113,14 @@ tokenizeMatcher = filter (not . null) . concatMap splitparens . words
where
splitparens = segmentDelim (`elem` "()")
-commonKeylessTokens :: [ParseToken (MatchFiles Annex)]
-commonKeylessTokens =
+commonKeylessTokens :: LimitBy -> [ParseToken (MatchFiles Annex)]
+commonKeylessTokens lb =
[ SimpleToken "anything" (simply limitAnything)
, SimpleToken "nothing" (simply limitNothing)
, ValueToken "include" (usev limitInclude)
, ValueToken "exclude" (usev limitExclude)
- , ValueToken "largerthan" (usev $ limitSize (>))
- , ValueToken "smallerthan" (usev $ limitSize (<))
+ , ValueToken "largerthan" (usev $ limitSize lb (>))
+ , ValueToken "smallerthan" (usev $ limitSize lb (<))
]
commonKeyedTokens :: [ParseToken (MatchFiles Annex)]
@@ -147,7 +147,7 @@ preferredContentKeylessTokens pcd =
[ SimpleToken "standard" (call $ matchStandard pcd)
, SimpleToken "groupwanted" (call $ matchGroupWanted pcd)
, SimpleToken "inpreferreddir" (simply $ limitInDir preferreddir)
- ] ++ commonKeylessTokens
+ ] ++ commonKeylessTokens LimitAnnexFiles
where
preferreddir = fromMaybe "public" $
M.lookup "preferreddir" =<< (`M.lookup` configMap pcd) =<< repoUUID pcd
@@ -182,7 +182,9 @@ mkLargeFilesParser = do
let mimer n = ValueToken n $
const $ Left $ "\""++n++"\" not supported; not built with MagicMime support"
#endif
- let parse = parseToken $ commonKeyedTokens ++ commonKeylessTokens ++
+ let parse = parseToken $
+ commonKeyedTokens ++
+ commonKeylessTokens LimitDiskFiles ++
#ifdef WITH_MAGICMIME
[ mimer "mimetype" $
matchMagic "mimetype" getMagicMimeType providedMimeType
diff --git a/Annex/Hook.hs b/Annex/Hook.hs
index b56b3bf..69dca86 100644
--- a/Annex/Hook.hs
+++ b/Annex/Hook.hs
@@ -1,10 +1,10 @@
{- git-annex git hooks
-
- - Note that it's important that the scripts installed by git-annex
- - not change, otherwise removing old hooks using an old version of
- - the script would fail.
+ - Note that it's important that the content of scripts installed by
+ - git-annex not change, otherwise removing old hooks using an old
+ - version of the script would fail.
-
- - Copyright 2013-2018 Joey Hess <id@joeyh.name>
+ - Copyright 2013-2019 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@@ -18,6 +18,16 @@ import Utility.Shell
import qualified Data.Map as M
+-- Remove all hooks.
+unHook :: Annex ()
+unHook = do
+ hookUnWrite preCommitHook
+ hookUnWrite postReceiveHook
+ hookUnWrite postCheckoutHook
+ hookUnWrite postMergeHook
+ hookUnWrite preCommitAnnexHook
+ hookUnWrite postUpdateAnnexHook
+
preCommitHook :: Git.Hook
preCommitHook = Git.Hook "pre-commit" (mkHookScript "git annex pre-commit .") []
diff --git a/Annex/Init.hs b/Annex/Init.hs
index bcfe017..e590620 100644
--- a/Annex/Init.hs
+++ b/Annex/Init.hs
@@ -128,8 +128,8 @@ initialize' mversion = checkCanInitialize $ do
uninitialize :: Annex ()
uninitialize = do
- hookUnWrite preCommitHook
- hookUnWrite postReceiveHook
+ unHook
+ deconfigureSmudgeFilter
removeRepoUUID
removeVersion
diff --git a/Annex/Magic.hs b/Annex/Magic.hs
index 6dc823b..8569381 100644
--- a/Annex/Magic.hs
+++ b/Annex/Magic.hs
@@ -17,6 +17,7 @@ module Annex.Magic (
) where
import Types.Mime
+import Control.Monad.IO.Class
#ifdef WITH_MAGICMIME
import Magic
import Utility.Env
@@ -52,8 +53,8 @@ getMagicMime m f = Just . parse <$> magicFile m f
getMagicMime _ _ = return Nothing
#endif
-getMagicMimeType :: Magic -> FilePath -> IO (Maybe MimeType)
-getMagicMimeType m f = fmap fst <$> getMagicMime m f
+getMagicMimeType :: MonadIO m => Magic -> FilePath -> m (Maybe MimeType)
+getMagicMimeType m f = liftIO $ fmap fst <$> getMagicMime m f
-getMagicMimeEncoding :: Magic -> FilePath -> IO (Maybe MimeEncoding)
-getMagicMimeEncoding m f = fmap snd <$> getMagicMime m f
+getMagicMimeEncoding :: MonadIO m => Magic -> FilePath -> m(Maybe MimeEncoding)
+getMagicMimeEncoding m f = liftIO $ fmap snd <$> getMagicMime m f