git-annex 10.20230227 → 10.20230321
raw patch · 182 files changed
+733/−460 lines, 182 files
Files
- Annex.hs +1/−1
- Annex/AdjustedBranch.hs +6/−5
- Annex/AdjustedBranch/Name.hs +1/−1
- Annex/AutoMerge.hs +1/−0
- Annex/Branch.hs +5/−5
- Annex/ChangedRefs.hs +1/−1
- Annex/Content.hs +4/−3
- Annex/Content/LowLevel.hs +1/−0
- Annex/Content/PointerFile.hs +4/−3
- Annex/Content/Presence.hs +1/−1
- Annex/CopyFile.hs +5/−3
- Annex/Import.hs +1/−1
- Annex/Ingest.hs +6/−3
- Annex/Init.hs +4/−3
- Annex/Journal.hs +1/−1
- Annex/Link.hs +2/−1
- Annex/Locations.hs +2/−2
- Annex/MetaData.hs +1/−1
- Annex/NumCopies.hs +2/−2
- Annex/Path.hs +1/−1
- Annex/Perms.hs +2/−0
- Annex/Tmp.hs +2/−1
- Annex/View.hs +53/−24
- Annex/View/ViewedFile.hs +1/−1
- Annex/YoutubeDl.hs +1/−1
- Assistant/Alert/Utility.hs +1/−1
- Assistant/Install.hs +2/−0
- Assistant/Install/AutoStart.hs +1/−1
- Assistant/MakeRepo.hs +1/−1
- Assistant/Pairing/Network.hs +1/−1
- Assistant/Ssh.hs +1/−1
- Assistant/Sync.hs +1/−1
- Assistant/Threads/Committer.hs +6/−4
- Assistant/Threads/MountWatcher.hs +1/−1
- Assistant/Threads/NetWatcher.hs +2/−2
- Assistant/Threads/SanityChecker.hs +3/−3
- Assistant/Threads/TransferWatcher.hs +1/−1
- Assistant/Threads/Watcher.hs +3/−2
- Assistant/Types/RepoProblem.hs +1/−1
- Assistant/Unused.hs +2/−2
- Assistant/Upgrade.hs +1/−1
- Assistant/WebApp/Configurators/Fsck.hs +4/−4
- Assistant/WebApp/Configurators/Local.hs +2/−1
- Assistant/WebApp/Configurators/Ssh.hs +1/−1
- Assistant/WebApp/Control.hs +1/−1
- Assistant/WebApp/DashBoard.hs +1/−1
- Assistant/WebApp/SideBar.hs +1/−1
- Backend.hs +1/−1
- Backend/External.hs +2/−2
- Backend/Hash.hs +1/−1
- Backend/WORM.hs +2/−1
- Build/Configure.hs +1/−1
- Build/DesktopFile.hs +1/−1
- Build/TestConfig.hs +1/−1
- CHANGELOG +25/−2
- CmdLine/GitAnnexShell.hs +1/−1
- CmdLine/Seek.hs +6/−4
- Command/Add.hs +2/−2
- Command/Assistant.hs +1/−1
- Command/CalcKey.hs +1/−1
- Command/Fix.hs +2/−1
- Command/Forget.hs +1/−1
- Command/Fsck.hs +2/−1
- Command/FuzzTest.hs +1/−1
- Command/Import.hs +1/−0
- Command/ImportFeed.hs +20/−11
- Command/Info.hs +4/−2
- Command/Lock.hs +2/−0
- Command/Move.hs +4/−1
- Command/P2P.hs +2/−2
- Command/PreCommit.hs +2/−3
- Command/ReKey.hs +2/−0
- Command/Status.hs +1/−1
- Command/Sync.hs +46/−33
- Command/Unannex.hs +2/−0
- Command/Uninit.hs +2/−0
- Command/Unlock.hs +2/−0
- Command/VAdd.hs +2/−2
- Command/VCycle.hs +2/−2
- Command/VFilter.hs +2/−2
- Command/VPop.hs +3/−2
- Command/View.hs +22/−16
- Command/WebApp.hs +1/−1
- Common.hs +1/−1
- Crypto.hs +3/−3
- Database/Keys/SQL.hs +1/−1
- Git.hs +2/−2
- Git/FileMode.hs +1/−1
- Git/GCrypt.hs +1/−1
- Git/HashObject.hs +32/−11
- Git/Hook.hs +4/−1
- Git/LsFiles.hs +1/−1
- Git/PktLine.hs +1/−1
- Git/Queue.hs +1/−1
- Git/Remote.hs +1/−1
- Git/Repair.hs +2/−2
- Git/UnionMerge.hs +3/−3
- Git/UpdateIndex.hs +4/−4
- Limit.hs +6/−5
- Logs/Chunk.hs +1/−1
- Logs/Export.hs +1/−1
- Logs/Export/Pure.hs +1/−1
- Logs/UUID.hs +13/−2
- Logs/UUIDBased.hs +1/−1
- Logs/Unused.hs +1/−1
- Logs/View.hs +50/−20
- Messages.hs +1/−1
- NEWS +2/−2
- P2P/Address.hs +5/−2
- P2P/IO.hs +1/−0
- P2P/Protocol.hs +8/−7
- Remote.hs +1/−1
- Remote/Borg.hs +1/−1
- Remote/Bup.hs +1/−1
- Remote/Ddar.hs +4/−2
- Remote/Directory.hs +4/−3
- Remote/External.hs +2/−2
- Remote/External/AsyncExtension.hs +1/−1
- Remote/Git.hs +2/−5
- Remote/GitLFS.hs +1/−1
- Remote/Helper/Chunked.hs +1/−1
- Remote/Helper/ExportImport.hs +2/−2
- Remote/Helper/Git.hs +3/−1
- Remote/Helper/Ssh.hs +1/−1
- Remote/Rsync.hs +2/−2
- Remote/S3.hs +1/−1
- Remote/Web.hs +1/−1
- Remote/WebDAV.hs +1/−1
- Remote/WebDAV/DavLocation.hs +1/−1
- RemoteDaemon/Common.hs +1/−1
- RemoteDaemon/Types.hs +1/−1
- Test.hs +7/−7
- Test/Framework.hs +9/−7
- Types/Backend.hs +1/−1
- Types/Difference.hs +2/−2
- Types/FileMatcher.hs +1/−1
- Types/Import.hs +1/−1
- Types/RefSpec.hs +3/−3
- Types/Remote.hs +1/−1
- Types/UUID.hs +0/−3
- Upgrade/V0.hs +5/−1
- Upgrade/V1.hs +6/−3
- Upgrade/V5/Direct.hs +1/−1
- Upgrade/V7.hs +2/−1
- Utility/Base64.hs +1/−1
- Utility/Bloom.hs +1/−1
- Utility/Daemon.hs +1/−1
- Utility/DataUnits.hs +3/−3
- Utility/DirWatcher/FSEvents.hs +4/−3
- Utility/DirWatcher/INotify.hs +4/−3
- Utility/DirWatcher/Win32Notify.hs +5/−4
- Utility/Directory.hs +6/−4
- Utility/Glob.hs +3/−3
- Utility/Hash.hs +1/−1
- Utility/HtmlDetect.hs +1/−1
- Utility/IPAddress.hs +2/−2
- Utility/InodeCache.hs +3/−2
- Utility/LockFile/Windows.hs +3/−31
- Utility/LockPool/PidLock.hs +1/−1
- Utility/LockPool/Windows.hs +1/−1
- Utility/Matcher.hs +1/−1
- Utility/Misc.hs +9/−1
- Utility/Path.hs +2/−2
- Utility/Path/AbsRel.hs +1/−1
- Utility/Path/Windows.hs +47/−0
- Utility/QuickCheck.hs +1/−0
- Utility/RawFilePath.hs +41/−12
- Utility/Scheduled.hs +26/−26
- Utility/Scheduled/QuickCheck.hs +1/−1
- Utility/SshConfig.hs +1/−0
- Utility/SystemDirectory.hs +1/−1
- Utility/Tmp.hs +4/−3
- Utility/Tor.hs +3/−1
- Utility/Url.hs +1/−1
- Utility/Yesod.hs +1/−1
- doc/git-annex-adjust.mdwn +3/−1
- doc/git-annex-status.mdwn +1/−1
- doc/git-annex-view.mdwn +2/−0
- doc/git-annex.mdwn +1/−2
- git-annex.cabal +4/−3
- templates/configurators/addia.hamlet +1/−1
- templates/configurators/fsck/formcontent.hamlet +1/−1
Annex.hs view
@@ -400,7 +400,7 @@ r { Git.gitGlobalOpts = go (Git.gitGlobalOpts r) } changeState $ \st -> st { gitconfigoverride = v : gitconfigoverride st } where- -- Remove any prior occurrance of the setting to avoid+ -- Remove any prior occurrence of the setting to avoid -- building up many of them when the adjustment is run repeatedly, -- and add the setting to the end. go [] = [Param "-c", Param v]
Annex/AdjustedBranch.hs view
@@ -1,6 +1,6 @@ {- adjusted branch -- - Copyright 2016-2020 Joey Hess <id@joeyh.name>+ - Copyright 2016-2023 Joey Hess <id@joeyh.name> - - Licensed under the GNU AGPL version 3 or higher. -}@@ -67,6 +67,7 @@ import Types.CleanupActions import qualified Database.Keys import Config+import Logs.View (is_branchView) import qualified Data.Map as M @@ -207,7 +208,7 @@ go currbranch = do let origbranch = fromAdjustedBranch currbranch let adjbranch = adjBranch $ originalToAdjusted origbranch adj- ifM (inRepo (Git.Ref.exists adjbranch) <&&> (not <$> Annex.getRead Annex.force))+ ifM (inRepo (Git.Ref.exists adjbranch) <&&> (not <$> Annex.getRead Annex.force) <&&> pure (not (is_branchView origbranch))) ( do mapM_ (warning . unwords) [ [ "adjusted branch"@@ -459,10 +460,10 @@ _ -> return Nothing {- Check for any commits present on the adjusted branch that have not yet- - been propigated to the basis branch, and propigate them to the basis+ - been propigated to the basis branch, and propagate them to the basis - branch and from there on to the orig branch. -- - After propigating the commits back to the basis banch,+ - After propigating the commits back to the basis branch, - rebase the adjusted branch on top of the updated basis branch. -} propigateAdjustedCommits :: OrigBranch -> Adjustment -> Annex ()@@ -535,7 +536,7 @@ reverseAdjustedCommit :: Sha -> Adjustment -> (Sha, Commit) -> OrigBranch -> Annex (Either String Sha) reverseAdjustedCommit commitparent adj (csha, basiscommit) origbranch | length (commitParent basiscommit) > 1 = return $- Left $ "unable to propigate merge commit " ++ show csha ++ " back to " ++ show origbranch+ Left $ "unable to propagate merge commit " ++ show csha ++ " back to " ++ show origbranch | otherwise = do cmode <- annexCommitMode <$> Annex.getGitConfig treesha <- reverseAdjustedTree commitparent adj csha
Annex/AdjustedBranch/Name.hs view
@@ -88,7 +88,7 @@ adjustedToOriginal :: Branch -> Maybe (Adjustment, OrigBranch) adjustedToOriginal b | adjustedBranchPrefix `S.isPrefixOf` bs = do- let (base, as) = separate' (== openparen) (S.drop prefixlen bs)+ let (base, as) = separateEnd' (== openparen) (S.drop prefixlen bs) adj <- deserializeAdjustment (S.takeWhile (/= closeparen) as) Just (adj, Git.Ref.branchRef (Ref base)) | otherwise = Nothing
Annex/AutoMerge.hs view
@@ -39,6 +39,7 @@ import qualified Data.Set as S import qualified Data.Map as M import qualified Data.ByteString.Lazy as L+import System.PosixCompat.Files (isSymbolicLink) {- Merges from a branch into the current branch (which may not exist yet), - with automatic merge conflict resolution.
Annex/Branch.hs view
@@ -396,7 +396,7 @@ {- Applies a function to modify the content of a file. - - Note that this does not cause the branch to be merged, it only- - modifes the current content of the file on the branch.+ - modifies the current content of the file on the branch. -} change :: Journalable content => RegardingUUID -> RawFilePath -> (L.ByteString -> content) -> Annex () change ru file f = lockJournal $ \jl -> f <$> getToChange ru file >>= set jl ru file@@ -422,7 +422,7 @@ - value it provides is always appended to the journal file. That avoids - reading the journal file, and so can be faster when many lines are being - written to it. The information that is recorded will be effectively the- - same, only obsolate log lines will not get compacted.+ - same, only obsolete log lines will not get compacted. - - Currently, only appends when annex.alwayscompact=false. That is to - avoid appending when an older version of git-annex is also in use in the@@ -494,7 +494,7 @@ invalidateCache {- Commit message used when making a commit of whatever data has changed- - to the git-annex brach. -}+ - to the git-annex branch. -} commitMessage :: Annex String commitMessage = fromMaybe "update" . annexCommitMessage <$> Annex.getGitConfig @@ -624,7 +624,7 @@ {- Populates the branch's index file with the current branch contents. - - This is only done when the index doesn't yet exist, and the index - - is used to build up changes to be commited to the branch, and merge+ - is used to build up changes to be committed to the branch, and merge - in changes from other branches. -} genIndex :: Git.Repo -> IO ()@@ -844,7 +844,7 @@ if L.null content' then do Annex.Queue.addUpdateIndex- =<< inRepo (Git.UpdateIndex.unstageFile (fromRawFilePath file))+ =<< inRepo (Git.UpdateIndex.unstageFile file) -- File is deleted; can't run any other -- transitions on it. return ()
Annex/ChangedRefs.hs view
@@ -106,6 +106,6 @@ sha <- catchDefaultIO Nothing $ extractSha <$> S.readFile reffile -- When the channel is full, there is probably no reader- -- running, or ref changes have been occuring very fast,+ -- running, or ref changes have been occurring very fast, -- so it's ok to not write the change to it. maybe noop (void . atomically . tryWriteTBMChan chan) sha
Annex/Content.hs view
@@ -104,6 +104,7 @@ import qualified Utility.RawFilePath as R import qualified System.FilePath.ByteString as P+import System.PosixCompat.Files (isSymbolicLink, linkCount) {- Prevents the content from being removed while the action is running. - Uses a shared lock.@@ -391,9 +392,9 @@ - with colliding files it's their own fault and B) adding such a check - would not catch all cases of colliding keys. For example, perhaps - a remote has a key; if it's then added again with different content then- - the overall system now has two different peices of content for that+ - the overall system now has two different pieces of content for that - key, and one of them will probably get deleted later. So, adding the- - check here would only raise expectations that git-annex cannot truely+ - check here would only raise expectations that git-annex cannot truly - meet. - - May return false, when a particular variety of key is not being@@ -554,7 +555,7 @@ {- Returns a file that contains an object's content, - and a check to run after the transfer is complete. -- - When a file is unlocked, it's possble for its content to+ - When a file is unlocked, it's possible for its content to - change as it's being sent. The check detects this case - and returns False. -
Annex/Content/LowLevel.hs view
@@ -19,6 +19,7 @@ import qualified Utility.RawFilePath as R import qualified System.FilePath.ByteString as P+import System.PosixCompat.Files (linkCount) {- Runs the secure erase command if set, otherwise does nothing. - File may or may not be deleted at the end; caller is responsible for
Annex/Content/PointerFile.hs view
@@ -22,6 +22,8 @@ import qualified System.Posix.Files as Posix #endif +import System.PosixCompat.Files (fileMode)+ {- Populates a pointer file with the content of a key. - - If the file already has some other content, it is not modified.@@ -53,12 +55,11 @@ - Does not check if the pointer file is modified. -} depopulatePointerFile :: Key -> RawFilePath -> Annex () depopulatePointerFile key file = do- let file' = fromRawFilePath file- st <- liftIO $ catchMaybeIO $ getFileStatus file'+ st <- liftIO $ catchMaybeIO $ R.getFileStatus file let mode = fmap fileMode st secureErase file liftIO $ removeWhenExistsWith R.removeLink file- ic <- replaceWorkTreeFile file' $ \tmp -> do+ ic <- replaceWorkTreeFile (fromRawFilePath file) $ \tmp -> do let tmp' = toRawFilePath tmp liftIO $ writePointerFile tmp' key mode #if ! defined(mingw32_HOST_OS)
Annex/Content/Presence.hs view
@@ -164,7 +164,7 @@ #ifndef mingw32_HOST_OS {- Older versions of git-annex locked content files themselves, but newer - versions use a separate lock file, to better support repos shared- - amoung users in eg a group. -}+ - among users in eg a group. -} contentLockFile key v | versionNeedsWritableContentFiles v = pure Nothing | otherwise = Just <$> calcRepo (gitAnnexContentLock key)
Annex/CopyFile.hs view
@@ -15,10 +15,12 @@ import Utility.FileMode import Utility.Touch import Utility.Hash (IncrementalVerifier(..))+import qualified Utility.RawFilePath as R import Control.Concurrent import qualified Data.ByteString as S import Data.Time.Clock.POSIX+import System.PosixCompat.Files (fileMode) -- To avoid the overhead of trying copy-on-write every time, it's tried -- once and if it fails, is not tried again.@@ -64,7 +66,7 @@ {- Copies from src to dest, updating a meter. Preserves mode and mtime. - Uses copy-on-write if it is supported. If the the destination already- - exists, an interruped copy will resume where it left off.+ - exists, an interrupted copy will resume where it left off. - - The IncrementalVerifier is updated with the content of the file as it's - being copied. But it is not finalized at the end.@@ -101,9 +103,9 @@ fileContentCopier hsrc dest meterupdate iv -- Copy src mode and mtime.- mode <- fileMode <$> getFileStatus src+ mode <- fileMode <$> R.getFileStatus (toRawFilePath src) mtime <- utcTimeToPOSIXSeconds <$> getModificationTime src- setFileMode dest mode+ R.setFileMode dest' mode touch dest' mtime False return Copied
Annex/Import.hs view
@@ -492,7 +492,7 @@ startimport cidmap importing db i@(loc, (cid, _sz)) oldversion largematcher = getcidkey cidmap db cid >>= \case (k:ks) -> -- If the same content was imported before- -- yeilding multiple different keys, it's not clear+ -- yielding multiple different keys, it's not clear -- which is best to use this time, so pick the -- first in the list. But, if any of them is a -- git sha, use it, because the content must
Annex/Ingest.hs view
@@ -51,6 +51,8 @@ import Annex.FileMatcher import qualified Utility.RawFilePath as R +import System.PosixCompat.Files (fileMode)+ data LockedDown = LockedDown { lockDownConfig :: LockDownConfig , keySource :: KeySource@@ -120,11 +122,12 @@ `catchIO` const (nohardlink' delta) withhardlink' delta tmpfile = do- createLink file tmpfile- cache <- genInodeCache (toRawFilePath tmpfile) delta+ let tmpfile' = toRawFilePath tmpfile+ R.createLink file' tmpfile'+ cache <- genInodeCache tmpfile' delta return $ LockedDown cfg $ KeySource { keyFilename = file'- , contentLocation = toRawFilePath tmpfile+ , contentLocation = tmpfile' , inodeCache = cache }
Annex/Init.hs view
@@ -62,6 +62,7 @@ import qualified Data.Map as M import Control.Monad.IO.Class (MonadIO)+import System.PosixCompat.Files (ownerReadMode, isNamedPipe) #ifndef mingw32_HOST_OS import Data.Either import qualified System.FilePath.ByteString as P@@ -296,7 +297,7 @@ probe f = catchDefaultIO (True, []) $ do let f2 = f ++ "2" liftIO $ removeWhenExistsWith R.removeLink (toRawFilePath f2)- liftIO $ createSymbolicLink f f2+ liftIO $ R.createSymbolicLink (toRawFilePath f) (toRawFilePath f2) liftIO $ removeWhenExistsWith R.removeLink (toRawFilePath f2) (fromMaybe (liftIO . preventWrite) freezecontent) (toRawFilePath f) -- Should be unable to write to the file (unless@@ -372,7 +373,7 @@ removeWhenExistsWith R.removeLink f removeWhenExistsWith R.removeLink f2 ms <- tryIO $ do- createNamedPipe (fromRawFilePath f) ownerReadMode+ R.createNamedPipe f ownerReadMode R.createLink f f2 R.getFileStatus f removeWhenExistsWith R.removeLink f@@ -420,7 +421,7 @@ trustSet u UnTrusted setConfig (annexConfig "hardlink") (Git.Config.boolConfig True) -{- Propigate annex.securehashesonly from then global config to local+{- Propagate annex.securehashesonly from then global config to local - config. This makes a clone inherit a parent's setting, but once - a repository has a local setting, changes to the global config won't - affect it. -}
Annex/Journal.hs view
@@ -73,7 +73,7 @@ {- Records content for a file in the branch to the journal. -- - Using the journal, rather than immediatly staging content to the index+ - Using the journal, rather than immediately staging content to the index - avoids git needing to rewrite the index after every change. - - The file in the journal is updated atomically. This avoids an
Annex/Link.hs view
@@ -43,6 +43,7 @@ import qualified Data.ByteString.Char8 as S8 import qualified Data.ByteString.Lazy as L import qualified System.FilePath.ByteString as P+import System.PosixCompat.Files (isSymbolicLink) type LinkTarget = S.ByteString @@ -138,7 +139,7 @@ stagePointerFile :: RawFilePath -> Maybe FileMode -> Sha -> Annex () stagePointerFile file mode sha = Annex.Queue.addUpdateIndex =<<- inRepo (Git.UpdateIndex.stageFile sha treeitemtype $ fromRawFilePath file)+ inRepo (Git.UpdateIndex.stageFile sha treeitemtype file) where treeitemtype | maybe False isExecutable mode = TreeExecutable
Annex/Locations.hs view
@@ -580,7 +580,7 @@ - dealing with characters that cause problems. - - This is used when a new Key is initially being generated, eg by genKey.- - Unlike keyFile and fileKey, it does not need to be a reversable+ - Unlike keyFile and fileKey, it does not need to be a reversible - escaping. Also, it's ok to change this to add more problematic - characters later. Unlike changing keyFile, which could result in the - filenames used for existing keys changing and contents getting lost.@@ -666,7 +666,7 @@ where f = keyFile key -{- All possibile locations to store a key in a special remote+{- All possible locations to store a key in a special remote - using different directory hashes. - - This is compatible with the annexLocationsNonBare and annexLocationsBare,
Annex/MetaData.hs view
@@ -111,7 +111,7 @@ ('>':v) -> checkcmp (>) (>) v _ -> checkglob "" checkglob v =- let cglob = compileGlob v CaseInsensative (GlobFilePath False)+ let cglob = compileGlob v CaseInsensitive (GlobFilePath False) in matchGlob cglob . decodeBS . fromMetaValue checkcmp cmp cmp' v mv' = let v' = decodeBS (fromMetaValue mv')
Annex/NumCopies.hs view
@@ -185,7 +185,7 @@ {- Checks if numcopies are satisfied for a file by running a comparison - between the number of (not untrusted) copies that are- - belived to exist, and the configured value.+ - believed to exist, and the configured value. - - This is good enough for everything except dropping the file, which - requires active verification of the copies.@@ -203,7 +203,7 @@ data UnVerifiedCopy = UnVerifiedRemote Remote | UnVerifiedHere deriving (Ord, Eq) -{- Verifies that enough copies of a key exist amoung the listed remotes,+{- Verifies that enough copies of a key exist among the listed remotes, - to safely drop it, running an action with a proof if so, and - printing an informative message if not. -}
Annex/Path.hs view
@@ -95,7 +95,7 @@ - to daemonize it. Used with Utility.Daemon.daemonize. -} gitAnnexDaemonizeParams :: Annex [CommandParam] gitAnnexDaemonizeParams = do- -- This inclues -c parameters passed to git, as well as ones+ -- This includes -c parameters passed to git, as well as ones -- passed to git-annex. cps <- gitAnnexGitConfigOverrides -- Get every parameter git-annex was run with.
Annex/Perms.hs view
@@ -44,6 +44,8 @@ import Utility.Directory.Create import qualified Utility.RawFilePath as R +import System.PosixCompat.Files (fileMode, intersectFileModes, nullFileMode, groupWriteMode, ownerWriteMode, ownerReadMode, groupReadMode, stdFileMode, ownerExecuteMode, groupExecuteMode)+ withShared :: (SharedRepository -> Annex a) -> Annex a withShared a = a =<< coreSharedRepository <$> Annex.getGitConfig
Annex/Tmp.hs view
@@ -15,6 +15,7 @@ import qualified Utility.RawFilePath as R import Data.Time.Clock.POSIX+import System.PosixCompat.Files (modificationTime) -- | For creation of tmp files, other than for key's contents. --@@ -66,7 +67,7 @@ cleanold f = do now <- liftIO getPOSIXTime let oldenough = now - (60 * 60 * 24 * 7)- catchMaybeIO (modificationTime <$> getSymbolicLinkStatus f) >>= \case+ catchMaybeIO (modificationTime <$> R.getSymbolicLinkStatus (toRawFilePath f)) >>= \case Just mtime | realToFrac mtime <= oldenough -> void $ tryIO $ removeWhenExistsWith R.removeLink (toRawFilePath f) _ -> return ()
Annex/View.hs view
@@ -12,6 +12,7 @@ import Annex.Common import Annex.View.ViewedFile import Types.View+import Types.AdjustedBranch import Types.MetaData import Annex.MetaData import qualified Annex@@ -32,6 +33,7 @@ import Annex.Link import Annex.CatFile import Annex.Concurrent+import Annex.Content.Presence import Logs import Logs.MetaData import Logs.View@@ -174,7 +176,7 @@ combineViewFilter (FilterValues _) newglob@(FilterGlob _) = (newglob, Widening) combineViewFilter (FilterGlob oldglob) new@(FilterValues s)- | all (matchGlob (compileGlob oldglob CaseInsensative (GlobFilePath False)) . decodeBS . fromMetaValue) (S.toList s) = (new, Narrowing)+ | all (matchGlob (compileGlob oldglob CaseInsensitive (GlobFilePath False)) . decodeBS . fromMetaValue) (S.toList s) = (new, Narrowing) | otherwise = (new, Widening) {- With two globs, the old one is discarded, and the new one is used. - We can tell if that's a narrowing change by checking if the old@@ -183,7 +185,7 @@ - widening. -} combineViewFilter (FilterGlob old) newglob@(FilterGlob new) | old == new = (newglob, Unchanged)- | matchGlob (compileGlob old CaseInsensative (GlobFilePath False)) new = (newglob, Narrowing)+ | matchGlob (compileGlob old CaseInsensitive (GlobFilePath False)) new = (newglob, Narrowing) | otherwise = (newglob, Widening) {- Combining FilterValuesOrUnset and FilterGlobOrUnset with FilterValues - and FilterGlob maintains the OrUnset if the second parameter has it,@@ -218,7 +220,7 @@ in (new, viewchange) combineViewFilter (FilterGlobOrUnset old _) newglob@(FilterGlobOrUnset new _) | old == new = (newglob, Unchanged)- | matchGlob (compileGlob old CaseInsensative (GlobFilePath False)) new = (newglob, Narrowing)+ | matchGlob (compileGlob old CaseInsensitive (GlobFilePath False)) new = (newglob, Narrowing) | otherwise = (newglob, Widening) combineViewFilter (FilterGlob _) newglob@(FilterGlobOrUnset _ _) = (newglob, Widening)@@ -283,7 +285,7 @@ matcher matchunset (FilterValues s) = \values -> setmatches matchunset $ S.intersection s values matcher matchunset (FilterGlob glob) =- let cglob = compileGlob glob CaseInsensative (GlobFilePath False)+ let cglob = compileGlob glob CaseInsensitive (GlobFilePath False) in \values -> setmatches matchunset $ S.filter (matchGlob cglob . decodeBS . fromMetaValue) values matcher _ (ExcludeValues excludes) = @@ -418,7 +420,7 @@ {- Applies a view to the currently checked out branch, generating a new - branch for the view. -}-applyView :: View -> Annex Git.Branch+applyView :: View -> Maybe Adjustment -> Annex Git.Branch applyView = applyView' viewedFileFromReference getWorkTreeMetaData {- Generates a new branch for a View, which must be a more narrow@@ -426,7 +428,7 @@ - checked out branch. That is, it must match a subset of the files - in view, not any others. -}-narrowView :: View -> Annex Git.Branch+narrowView :: View -> Maybe Adjustment -> Annex Git.Branch narrowView = applyView' viewedFileReuse getViewedFileMetaData {- Go through each staged file.@@ -435,26 +437,27 @@ - Look up the metadata of annexed files, and generate any ViewedFiles, - and stage them. -}-applyView' :: MkViewedFile -> (FilePath -> MetaData) -> View -> Annex Git.Branch-applyView' mkviewedfile getfilemetadata view = do+applyView' :: MkViewedFile -> (FilePath -> MetaData) -> View -> Maybe Adjustment -> Annex Git.Branch+applyView' mkviewedfile getfilemetadata view madj = do top <- fromRepo Git.repoPath (l, clean) <- inRepo $ Git.LsFiles.inRepoDetails [] [top]- applyView'' mkviewedfile getfilemetadata view l clean $ + applyView'' mkviewedfile getfilemetadata view madj l clean $ \(f, sha, mode) -> do topf <- inRepo (toTopFilePath f) k <- lookupKey f return (topf, sha, toTreeItemType mode, k)- genViewBranch view+ genViewBranch view madj applyView'' :: MkViewedFile -> (FilePath -> MetaData) -> View+ -> Maybe Adjustment -> [t] -> IO Bool -> (t -> Annex (TopFilePath, Sha, Maybe TreeItemType, Maybe Key)) -> Annex ()-applyView'' mkviewedfile getfilemetadata view l clean conv = do+applyView'' mkviewedfile getfilemetadata view madj l clean conv = do viewg <- withNewViewIndex gitRepo withUpdateIndex viewg $ \uh -> do g <- Annex.gitRepo@@ -489,13 +492,13 @@ getmetadata gc mdfeeder mdcloser ts process uh mdreader = liftIO mdreader >>= \case- Just ((topf, _, _, Just k), mdlog) -> do+ Just ((topf, _, mtreeitemtype, Just k), mdlog) -> do let metadata = maybe emptyMetaData parseCurrentMetaData mdlog let f = fromRawFilePath $ getTopFilePath topf let metadata' = getfilemetadata f `unionMetaData` metadata forM_ (genviewedfiles f metadata') $ \fv -> do f' <- fromRepo (fromTopFilePath $ asTopFilePath $ toRawFilePath fv)- stagesymlink uh f' =<< calcRepo (gitAnnexLink f' k)+ stagefile uh f' k mtreeitemtype process uh mdreader Just ((topf, sha, Just treeitemtype, Nothing), _) -> do liftIO $ Git.UpdateIndex.streamUpdateIndex' uh $@@ -504,10 +507,36 @@ Just _ -> process uh mdreader Nothing -> return () - stagesymlink uh f linktarget = do+ stagefile uh f k mtreeitemtype = case madj of+ Nothing -> stagesymlink uh f k+ Just (LinkAdjustment UnlockAdjustment) ->+ stagepointerfile uh f k mtreeitemtype+ Just (LinkPresentAdjustment UnlockPresentAdjustment) ->+ ifM (inAnnex k)+ ( stagepointerfile uh f k mtreeitemtype+ , stagesymlink uh f k+ )+ Just (PresenceAdjustment HideMissingAdjustment (Just UnlockAdjustment)) ->+ whenM (inAnnex k) $+ stagepointerfile uh f k mtreeitemtype+ Just (PresenceAdjustment HideMissingAdjustment _) ->+ whenM (inAnnex k) $+ stagesymlink uh f k+ _ -> stagesymlink uh f k++ stagesymlink uh f k = do+ linktarget <- calcRepo (gitAnnexLink f k) sha <- hashSymlink linktarget liftIO . Git.UpdateIndex.streamUpdateIndex' uh =<< inRepo (Git.UpdateIndex.stageSymlink f sha)+ + stagepointerfile uh f k mtreeitemtype = do+ let treeitemtype = if mtreeitemtype == Just TreeExecutable+ then TreeExecutable+ else TreeFile+ sha <- hashPointerFile k+ liftIO . Git.UpdateIndex.streamUpdateIndex' uh+ =<< inRepo (Git.UpdateIndex.stageFile sha treeitemtype f) {- Updates the current view with any changes that have been made to its - parent branch or the metadata since the view was created or last updated.@@ -518,13 +547,13 @@ - This is not very optimised. An incremental update would be possible to - implement and would be faster, but more complicated. -}-updateView :: View -> Annex (Maybe Git.Ref)-updateView view = do+updateView :: View -> Maybe Adjustment -> Annex (Maybe Git.Ref)+updateView view madj = do (l, clean) <- inRepo $ Git.LsTree.lsTree Git.LsTree.LsTreeRecursive (Git.LsTree.LsTreeLong True) (viewParentBranch view)- applyView'' viewedFileFromReference getWorkTreeMetaData view l clean $+ applyView'' viewedFileFromReference getWorkTreeMetaData view madj l clean $ \ti -> do let ref = Git.Ref.branchFileRef (viewParentBranch view) (getTopFilePath (Git.LsTree.file ti))@@ -537,13 +566,13 @@ , (toTreeItemType (Git.LsTree.mode ti)) , k )- oldcommit <- inRepo $ Git.Ref.sha (branchView view)+ oldcommit <- inRepo $ Git.Ref.sha (branchView view madj) oldtree <- maybe (pure Nothing) (inRepo . Git.Ref.tree) oldcommit newtree <- withViewIndex $ inRepo Git.Branch.writeTree if oldtree /= Just newtree then Just <$> do cmode <- annexCommitMode <$> Annex.getGitConfig- let msg = "updated " ++ fromRef (branchView view)+ let msg = "updated " ++ fromRef (branchView view madj) let parent = catMaybes [oldcommit] inRepo (Git.Branch.commitTree cmode msg parent newtree) else return Nothing@@ -593,12 +622,12 @@ {- Generates a branch for a view, using the view index file - to make a commit to the view branch. The view branch is not - checked out, but entering it will display the view. -}-genViewBranch :: View -> Annex Git.Branch-genViewBranch view = withViewIndex $ do- let branch = branchView view+genViewBranch :: View -> Maybe Adjustment -> Annex Git.Branch+genViewBranch view madj = withViewIndex $ do+ let branch = branchView view madj cmode <- annexCommitMode <$> Annex.getGitConfig void $ inRepo $ Git.Branch.commit cmode True (fromRef branch) branch [] return branch -withCurrentView :: (View -> Annex a) -> Annex a-withCurrentView a = maybe (giveup "Not in a view.") a =<< currentView+withCurrentView :: (View -> Maybe Adjustment -> Annex a) -> Annex a+withCurrentView a = maybe (giveup "Not in a view.") (uncurry a) =<< currentView
Annex/View/ViewedFile.hs view
@@ -29,7 +29,7 @@ {- Converts a filepath used in a reference branch to the - filename that will be used in the view. -- - No two filepaths from the same branch should yeild the same result,+ - No two filepaths from the same branch should yield the same result, - so all directory structure needs to be included in the output filename - in some way. -
Annex/YoutubeDl.hs view
@@ -58,7 +58,7 @@ -- and youtube-dl needs to finish up with only one file in the directory -- so we know which one it downloaded. ----- (Note that we can't use --output to specifiy the file to download to,+-- (Note that we can't use --output to specify the file to download to, -- due to <https://github.com/rg3/youtube-dl/issues/14864>) youtubeDl :: URLString -> FilePath -> MeterUpdate -> Annex (Either String (Maybe FilePath)) youtubeDl url workdir p = ifM ipAddressesUnlimited
Assistant/Alert/Utility.hs view
@@ -35,7 +35,7 @@ - - High priority alerts, newest first - - Medium priority Activity, newest first (mostly used for Activity) - - Low priority alerts, newest first- - - Filler priorty alerts, newest first+ - - Filler priority alerts, newest first - - Ties are broken by the AlertClass, with Errors etc coming first. -} compareAlertPairs :: AlertPair -> AlertPair -> Ordering
Assistant/Install.hs view
@@ -27,6 +27,8 @@ import Utility.Android #endif +import System.PosixCompat.Files (ownerExecuteMode)+ standaloneAppBase :: IO (Maybe FilePath) standaloneAppBase = getEnv "GIT_ANNEX_APP_BASE"
Assistant/Install/AutoStart.hs view
@@ -14,7 +14,7 @@ #ifdef darwin_HOST_OS import Utility.OSX import Utility.Path-import Utility.Directory+import Utility.SystemDirectory import Utility.FileSystemEncoding #endif
Assistant/MakeRepo.hs view
@@ -68,7 +68,7 @@ {- Repositories directly managed by the assistant use - an adjusted unlocked branch with annex.thin set. - - - Automatic gc is disabled, as it can be slow. Insted, gc is done+ - Automatic gc is disabled, as it can be slow. Instead, gc is done - once a day. -} when primary_assistant_repo $ do
Assistant/Pairing/Network.hs view
@@ -27,7 +27,7 @@ {- This is an arbitrary port in the dynamic port range, that could - conceivably be used for some other broadcast messages.- - If so, hope they ignore the garbage from us; we'll certianly+ - If so, hope they ignore the garbage from us; we'll certainly - ignore garbage from them. Wild wild west. -} pairingPort :: PortNumber pairingPort = 55556
Assistant/Ssh.hs view
@@ -361,7 +361,7 @@ - non-alphanumerics, other than "_" - - The real hostname is not normally encoded at all. This is done for- - backwards compatability and to avoid unnecessary ugliness in the+ - backwards compatibility and to avoid unnecessary ugliness in the - filename. However, when it contains special characters - (notably ":" which cannot be used on some filesystems), it is url - encoded. To indicate it was encoded, the mangled hostname
Assistant/Sync.hs view
@@ -107,7 +107,7 @@ - When there's a lot of activity, we may fail more than once. - On the other hand, we may fail because the remote is not available. - Rather than retrying indefinitely, after the first retry we enter a- - fallback mode, where our push is guarenteed to succeed if the remote is+ - fallback mode, where our push is guaranteed to succeed if the remote is - reachable. If the fallback fails, the push is queued to be retried - later. -
Assistant/Threads/Committer.hs view
@@ -40,12 +40,14 @@ import qualified Command.Sync import Utility.Tuple import Utility.Metered+import qualified Utility.RawFilePath as R import Data.Time.Clock import qualified Data.Set as S import qualified Data.Map as M import Data.Either import Control.Concurrent+import System.PosixCompat.Files (fileID, deviceID, fileMode) {- This thread makes git commits at appropriate times. -} commitThread :: NamedThread@@ -93,7 +95,7 @@ - runs an action to commit them. If more changes arrive while this is - going on, they're handled intelligently, batching up changes into - large commits where possible, doing rename detection, and- - commiting immediately otherwise. -}+ - committing immediately otherwise. -} waitChangeTime :: (([Change], UTCTime) -> Assistant Int) -> Assistant () waitChangeTime a = waitchanges 0 where@@ -358,7 +360,7 @@ done change file key = liftAnnex $ do logStatus key InfoPresent- mode <- liftIO $ catchMaybeIO $ fileMode <$> getFileStatus file+ mode <- liftIO $ catchMaybeIO $ fileMode <$> R.getFileStatus (toRawFilePath file) stagePointerFile (toRawFilePath file) mode =<< hashPointerFile key showEndOk return $ Just $ finishedChange change key@@ -367,8 +369,8 @@ - and is still a hard link to its contentLocation, - before ingesting it. -} sanitycheck keysource a = do- fs <- liftIO $ getSymbolicLinkStatus $ fromRawFilePath $ keyFilename keysource- ks <- liftIO $ getSymbolicLinkStatus $ fromRawFilePath $ contentLocation keysource+ fs <- liftIO $ R.getSymbolicLinkStatus $ keyFilename keysource+ ks <- liftIO $ R.getSymbolicLinkStatus $ contentLocation keysource if deviceID ks == deviceID fs && fileID ks == fileID fs then a else do
Assistant/Threads/MountWatcher.hs view
@@ -111,7 +111,7 @@ , startOneService client xs ) -{- Filter matching events recieved when drives are mounted and unmounted. -} +{- Filter matching events received when drives are mounted and unmounted. -} mountChanged :: [MatchRule] mountChanged = [udisks2mount, udisks2umount] where
Assistant/Threads/NetWatcher.hs view
@@ -163,9 +163,9 @@ - ConnectResultsSent: - Variant "success" -- - Diconnection example:+ - Disconnection example: - StatusChanged- - [Variant 0, Variant [Varient ""]]+ - [Variant 0, Variant [Variant ""]] -} listenWicdConnections :: Client -> (Bool -> IO ()) -> IO () listenWicdConnections client setconnected = do
Assistant/Threads/SanityChecker.hs view
@@ -53,6 +53,7 @@ import Data.Time.Clock.POSIX import qualified Data.Text as T+import System.PosixCompat.Files (statusChangeTime, isSymbolicLink) {- This thread runs once at startup, and most other threads wait for it - to finish. (However, the webapp thread does not, to prevent the UI@@ -156,11 +157,10 @@ (unstaged, cleanup) <- liftIO $ Git.LsFiles.notInRepo [] False ["."] g now <- liftIO getPOSIXTime forM_ unstaged $ \file -> do- let file' = fromRawFilePath file- ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file'+ ms <- liftIO $ catchMaybeIO $ R.getSymbolicLinkStatus file case ms of Just s | toonew (statusChangeTime s) now -> noop- | isSymbolicLink s -> addsymlink file' ms+ | isSymbolicLink s -> addsymlink (fromRawFilePath file) ms _ -> noop liftIO $ void cleanup
Assistant/Threads/TransferWatcher.hs view
@@ -80,7 +80,7 @@ \i -> i { bytesComplete = bytesComplete newinfo } {- This thread can only watch transfer sizes when the DirWatcher supports- - tracking modificatons to files. -}+ - tracking modifications to files. -} watchesTransferSize :: Bool watchesTransferSize = modifyTracked
Assistant/Threads/Watcher.hs view
@@ -51,6 +51,7 @@ import qualified Data.ByteString.Lazy as L import qualified Control.Exception as E import Data.Time.Clock+import System.PosixCompat.Files (fileMode, statusChangeTime) checkCanWatch :: Annex () checkCanWatch@@ -218,7 +219,7 @@ unlessM (inAnnex oldkey) $ logStatus oldkey InfoMissing addlink file key = do- mode <- liftIO $ catchMaybeIO $ fileMode <$> getFileStatus file+ mode <- liftIO $ catchMaybeIO $ fileMode <$> R.getFileStatus (toRawFilePath file) liftAnnex $ stagePointerFile (toRawFilePath file) mode =<< hashPointerFile key madeChange file $ LinkChange (Just key) @@ -341,7 +342,7 @@ topfile <- inRepo (toTopFilePath (toRawFilePath file)) withkey $ flip Database.Keys.removeAssociatedFile topfile Annex.Queue.addUpdateIndex =<<- inRepo (Git.UpdateIndex.unstageFile file)+ inRepo (Git.UpdateIndex.unstageFile (toRawFilePath file)) where withkey a = maybe noop a =<< catKeyFile (toRawFilePath file)
Assistant/Types/RepoProblem.hs view
@@ -18,7 +18,7 @@ , afterFix :: IO () } -{- The afterFix actions are assumed to all be equivilant. -}+{- The afterFix actions are assumed to all be equivalent. -} sameRepoProblem :: RepoProblem -> RepoProblem -> Bool sameRepoProblem = (==) `on` problemUUID
Assistant/Unused.hs view
@@ -79,7 +79,7 @@ lockContentForRemoval k noop removeAnnex logStatus k InfoMissing where- boundry = durationToPOSIXTime <$> duration- tooold now (_, mt) = case boundry of+ boundary = durationToPOSIXTime <$> duration+ tooold now (_, mt) = case boundary of Nothing -> True Just b -> maybe False (\t -> now - t >= b) mt
Assistant/Upgrade.hs view
@@ -222,7 +222,7 @@ makeorigsymlink olddir = do let origdir = fromRawFilePath (parentDir (toRawFilePath olddir)) </> installBase removeWhenExistsWith R.removeLink (toRawFilePath origdir)- createSymbolicLink newdir origdir+ R.createSymbolicLink (toRawFilePath newdir) (toRawFilePath origdir) {- Finds where the old version was installed. -} oldVersionLocation :: IO FilePath
Assistant/WebApp/Configurators/Fsck.hs view
@@ -67,14 +67,14 @@ (reposRes, reposView) <- mreq (selectFieldList repolist) (bfs "") (Just ru) (durationRes, durationView) <- mreq intField (bfs "") (Just $ durationSeconds d `quot` 60 ) (timeRes, timeView) <- mreq (selectFieldList times) (bfs "") (Just t)- (recurranceRes, recurranceView) <- mreq (selectFieldList recurrances) (bfs "") (Just r)+ (recurrenceRes, recurrenceView) <- mreq (selectFieldList recurrences) (bfs "") (Just r) let form = do webAppFormAuthToken $(widgetFile "configurators/fsck/formcontent") let formresult = mkFsck <$> pure u <*> reposRes- <*> (Schedule <$> recurranceRes <*> timeRes)+ <*> (Schedule <$> recurrenceRes <*> timeRes) <*> (Duration <$> ((60 *) <$> durationRes)) return (formresult, form) where@@ -82,8 +82,8 @@ times = ensurevalue t (T.pack $ fromScheduledTime t) $ map (\x -> (T.pack $ fromScheduledTime x, x)) $ AnyTime : map (\h -> SpecificTime h 0) [0..23]- recurrances :: [(Text, Recurrance)]- recurrances = ensurevalue r (T.pack $ fromRecurrance r) $+ recurrences :: [(Text, Recurrence)]+ recurrences = ensurevalue r (T.pack $ fromRecurrence r) $ [ ("every day", Daily) , ("every Sunday", Weekly $ Just 1) , ("every Monday", Weekly $ Just 2)
Assistant/WebApp/Configurators/Local.hs view
@@ -40,6 +40,7 @@ import qualified Types.Remote import Utility.Android import Types.ProposedAccepted+import qualified Utility.RawFilePath as R import qualified Data.Text as T import qualified Data.Map as M@@ -421,7 +422,7 @@ ( return dir , return $ fromRawFilePath $ parentDir $ toRawFilePath dir )- catchBoolIO $ fileAccess tocheck False True False+ catchBoolIO $ R.fileAccess (toRawFilePath tocheck) False True False {- Gets the UUID of the git repo at a location, which may not exist, or - not be a git-annex repo. -}
Assistant/WebApp/Configurators/Ssh.hs view
@@ -642,7 +642,7 @@ - used on rsync.net. If successful, runs an action with its SshData. - - To append the ssh key to rsync.net's authorized_keys, their- - documentation recommends a dd methodd, where the line is fed+ - documentation recommends a dd method, where the line is fed - in to ssh over stdin. -} prepRsyncNet :: SshInput -> String -> (SshData -> Handler Html) -> Handler Html
Assistant/WebApp/Control.hs view
@@ -52,7 +52,7 @@ {- Use a custom page to avoid putting long polling elements on it that will - fail and cause thet web browser to show an error once the webapp is- - truely stopped. -}+ - truly stopped. -} getNotRunningR :: Handler Html getNotRunningR = customPage' False Nothing $ $(widgetFile "control/notrunning")
Assistant/WebApp/DashBoard.hs view
@@ -48,7 +48,7 @@ AssociatedFile (Just af) -> fromRawFilePath af {- Simplifies a list of transfers, avoiding display of redundant- - equivilant transfers. -}+ - equivalent transfers. -} simplifyTransfers :: [(Transfer, TransferInfo)] -> [(Transfer, TransferInfo)] simplifyTransfers [] = [] simplifyTransfers (x:[]) = [x]
Assistant/WebApp/SideBar.hs view
@@ -66,7 +66,7 @@ waitNotifier getAlertBroadcaster nid {- This 0.1 second delay avoids very transient notifications from- - being displayed and churning the sidebar unnecesarily. + - being displayed and churning the sidebar unnecessarily. - - This needs to be below the level perceptable by the user, - to avoid slowing down user actions like closing alerts. -}
Backend.hs view
@@ -34,7 +34,7 @@ import qualified Data.Map as M -{- Build-in backends. Does not include externals. -}+{- Built-in backends. Does not include externals. -} builtinList :: [Backend] builtinList = Backend.Hash.backends ++ Backend.WORM.backends ++ Backend.URL.backends
Backend/External.hs view
@@ -158,7 +158,7 @@ where line = unwords $ Proto.formatMessage m -{- A response handler can yeild a result, or it can request that another+{- A response handler can yield a result, or it can request that another - message be consumed from the external. -} data ResponseHandlerResult a = Result a@@ -170,7 +170,7 @@ result = Just . return . Result {- Waits for a message from the external backend, and passes it to the- - apppropriate handler. + - appropriate handler. - - If the handler returns Nothing, this is a protocol error. -}
Backend/Hash.hs view
@@ -281,7 +281,7 @@ descChecksum :: String descChecksum = "checksum" -{- A varient of the SHA256E backend, for testing that needs special keys+{- A variant of the SHA256E backend, for testing that needs special keys - that cannot collide with legitimate keys in the repository. - - This is accomplished by appending a special extension to the key,
Backend/WORM.hs view
@@ -14,10 +14,11 @@ import Backend.Utilities import Git.FilePath import Utility.Metered+import qualified Utility.RawFilePath as R import qualified Data.ByteString.Char8 as S8-import qualified Utility.RawFilePath as R import qualified Data.ByteString.Short as S (toShort, fromShort)+import System.PosixCompat.Files (modificationTime) backends :: [Backend] backends = [backend]
Build/Configure.hs view
@@ -10,7 +10,7 @@ import Utility.SafeCommand import Utility.Env.Basic import qualified Git.Version-import Utility.Directory+import Utility.SystemDirectory import Control.Monad import Control.Applicative
Build/DesktopFile.hs view
@@ -15,7 +15,7 @@ import Utility.FreeDesktop import Utility.Path import Utility.Monad-import Utility.Directory+import Utility.SystemDirectory import Utility.FileSystemEncoding import Config.Files import Utility.OSX
Build/TestConfig.hs view
@@ -7,7 +7,7 @@ import Utility.Path import Utility.Monad import Utility.SafeCommand-import Utility.Directory+import Utility.SystemDirectory import System.IO import System.FilePath
CHANGELOG view
@@ -1,3 +1,26 @@+git-annex (10.20230321) upstream; urgency=medium++ * Using git-annex view in an adjusted branch, or git-annex adjust in a+ view branch, will enter an adjusted view branch.+ * sync: Fix a reversion that prevented sending files to exporttree=yes+ remotes when annex-tracking-branch was configured to branch:subdir+ (Introduced in version 10.20230214)+ * status: This command is deprecated because it was only needed in direct+ mode; git status --short is very similar.+ * Windows: Support long filenames in more (possibly all) of the code.+ * Added arm64 build for ancient kernels, needed to support Android phones+ whose kernels are too old to support kernels used by the current arm64+ build.+ * importfeed: Display feed title.+ * init: Support being ran in a repository that has a newline in its path.+ * copy: When --from and --to are combined and the content is already+ present on the destination remote, update location tracking as+ necessary.+ * Fixed spelling of some messages and added a .codespellrc+ Thanks, Yaroslav Halchenko++ -- Joey Hess <id@joeyh.name> Tue, 21 Mar 2023 16:13:46 -0400+ git-annex (10.20230227) upstream; urgency=medium * Fix more breakage caused by git's fix for CVE-2022-24765, this time@@ -5096,14 +5119,14 @@ * metadata: Field names limited to alphanumerics and a few whitelisted punctuation characters to avoid issues with views, etc.- * metadata: Field names are now case insensative.+ * metadata: Field names are now case insensitive. * When constructing views, metadata is available about the location of the file in the view's reference branch. Allows incorporating parts of the directory hierarchy in a view. For example `git annex view tag=* podcasts/=*` makes a view in the form tag/showname. * --metadata field=value can now use globs to match, and matches- case insensatively, the same as git annex view field=value does.+ case insensitively, the same as git annex view field=value does. * annex.genmetadata can be set to make git-annex automatically set metadata (year and month) when adding files. * Make annex.web-options be used in several places that call curl.
CmdLine/GitAnnexShell.hs view
@@ -40,7 +40,7 @@ readonlycmds = map addAnnexOptions [ Command.ConfigList.cmd , gitAnnexShellCheck Command.NotifyChanges.cmd- -- p2pstdio checks the enviroment variables to+ -- p2pstdio checks the environment variables to -- determine the security policy to use , gitAnnexShellCheck Command.P2PStdIO.cmd , gitAnnexShellCheck Command.InAnnex.cmd
CmdLine/Seek.hs view
@@ -52,6 +52,7 @@ import System.Posix.Types import Data.IORef import Data.Time.Clock.POSIX+import System.PosixCompat.Files (isDirectory, isSymbolicLink, deviceID, fileID) import qualified System.FilePath.ByteString as P data AnnexedFileSeeker = AnnexedFileSeeker@@ -114,7 +115,7 @@ -- fail if the path that the user provided is a broken symlink, -- the same as it fails if the path that the user provided does not -- exist.- get p = ifM (isDirectory <$> getFileStatus p)+ get p = ifM (isDirectory <$> R.getFileStatus p') ( map (\f -> let f' = toRawFilePath f in (f', P.makeRelative (P.takeDirectory (P.dropTrailingPathSeparator p')) f'))@@ -562,8 +563,9 @@ currbranch <- getCurrentBranch stopattop <- prepviasymlink ps' <- flip filterM ps $ \p -> do- relf <- liftIO $ relPathCwdToFile $ toRawFilePath p- ifM (not <$> (exists p <||> hidden currbranch relf))+ let p' = toRawFilePath p+ relf <- liftIO $ relPathCwdToFile p'+ ifM (not <$> (exists p' <||> hidden currbranch relf)) ( prob (p ++ " not found") , ifM (viasymlink stopattop (upFrom relf)) ( prob (p ++ " is beyond a symbolic link")@@ -574,7 +576,7 @@ then return NoWorkTreeItems else return (WorkTreeItems ps') - exists p = isJust <$> liftIO (catchMaybeIO $ getSymbolicLinkStatus p)+ exists p = isJust <$> liftIO (catchMaybeIO $ R.getSymbolicLinkStatus p) prepviasymlink = do repotopst <- inRepo $
Command/Add.hs view
@@ -31,7 +31,7 @@ import qualified Utility.RawFilePath as R import qualified System.FilePath.ByteString as P -import System.PosixCompat.Files (fileSize)+import System.PosixCompat.Files (fileSize, isSymbolicLink, isRegularFile, modificationTime, fileID, deviceID, fileMode, ownerExecuteMode, intersectFileModes) cmd :: Command cmd = notBareRepo $ @@ -182,7 +182,7 @@ =<< withTSDelta (liftIO . genInodeCache file) Large -> noop Annex.Queue.addUpdateIndex =<<- inRepo (stageFile sha treetype (fromRawFilePath file))+ inRepo (stageFile sha treetype file) return True where changed a b =
Command/Assistant.hs view
@@ -94,7 +94,7 @@ , putStrLn "failed" ) return Nothing- -- Wait for any foreground jobs to finish and propigate exit status.+ -- Wait for any foreground jobs to finish and propagate exit status. ifM (all (== True) <$> mapConcurrently checkSuccessProcess (catMaybes pids)) ( exitSuccess , exitFailure
Command/CalcKey.hs view
@@ -16,7 +16,7 @@ cmd = noCommit $ noMessages $ dontCheck repoExists $ withAnnexOptions [backendOption] $ command "calckey" SectionPlumbing - "calulate key for a file"+ "calculate key for a file" (paramRepeating paramFile) (batchable run (pure ()))
Command/Fix.hs view
@@ -19,9 +19,10 @@ import qualified Database.Keys import qualified Utility.RawFilePath as R +import System.PosixCompat.Files (fileMode, linkCount) #if ! defined(mingw32_HOST_OS)-import Utility.Touch import qualified System.Posix.Files as Posix+import Utility.Touch #endif cmd :: Command
Command/Forget.hs view
@@ -48,7 +48,7 @@ perform :: Transitions -> Bool -> CommandPerform perform ts True = do recordTransitions (Branch.change (Branch.RegardingUUID [])) ts- -- get branch committed before contining with the transition+ -- get branch committed before continuing with the transition _ <- Branch.update void $ Branch.performTransitions ts True [] next $ return True
Command/Fsck.hs view
@@ -49,6 +49,7 @@ import qualified Data.Map as M import Data.Either import qualified System.FilePath.ByteString as P+import System.PosixCompat.Files (fileMode, isSymbolicLink, modificationTime) cmd :: Command cmd = withAnnexOptions [jobsOption, jsonOptions, annexedMatchingOptions] $@@ -666,7 +667,7 @@ {- Records the start time of an incremental fsck. -- - To guard against time stamp damange (for example, if an annex directory+ - To guard against time stamp damage (for example, if an annex directory - is copied without -a), the fsckstate file contains a time that should - be identical to its modification time. - (This is not possible to do on Windows, and so the timestamp in
Command/FuzzTest.hs view
@@ -274,4 +274,4 @@ ) doesnotexist :: FilePath -> IO Bool-doesnotexist f = isNothing <$> catchMaybeIO (getSymbolicLinkStatus f)+doesnotexist f = isNothing <$> catchMaybeIO (R.getSymbolicLinkStatus (toRawFilePath f))
Command/Import.hs view
@@ -37,6 +37,7 @@ import qualified Utility.RawFilePath as R import Control.Concurrent.STM+import System.PosixCompat.Files (isDirectory, isSymbolicLink, isRegularFile) cmd :: Command cmd = notBareRepo $
Command/ImportFeed.hs view
@@ -16,6 +16,7 @@ import Text.Feed.Types import qualified Data.Set as S import qualified Data.Map as M+import Data.Char import Data.Time.Clock import Data.Time.Format import Data.Time.Calendar@@ -50,6 +51,7 @@ import Annex.UntrustedFilePath import qualified Annex.Branch import Logs+import qualified Utility.RawFilePath as R cmd :: Command cmd = notBareRepo $ withAnnexOptions [backendOption] $@@ -92,15 +94,22 @@ -- ourselves because it goes out of its way to handle encodings. go tmpf = liftIO (parseFeedFromFile' tmpf) >>= \case Nothing -> debugfeedcontent tmpf "parsing the feed failed"- Just f -> case findDownloads url f of- [] -> debugfeedcontent tmpf "bad feed content; no enclosures to download"- l -> do- showEndOk- ifM (and <$> mapM (performDownload addunlockedmatcher opts cache) l)- ( clearFeedProblem url- , void $ feedProblem url - "problem downloading some item(s) from feed"- )+ Just f -> do+ case map sanitizetitle $ decodeBS $ fromFeedText $ getFeedTitle f of+ "" -> noop+ t -> showNote ('"' : t ++ "\"")+ case findDownloads url f of+ [] -> debugfeedcontent tmpf "bad feed content; no enclosures to download"+ l -> do+ showEndOk+ ifM (and <$> mapM (performDownload addunlockedmatcher opts cache) l)+ ( clearFeedProblem url+ , void $ feedProblem url + "problem downloading some item(s) from feed"+ )+ sanitizetitle c+ | isControl c = '_'+ | otherwise = c debugfeedcontent tmpf msg = do feedcontent <- liftIO $ readFile tmpf fastDebug "Command.ImportFeed" $ unlines@@ -312,7 +321,7 @@ let (d, base) = splitFileName file in d </> show n ++ "_" ++ base tryanother = makeunique url (n + 1) file- alreadyexists = liftIO $ isJust <$> catchMaybeIO (getSymbolicLinkStatus f)+ alreadyexists = liftIO $ isJust <$> catchMaybeIO (R.getSymbolicLinkStatus (toRawFilePath f)) checksameurl k = ifM (elem url <$> getUrls k) ( return Nothing , tryanother@@ -510,7 +519,7 @@ - - So, it's not safe to use T.unpack to convert that to a String, - because later use of that String by eg encodeBS will crash- - with an encoding error. Use this instad.+ - with an encoding error. Use this instead. - - This should not be used on a Text that is read using the - filesystem encoding because it does not reverse that encoding.
Command/Info.hs view
@@ -13,6 +13,7 @@ import qualified Data.Map.Strict as M import qualified Data.Vector as V import qualified System.FilePath.ByteString as P+import System.PosixCompat.Files (isDirectory) import Data.Ord import qualified Data.Semigroup as Sem import Prelude@@ -47,6 +48,7 @@ import Messages.JSON (DualDisp(..), ObjectMap(..)) import Annex.BloomFilter import qualified Command.Unused+import qualified Utility.RawFilePath as R -- a named computation that produces a statistic type Stat = StatState (Maybe (String, StatState String))@@ -163,7 +165,7 @@ return True itemInfo :: InfoOptions -> (SeekInput, String) -> Annex ()-itemInfo o (si, p) = ifM (isdir p)+itemInfo o (si, p) = ifM (isdir (toRawFilePath p)) ( dirInfo o p si , Remote.byName' p >>= \case Right r -> remoteInfo o r si@@ -177,7 +179,7 @@ (_us, msg) -> noInfo p si msg ) where- isdir = liftIO . catchBoolIO . (isDirectory <$$> getFileStatus)+ isdir = liftIO . catchBoolIO . (isDirectory <$$> R.getFileStatus) noInfo :: String -> SeekInput -> String -> Annex () noInfo s si msg = do
Command/Lock.hs view
@@ -20,6 +20,8 @@ import Logs.Location import Git.FilePath import qualified Utility.RawFilePath as R++import System.PosixCompat.Files (linkCount) cmd :: Command cmd = withAnnexOptions [jsonOptions, annexedMatchingOptions] $
Command/Move.hs view
@@ -356,7 +356,7 @@ - drop the local copy, and finally drop from the src. - - Using a regular download of the local copy, rather than download to- - some other file makes resuming an interruped download work as usual,+ - some other file makes resuming an interrupted download work as usual, - and simplifies implementation. It does mean that, if `git-annex get` of - the same content is being run at the same time as this move, the content - may end up locally present, or not. This is similar to the behavior @@ -399,6 +399,9 @@ Right True -> do showAction $ "from " ++ Remote.name src showAction $ "to " ++ Remote.name dest+ -- The log may not indicate dest's copy+ -- yet, so make sure it does.+ logChange key (Remote.uuid dest) InfoPresent -- Drop from src, checking copies including -- the one already in dest. dropfromsrc id
Command/P2P.hs view
@@ -87,7 +87,7 @@ -- Only addresses are output to stdout, to allow scripting. genAddresses :: [P2PAddress] -> Annex ()-genAddresses [] = giveup "No P2P networks are currrently available."+genAddresses [] = giveup "No P2P networks are currently available." genAddresses addrs = do authtoken <- liftIO $ genAuthToken 128 storeP2PAuthToken authtoken@@ -124,7 +124,7 @@ AuthenticationError e -> giveup e startPairing :: RemoteName -> [P2PAddress] -> CommandStart-startPairing _ [] = giveup "No P2P networks are currrently available."+startPairing _ [] = giveup "No P2P networks are currently available." startPairing remotename addrs = ifM (liftIO Wormhole.isInstalled) ( starting "p2p pair" ai si $ performPairing remotename addrs
Command/PreCommit.hs view
@@ -45,10 +45,9 @@ runAnnexHook preCommitAnnexHook -- committing changes to a view updates metadata- mv <- currentView- case mv of+ currentView >>= \case Nothing -> noop- Just v -> withViewChanges+ Just (v, _madj) -> withViewChanges (addViewMetaData v) (removeViewMetaData v)
Command/ReKey.hs view
@@ -20,6 +20,8 @@ import Utility.InodeCache import qualified Utility.RawFilePath as R +import System.PosixCompat.Files (linkCount, fileMode)+ cmd :: Command cmd = command "rekey" SectionPlumbing "change keys used for files"
Command/Status.hs view
@@ -15,7 +15,7 @@ cmd = notBareRepo $ noCommit $ noMessages $ withAnnexOptions [jsonOptions] $ command "status" SectionCommon- "show the working tree status"+ "show the working tree status (deprecated)" paramPaths (seek <$$> optParser) data StatusOptions = StatusOptions
Command/Sync.hs view
@@ -439,34 +439,38 @@ updateBranches :: CurrBranch -> Annex () updateBranches (Nothing, _) = noop updateBranches (Just branch, madj) = do- -- When in an adjusted branch, propigate any changes made to it- -- back to the original branch. The adjusted branch may also need- -- to be updated, if the adjustment is not stable, and the usual- -- configuration does not update it.- case madj of- Just adj -> do- let origbranch = branch- propigateAdjustedCommits origbranch adj- unless (adjustmentIsStable adj) $- annexAdjustedBranchRefresh <$> Annex.getGitConfig >>= \case- 0 -> adjustedBranchRefreshFull adj origbranch- _ -> return ()- -- When in a view branch, update it to reflect any changes- -- of its parent branch or the metadata.- Nothing -> currentView >>= \case+ -- When in a view branch, update it to reflect any changes+ -- of its parent branch or the metadata.+ currentView >>= \case+ Just (view, madj') -> updateView view madj' >>= \case Nothing -> noop- Just view -> updateView view >>= \case- Nothing -> noop- Just newcommit -> do- ok <- inRepo $ Git.Command.runBool- [ Param "merge"- , Param (Git.fromRef newcommit)- ]- unless ok $- giveup $ "failed to update view"- + Just newcommit -> do+ ok <- inRepo $ Git.Command.runBool+ [ Param "merge"+ , Param (Git.fromRef newcommit)+ ]+ unless ok $+ giveup $ "failed to update view"+ case madj' of+ Nothing -> noop+ Just adj -> updateadjustedbranch adj+ -- When in an adjusted branch, propagate any changes+ -- made to it back to the original branch.+ Nothing -> case madj of+ Just adj -> do+ propigateAdjustedCommits branch adj+ updateadjustedbranch adj+ Nothing -> noop+ -- Update the sync branch to match the new state of the branch inRepo $ updateBranch (syncBranch branch) (fromViewBranch branch)+ where+ -- The adjusted branch may also need to be updated, if the adjustment+ -- is not stable, and the usual configuration does not update it.+ updateadjustedbranch adj = unless (adjustmentIsStable adj) $+ annexAdjustedBranchRefresh <$> Annex.getGitConfig >>= \case+ 0 -> adjustedBranchRefreshFull adj branch+ _ -> return () updateBranch :: Git.Branch -> Git.Branch -> Git.Repo -> IO () updateBranch syncbranch updateto g = @@ -517,12 +521,8 @@ | not (pullOption o) || not wantpull = noop | otherwise = case remoteAnnexTrackingBranch (Remote.gitconfig remote) of Nothing -> noop- Just tb -> do- let (b, p) = separate' (== (fromIntegral (ord ':'))) (Git.fromRef' tb)- let branch = Git.Ref b- let subdir = if S.null p- then Nothing- else Just (asTopFilePath p)+ Just b -> do+ let (branch, subdir) = splitRemoteAnnexTrackingBranchSubdir b if canImportKeys remote importcontent then do Command.Import.seekRemote remote branch subdir importcontent (CheckGitIgnore True)@@ -739,7 +739,7 @@ ) {- Without --all, only looks at files in the work tree.- - (Or, when in an ajusted branch where some files are hidden, at files in+ - (Or, when in an adjusted branch where some files are hidden, at files in - the original branch.) - - With --all, when preferred content expressions look at filenames,@@ -922,8 +922,12 @@ Nothing -> cannotupdateexport r db Nothing True Just b -> do mtree <- inRepo $ Git.Ref.tree b+ let addsubdir = case snd (splitRemoteAnnexTrackingBranchSubdir b) of+ Just subdir -> \cb -> Git.Ref $+ Git.fromRef' cb <> ":" <> getTopFilePath subdir+ Nothing -> id mcurrtree <- maybe (pure Nothing)- (inRepo . Git.Ref.tree)+ (inRepo . Git.Ref.tree . addsubdir) currbranch mtbcommitsha <- Command.Export.getExportCommit r b case (mtree, mcurrtree, mtbcommitsha) of@@ -1025,3 +1029,12 @@ isThirdPartyPopulated :: Remote -> Bool isThirdPartyPopulated = Remote.thirdPartyPopulated . Remote.remotetype++splitRemoteAnnexTrackingBranchSubdir :: Git.Ref -> (Git.Ref, Maybe TopFilePath)+splitRemoteAnnexTrackingBranchSubdir tb = (branch, subdir)+ where+ (b, p) = separate' (== (fromIntegral (ord ':'))) (Git.fromRef' tb)+ branch = Git.Ref b+ subdir = if S.null p+ then Nothing+ else Just (asTopFilePath p)
Command/Unannex.hs view
@@ -19,6 +19,8 @@ import Git.FilePath import qualified Utility.RawFilePath as R +import System.PosixCompat.Files (linkCount)+ cmd :: Command cmd = withAnnexOptions [annexedMatchingOptions] $ command "unannex" SectionUtility
Command/Uninit.hs view
@@ -22,6 +22,8 @@ import Utility.FileMode import qualified Utility.RawFilePath as R +import System.PosixCompat.Files (linkCount)+ cmd :: Command cmd = addCheck check $ command "uninit" SectionUtility
Command/Unlock.hs view
@@ -18,6 +18,8 @@ import qualified Database.Keys import qualified Utility.RawFilePath as R +import System.PosixCompat.Files (fileMode)+ cmd :: Command cmd = mkcmd "unlock" "unlock files for modification"
Command/VAdd.hs view
@@ -23,7 +23,7 @@ start :: [String] -> CommandStart start params = starting "vadd" (ActionItemOther Nothing) (SeekInput params) $ - withCurrentView $ \view -> do+ withCurrentView $ \view madj -> do vu <- annexViewUnsetDirectory <$> Annex.getGitConfig let (view', change) = refineView view $ map (parseViewParam vu) (reverse params)@@ -34,5 +34,5 @@ Narrowing -> next $ do if visibleViewSize view' == visibleViewSize view then giveup "That would not add an additional level of directory structure to the view. To filter the view, use vfilter instead of vadd."- else checkoutViewBranch view' narrowView+ else checkoutViewBranch view' madj narrowView Widening -> giveup "Widening view to match more files is not currently supported."
Command/VCycle.hs view
@@ -26,13 +26,13 @@ start = go =<< currentView where go Nothing = giveup "Not in a view."- go (Just v) = starting "vcycle" (ActionItemOther Nothing) (SeekInput []) $ do+ go (Just (v, madj)) = starting "vcycle" (ActionItemOther Nothing) (SeekInput []) $ do let v' = v { viewComponents = vcycle [] (viewComponents v) } if v == v' then do showNote "unchanged" next $ return True- else next $ checkoutViewBranch v' narrowView+ else next $ checkoutViewBranch v' madj narrowView vcycle rest (c:cs) | viewVisible c = rest ++ cs ++ [c]
Command/VFilter.hs view
@@ -22,10 +22,10 @@ start :: [String] -> CommandStart start params = starting "vfilter" (ActionItemOther Nothing) (SeekInput params) $- withCurrentView $ \view -> do+ withCurrentView $ \view madj -> do vu <- annexViewUnsetDirectory <$> Annex.getGitConfig let view' = filterView view $ map (parseViewParam vu) (reverse params) next $ if visibleViewSize view' > visibleViewSize view then giveup "That would add an additional level of directory structure to the view, rather than filtering it. If you want to do that, use vadd instead of vfilter."- else checkoutViewBranch view' narrowView+ else checkoutViewBranch view' madj narrowView
Command/VPop.hs view
@@ -27,7 +27,7 @@ start ps = go =<< currentView where go Nothing = giveup "Not in a view."- go (Just v) = starting "vpop" ai si $ do+ go (Just (v, madj)) = starting "vpop" ai si $ do removeView v (oldvs, vs) <- splitAt (num - 1) . filter (sameparentbranch v) <$> recentViews@@ -35,7 +35,8 @@ case vs of (oldv:_) -> next $ do showOutput- checkoutViewBranch oldv (return . branchView)+ checkoutViewBranch oldv madj+ (\v' madj' -> return (branchView v' madj')) _ -> next $ do showOutput inRepo $ Git.Command.runBool
Command/View.hs view
@@ -1,6 +1,6 @@ {- git-annex command -- - Copyright 2014 Joey Hess <id@joeyh.name>+ - Copyright 2014-2023 Joey Hess <id@joeyh.name> - - Licensed under the GNU AGPL version 3 or higher. -}@@ -19,6 +19,8 @@ import Types.View import Annex.View import Logs.View+import Types.AdjustedBranch+import Annex.AdjustedBranch.Name import qualified System.FilePath.ByteString as P @@ -34,16 +36,16 @@ start [] = giveup "Specify metadata to include in view" start ps = ifM safeToEnterView ( do- view <- mkView ps- go view =<< currentView+ (view, madj) <- mkView ps+ go view madj =<< currentView , giveup "Not safe to enter view." ) where ai = ActionItemOther Nothing si = SeekInput ps- go view Nothing = starting "view" ai si $- perform view- go view (Just v)+ go view madj Nothing = starting "view" ai si $+ perform view madj+ go view _ (Just (v, _madj)) | v == view = stop | otherwise = giveup "Already in a view. Use the vfilter and vadd commands to further refine this view." @@ -72,28 +74,32 @@ -- view. dangerous (StagedUnstaged { unstaged = Just _ }) = True -perform :: View -> CommandPerform-perform view = do+perform :: View -> Maybe Adjustment -> CommandPerform+perform view madj = do showAction "searching"- next $ checkoutViewBranch view applyView+ next $ checkoutViewBranch view madj applyView paramView :: String paramView = paramRepeating "TAG FIELD=GLOB ?TAG FIELD?=GLOB FIELD!=VALUE" -mkView :: [String] -> Annex View+mkView :: [String] -> Annex (View, Maybe Adjustment) mkView ps = go =<< inRepo Git.Branch.current where go Nothing = giveup "not on any branch!"- go (Just b) = do+ go (Just b) = case adjustedToOriginal b of+ Nothing -> go' b Nothing+ Just (adj, b') -> go' b' (Just adj)+ go' b madj = do vu <- annexViewUnsetDirectory <$> Annex.getGitConfig- return $ fst $ refineView (View b []) $+ let v = fst $ refineView (View b []) $ map (parseViewParam vu) (reverse ps)+ return (v, madj) -checkoutViewBranch :: View -> (View -> Annex Git.Branch) -> CommandCleanup-checkoutViewBranch view mkbranch = do+checkoutViewBranch :: View -> Maybe Adjustment -> (View -> Maybe Adjustment -> Annex Git.Branch) -> CommandCleanup+checkoutViewBranch view madj mkbranch = do here <- liftIO getCurrentDirectory - branch <- mkbranch view+ branch <- mkbranch view madj showOutput ok <- inRepo $ Git.Command.runBool@@ -104,7 +110,7 @@ setView view {- A git repo can easily have empty directories in it, - and this pollutes the view, so remove them.- - (However, emptry directories used by submodules are not+ - (However, empty directories used by submodules are not - removed.) -} top <- liftIO . absPath =<< fromRepo Git.repoPath (l, cleanup) <- inRepo $
Command/WebApp.hs view
@@ -103,7 +103,7 @@ liftIO $ firstRun o {- If HOME is a git repo, even if it's initialized for git-annex,- - the user almost certianly does not want to run the assistant there. -}+ - the user almost certainly does not want to run the assistant there. -} notHome :: Annex Bool notHome = do g <- Annex.gitRepo
Common.hs view
@@ -13,7 +13,7 @@ import System.FilePath as X import System.IO as X hiding (FilePath) import System.Exit as X-import System.PosixCompat.Files as X hiding (fileSize, removeLink, rename)+import System.PosixCompat.Files as X (FileStatus) import Utility.Misc as X import Utility.Exception as X
Crypto.hs view
@@ -1,7 +1,7 @@ {- git-annex crypto - - Currently using gpg; could later be modified to support different- - crypto backends if neccessary.+ - crypto backends if necessary. - - Copyright 2011-2022 Joey Hess <id@joeyh.name> -@@ -62,7 +62,7 @@ - (ideally) 64 and 128 bytes of entropy. - - The remaining characters (320 bytes of entropy) is enough for GnuPG's- - symetric cipher; unlike weaker public key crypto, the key does not+ - symmetric cipher; unlike weaker public key crypto, the key does not - need to be too large. -} cipherBeginning :: Int@@ -164,7 +164,7 @@ type EncKey = Key -> Key {- Generates an encrypted form of a Key. The encryption does not need to be- - reversable, nor does it need to be the same type of encryption used+ - reversible, nor does it need to be the same type of encryption used - on content. It does need to be repeatable. -} encryptKey :: Mac -> Cipher -> EncKey encryptKey mac c k = mkKey $ \d -> d
Database/Keys/SQL.hs view
@@ -33,7 +33,7 @@ -- Note on indexes: KeyFileIndex etc are really uniqueness constraints, -- which cause sqlite to automatically add indexes. So when adding indexes, -- have to take care to only add ones that work as uniqueness constraints.--- (Unfortunatly persistent does not support indexes that are not+-- (Unfortunately persistent does not support indexes that are not -- uniqueness constraints; https://github.com/yesodweb/persistent/issues/109) -- -- To speed up queries for a key, there's KeyFileIndex,
Git.hs view
@@ -1,6 +1,6 @@ {- git repository handling -- - This is written to be completely independant of git-annex and should be+ - This is written to be completely independent of git-annex and should be - suitable for other uses. - - Copyright 2010-2021 Joey Hess <id@joeyh.name>@@ -79,7 +79,7 @@ repoPath Repo { location = Local { gitdir = d } } = d repoPath Repo { location = LocalUnknown dir } = dir repoPath Repo { location = Unknown } = error "unknown repoPath"-repoPath Repo { location = UnparseableUrl _u } = error "unknwon repoPath"+repoPath Repo { location = UnparseableUrl _u } = error "unknown repoPath" repoWorkTree :: Repo -> Maybe RawFilePath repoWorkTree Repo { location = Local { worktree = Just d } } = Just d
Git/FileMode.hs view
@@ -15,7 +15,7 @@ symLinkMode = 40960 {- Git uses a special file mode to indicate a symlink. This is the case- - even on Windows, so we hard code the valuse here, rather than using+ - even on Windows, so we hard code the values here, rather than using - System.Posix.Files.symbolicLinkMode. -} isSymLink :: FileMode -> Bool isSymLink = checkMode symLinkMode
Git/GCrypt.hs view
@@ -85,7 +85,7 @@ type GCryptId = String -{- gcrypt gives each encrypted repository a uique gcrypt-id,+{- gcrypt gives each encrypted repository a unique gcrypt-id, - which is stored in the repository (in encrypted form) - and cached in a per-remote gcrypt-id configuration setting. -} remoteRepoId :: Repo -> Maybe RemoteName -> Maybe GCryptId
Git/HashObject.hs view
@@ -1,6 +1,6 @@ {- git hash-object interface -- - Copyright 2011-2019 Joey Hess <id@joeyh.name>+ - Copyright 2011-2023 Joey Hess <id@joeyh.name> - - Licensed under the GNU AGPL version 3 or higher. -}@@ -21,26 +21,47 @@ import qualified Data.ByteString.Char8 as S8 import qualified Data.ByteString.Lazy as L import Data.ByteString.Builder+import Data.Char -type HashObjectHandle = CoProcess.CoProcessHandle+data HashObjectHandle = HashObjectHandle CoProcess.CoProcessHandle Repo [CommandParam] hashObjectStart :: Bool -> Repo -> IO HashObjectHandle-hashObjectStart writeobject = gitCoProcessStart True $ catMaybes- [ Just (Param "hash-object")- , if writeobject then Just (Param "-w") else Nothing- , Just (Param "--stdin-paths")- , Just (Param "--no-filters")- ]+hashObjectStart writeobject repo = do+ h <- gitCoProcessStart True (ps ++ [Param "--stdin-paths"]) repo+ return (HashObjectHandle h repo ps)+ where+ ps = catMaybes+ [ Just (Param "hash-object")+ , if writeobject then Just (Param "-w") else Nothing+ , Just (Param "--no-filters")+ ] hashObjectStop :: HashObjectHandle -> IO ()-hashObjectStop = CoProcess.stop+hashObjectStop (HashObjectHandle h _ _) = CoProcess.stop h {- Injects a file into git, returning the Sha of the object. -} hashFile :: HashObjectHandle -> RawFilePath -> IO Sha-hashFile h file = CoProcess.query h send receive+hashFile hdl@(HashObjectHandle h _ _) file = do+ -- git hash-object chdirs to the top of the repository on+ -- start, so if the filename is relative, it will+ -- not work. This seems likely to be a git bug.+ -- So, make the filename absolute, which will work now+ -- and also if git's behavior later changes.+ file' <- absPath file+ if newline `S.elem` file'+ then hashFile' hdl file+ else CoProcess.query h (send file') receive where- send to = S8.hPutStrLn to =<< absPath file+ send file' to = S8.hPutStrLn to file' receive from = getSha "hash-object" $ S8.hGetLine from+ newline = fromIntegral (ord '\n')++{- Runs git hash-object once per call, rather than using a running+ - one, so is slower. But, is able to handle newlines in the filepath,+ - which --stdin-paths cannot. -}+hashFile' :: HashObjectHandle -> RawFilePath -> IO Sha+hashFile' (HashObjectHandle _ repo ps) file = getSha "hash-object" $+ pipeReadStrict (ps ++ [File (fromRawFilePath file)]) repo class HashableBlob t where hashableBlobToHandle :: Handle -> t -> IO ()
Git/Hook.hs view
@@ -14,7 +14,10 @@ import Utility.Tmp import Utility.Shell import Utility.FileMode+import qualified Utility.RawFilePath as R +import System.PosixCompat.Files (fileMode)+ data Hook = Hook { hookName :: FilePath , hookScript :: String@@ -88,7 +91,7 @@ let f = hookFile h r catchBoolIO $ #ifndef mingw32_HOST_OS- isExecutable . fileMode <$> getFileStatus f+ isExecutable . fileMode <$> R.getFileStatus (toRawFilePath f) #else doesFileExist f #endif
Git/LsFiles.hs view
@@ -325,7 +325,7 @@ && isus x || isus y && not (isus x && isus y) -{- Gets the InodeCache equivilant information stored in the git index.+{- Gets the InodeCache equivalent information stored in the git index. - - Note that this uses a --debug option whose output could change at some - point in the future. If the output is not as expected, will use Nothing.
Git/PktLine.hs view
@@ -33,7 +33,7 @@ import Utility.FileSystemEncoding {- This is a variable length binary string, but its size is limited to- - maxPktLineLength. Its serialization includes a 4 byte hexidecimal+ - maxPktLineLength. Its serialization includes a 4 byte hexadecimal - prefix giving its total length, including that prefix. -} newtype PktLine = PktLine B.ByteString deriving (Show)
Git/Queue.hs view
@@ -119,7 +119,7 @@ {- Adds an git command to the queue. - - Git commands with the same subcommand but different parameters are- - assumed to be equivilant enough to perform in any order with the same+ - assumed to be equivalent enough to perform in any order with the same - end result. -} addCommand :: MonadIO m => [CommandParam] -> String -> [CommandParam] -> [FilePath] -> Queue m -> Repo -> m (Queue m)
Git/Remote.hs view
@@ -43,7 +43,7 @@ {- Construct a legal git remote name out of an arbitrary input string. - - There seems to be no formal definition of this in the git source,- - just some ad-hoc checks, and some other things that fail with certian+ - just some ad-hoc checks, and some other things that fail with certain - types of names (like ones starting with '-'). -} makeLegalName :: String -> RemoteName
Git/Repair.hs view
@@ -103,7 +103,7 @@ return True {- Try to retrieve a set of missing objects, from the remotes of a- - repository. Returns any that could not be retreived.+ - repository. Returns any that could not be retrieved. - - If another clone of the repository exists locally, which might not be a - remote of the repo being repaired, its path can be passed as a reference@@ -433,7 +433,7 @@ reinject (file, sha, mode, _) = case toTreeItemType mode of Nothing -> return Nothing Just treeitemtype -> Just <$>- UpdateIndex.stageFile sha treeitemtype (fromRawFilePath file) r+ UpdateIndex.stageFile sha treeitemtype file r newtype GoodCommits = GoodCommits (S.Set Sha)
Git/UnionMerge.hs view
@@ -108,9 +108,9 @@ -} calcMerge :: [(Ref, [L8.ByteString])] -> Either Ref [L8.ByteString] calcMerge shacontents- | null reuseable = Right new- | otherwise = Left $ fst $ Prelude.head reuseable+ | null reusable = Right new+ | otherwise = Left $ fst $ Prelude.head reusable where- reuseable = filter (\c -> sorteduniq (snd c) == new) shacontents+ reusable = filter (\c -> sorteduniq (snd c) == new) shacontents new = sorteduniq $ concat $ map snd shacontents sorteduniq = S.toList . S.fromList
Git/UpdateIndex.hs view
@@ -99,15 +99,15 @@ <> "\t" <> indexPath file -stageFile :: Sha -> TreeItemType -> FilePath -> Repo -> IO Streamer+stageFile :: Sha -> TreeItemType -> RawFilePath -> Repo -> IO Streamer stageFile sha treeitemtype file repo = do- p <- toTopFilePath (toRawFilePath file) repo+ p <- toTopFilePath file repo return $ pureStreamer $ updateIndexLine sha treeitemtype p {- A streamer that removes a file from the index. -}-unstageFile :: FilePath -> Repo -> IO Streamer+unstageFile :: RawFilePath -> Repo -> IO Streamer unstageFile file repo = do- p <- toTopFilePath (toRawFilePath file) repo+ p <- toTopFilePath file repo return $ unstageFile' p unstageFile' :: TopFilePath -> Streamer
Limit.hs view
@@ -45,6 +45,7 @@ import qualified Data.Set as S import qualified Data.Map as M import qualified System.FilePath.ByteString as P+import System.PosixCompat.Files (accessTime, isSymbolicLink) {- Some limits can look at the current status of files on - disk, or in the annex. This allows controlling which happens. -}@@ -121,7 +122,7 @@ matchGlobFile :: String -> MatchInfo -> Annex Bool matchGlobFile glob = go where- cglob = compileGlob glob CaseSensative (GlobFilePath True) -- memoized+ cglob = compileGlob glob CaseSensitive (GlobFilePath True) -- memoized go (MatchingFile fi) = pure $ matchGlob cglob (fromRawFilePath (matchFile fi)) go (MatchingInfo p) = pure $ case providedFilePath p of Just f -> matchGlob cglob (fromRawFilePath f)@@ -167,7 +168,7 @@ check k . toRawFilePath =<< getUserInfo (userProvidedFilePath p) - cglob = compileGlob glob CaseSensative (GlobFilePath True) -- memoized+ cglob = compileGlob glob CaseSensitive (GlobFilePath True) -- memoized matchesglob f = matchGlob cglob (fromRawFilePath f) #ifdef mingw32_HOST_OS@@ -231,7 +232,7 @@ , matchNeedsLocationLog = False } where- cglob = compileGlob glob CaseSensative (GlobFilePath False) -- memoized+ cglob = compileGlob glob CaseSensitive (GlobFilePath False) -- memoized go (MatchingFile fi) = catchBoolIO $ maybe False (matchGlob cglob) <$> querymagic magic (fromRawFilePath (contentFile fi))@@ -272,7 +273,7 @@ islocked <- isPointerFile f >>= \case Just _key -> return False Nothing -> isSymbolicLink- <$> getSymbolicLinkStatus (fromRawFilePath f)+ <$> R.getSymbolicLinkStatus f return (islocked == wantlocked) matchLockStatus wantlocked (MatchingInfo p) = pure $ case providedLinkType p of@@ -282,7 +283,7 @@ matchLockStatus _ (MatchingUserInfo _) = pure False {- Adds a limit to skip files not believed to be present- - in a specfied repository. Optionally on a prior date. -}+ - in a specified repository. Optionally on a prior date. -} addIn :: String -> Annex () addIn s = do u <- Remote.nameToUUID name
Logs/Chunk.hs view
@@ -5,7 +5,7 @@ - - It's possible for a single object to be stored multiple times on the - same remote using different chunk sizes. So, while this is a MapLog, it- - is not a normal UUIDBased log. Intead, it's a map from UUID and chunk+ - is not a normal UUIDBased log. Instead, it's a map from UUID and chunk - size to number of chunks. - - Format: "timestamp uuid:chunksize chunkcount"
Logs/Export.hs view
@@ -106,7 +106,7 @@ -- Record information about the export to the git-annex branch. ----- This is equivilant to recordExportBeginning followed by+-- This is equivalent to recordExportBeginning followed by -- recordExportUnderway, but without the ability to clean up from -- interrupted exports. recordExport :: UUID -> Git.Ref -> ExportChange -> Annex ()
Logs/Export/Pure.hs view
@@ -33,7 +33,7 @@ import qualified Data.Attoparsec.ByteString.Char8 as A8 import Data.ByteString.Builder --- This constuctor is not itself exported to other modules, to enforce+-- This constructor is not itself exported to other modules, to enforce -- consistent use of exportedTreeishes. data Exported = Exported { exportedTreeish :: Git.Ref
Logs/UUID.hs view
@@ -2,11 +2,13 @@ - - uuid.log stores a list of known uuids, and their descriptions. -- - Copyright 2010-2019 Joey Hess <id@joeyh.name>+ - Copyright 2010-2023 Joey Hess <id@joeyh.name> - - Licensed under the GNU AGPL version 3 or higher. -} +{-# LANGUAGE OverloadedStrings #-}+ module Logs.UUID ( uuidLog, describeUUID,@@ -25,15 +27,24 @@ import qualified Annex.UUID import qualified Data.Map.Strict as M+import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as L import qualified Data.Attoparsec.ByteString.Lazy as A+import Data.ByteString.Builder+import Data.Char {- Records a description for a uuid in the log. -} describeUUID :: UUID -> UUIDDesc -> Annex () describeUUID uuid desc = do c <- currentVectorClock Annex.Branch.change (Annex.Branch.RegardingUUID [uuid]) uuidLog $- buildLogOld buildUUIDDesc . changeLog c uuid desc . parseUUIDLog+ buildLogOld builder . changeLog c uuid desc . parseUUIDLog+ where+ builder (UUIDDesc b) = byteString (escnewline b)+ -- Escape any newline in the description, since newlines cannot+ -- be present in the logged value. This is a one-way escaping.+ escnewline = B.intercalate "\\n" . B.split newline+ newline = fromIntegral (ord '\n') {- The map is cached for speed. -} uuidDescMap :: Annex UUIDDescMap
Logs/UUIDBased.hs view
@@ -4,7 +4,7 @@ - be union merged. - - The old format looks like: "UUID[ INFO[ timestamp=foo]]"- - The timestamp is last for backwards compatability reasons,+ - The timestamp is last for backwards compatibility reasons, - and may not be present on very old log lines. - - New uuid based logs instead use the form: "timestamp UUID INFO"
Logs/Unused.hs view
@@ -5,7 +5,7 @@ - The format: "int key timestamp" - - The int is a short, stable identifier that the user can use to- - refer to this key. (Equivilant to a filename.)+ - refer to this key. (Equivalent to a filename.) - - The timestamp indicates when the key was first determined to be unused. - Older versions of the log omit the timestamp.
Logs/View.hs view
@@ -19,12 +19,15 @@ branchView, fromViewBranch, is_branchView,+ branchViewPrefix, prop_branchView_legal, ) where import Annex.Common import Types.View import Types.MetaData+import Types.AdjustedBranch+import Annex.AdjustedBranch.Name import qualified Git import qualified Git.Branch import qualified Git.Ref@@ -54,31 +57,49 @@ f <- fromRawFilePath <$> fromRepo gitAnnexViewLog liftIO $ mapMaybe readish . lines <$> catchDefaultIO [] (readFile f) -{- Gets the currently checked out view, if there is one. -}-currentView :: Annex (Maybe View)+{- Gets the currently checked out view, if there is one. + -+ - The view may also have an adjustment applied to it.+ -}+currentView :: Annex (Maybe (View, Maybe Adjustment)) currentView = go =<< inRepo Git.Branch.current where- go (Just b) | branchViewPrefix `B.isPrefixOf` fromRef' b =- headMaybe . filter (\v -> branchView v == b || branchViewOld v == b) - <$> recentViews- go _ = return Nothing+ go (Just b) = case adjustedToOriginal b of+ Nothing -> getvb b Nothing+ Just (adj, b') -> getvb b' (Just adj)+ go Nothing = return Nothing + getvb b madj+ | branchViewPrefix `B.isPrefixOf` fromRef' b = do+ vb <- headMaybe + . filter (\v -> branchView v Nothing == b || branchViewOld v == b) + <$> recentViews+ case vb of+ Just vb' -> return (Just (vb', madj))+ Nothing -> return Nothing+ | otherwise = return Nothing++{- Note that this is not the prefix used when an adjustment is applied to a+ - view branch. -} branchViewPrefix :: B.ByteString branchViewPrefix = "refs/heads/views" -{- Generates a git branch name for a View.+{- Generates a git branch name for a View, which may also have an+ - adjustment applied to it. - - There is no guarantee that each view gets a unique branch name, - but the branch name is used to express the view as well as possible - given the constraints on git branch names. It includes the name of the - parent branch, and what metadata is used. -}-branchView :: View -> Git.Branch-branchView view = Git.Ref $ - branchViewPrefix <> "/" <> basebranch- <> "(" <> branchViewDesc view False <> ")"+branchView :: View -> Maybe Adjustment -> Git.Branch+branchView view madj = case madj of+ Nothing -> vb+ Just adj -> adjBranch $ originalToAdjusted vb adj where basebranch = fromRef' (Git.Ref.base (viewParentBranch view))+ vb = Git.Ref $ branchViewPrefix <> "/" <> basebranch+ <> "(" <> branchViewDesc view False <> ")" {- Old name used for a view did not include the name of the parent branch. -} branchViewOld :: View -> Git.Branch@@ -109,22 +130,31 @@ | otherwise = map (\c -> if isAlphaNum c then c else '_') s is_branchView :: Git.Branch -> Bool-is_branchView (Ref b) = (branchViewPrefix <> "/") `B.isPrefixOf` b+is_branchView b = case adjustedToOriginal b of+ Nothing -> hasprefix b+ Just (_adj, b') -> hasprefix b'+ where+ hasprefix (Ref b') = (branchViewPrefix <> "/") `B.isPrefixOf` b' {- Converts a view branch as generated by branchView (but not by - branchViewOld) back to the parent branch. - Has no effect on other branches. -} fromViewBranch :: Git.Branch -> Git.Branch-fromViewBranch b = - let bs = fromRef' b- in if (branchViewPrefix <> "/") `B.isPrefixOf` bs- then - let (branch, _desc) = separate' (== openparen) (B.drop prefixlen bs)- in Ref branch- else b+fromViewBranch b = case adjustedToOriginal b of+ Nothing -> go b+ Just (_adj, b') -> go b' where+ go b' =+ let bs = fromRef' b'+ in if (branchViewPrefix <> "/") `B.isPrefixOf` bs+ then + let (branch, _desc) = separate' (== openparen) (B.drop prefixlen bs)+ in Ref branch+ else b'+ prefixlen = B.length branchViewPrefix + 1 openparen = fromIntegral (ord '(') prop_branchView_legal :: View -> Bool-prop_branchView_legal = Git.Ref.legal False . fromRef . branchView+prop_branchView_legal = Git.Ref.legal False + . fromRef . (\v -> branchView v Nothing)
Messages.hs view
@@ -136,7 +136,7 @@ showStoringStateAction :: Annex () showStoringStateAction = showSideAction "recording state in git" -{- Performs an action, supressing showSideAction messages. -}+{- Performs an action, suppressing showSideAction messages. -} doQuietSideAction :: Annex a -> Annex a doQuietSideAction = doSideAction' InBlock
NEWS view
@@ -30,7 +30,7 @@ This version of git-annex uses repository version 8 for all repositories. Existing repositories will be automatically upgraded by default.- You can prevent this, by runing: git config annex.autoupgraderepository false+ You can prevent this, by running: git config annex.autoupgraderepository false The upgrade process involves regenerating some sqlite databases. There are a couple consequences of the upgrade to keep in mind:@@ -78,7 +78,7 @@ This version of git-annex uses repository version 7 for all repositories. Existing v5 repositories will be automatically upgraded by default.- You can prevent this, by runing: git config annex.autoupgraderepository false+ You can prevent this, by running: git config annex.autoupgraderepository false A v7 repository can can have some files locked while other files are unlocked, and all git and git-annex commands can be used on both locked and
P2P/Address.hs view
@@ -14,8 +14,10 @@ import Creds import Utility.AuthToken import Utility.Tor+import qualified Utility.RawFilePath as R import qualified Data.Text as T+import System.PosixCompat.Files (fileOwner, fileGroup) -- | A P2P address, without an AuthToken. --@@ -80,8 +82,9 @@ -- This may be run by root, so make the creds file -- and directory have the same owner and group as -- the git repository directory has.- st <- liftIO . getFileStatus =<< Annex.fromRepo repoLocation- let fixowner f = setOwnerAndGroup f (fileOwner st) (fileGroup st)+ st <- liftIO . R.getFileStatus . toRawFilePath+ =<< Annex.fromRepo repoLocation+ let fixowner f = R.setOwnerAndGroup (toRawFilePath f) (fileOwner st) (fileGroup st) liftIO $ do fixowner tmpf fixowner (takeDirectory tmpf)
P2P/IO.hs view
@@ -50,6 +50,7 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as L import qualified Network.Socket as S+import System.PosixCompat.Files (groupReadMode, groupWriteMode, otherReadMode, otherWriteMode) -- Type of interpreters of the Proto free monad. type RunProto m = forall a. Proto a -> m (Either ProtoFailure a)
P2P/Protocol.hs view
@@ -32,9 +32,10 @@ import Control.Monad.Free import Control.Monad.Free.TH import Control.Monad.Catch-import System.FilePath import System.Exit (ExitCode(..)) import System.IO+import qualified System.FilePath.ByteString as P+import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as L import Data.Char import Control.Applicative@@ -179,11 +180,11 @@ | isSpace c = "%" | otherwise = [c] - deserialize s = case fromRawFilePath $ fromInternalGitPath $ toRawFilePath $ deesc [] s of- [] -> Just $ ProtoAssociatedFile $ AssociatedFile Nothing+ deserialize s = case fromInternalGitPath $ toRawFilePath $ deesc [] s of f- | isRelative f -> Just $ ProtoAssociatedFile $ - AssociatedFile $ Just $ toRawFilePath f+ | B.null f -> Just $ ProtoAssociatedFile $ AssociatedFile Nothing+ | P.isRelative f -> Just $ ProtoAssociatedFile $ + AssociatedFile $ Just f | otherwise -> Nothing where deesc b [] = reverse b@@ -262,7 +263,7 @@ -- so, terminate the protocol connection. -- -- If the validity check is provided and fails, the content was- -- changed while it was being sent, so verificiation of the+ -- changed while it was being sent, so verification of the -- received content should be forced. -- -- Note: The ByteString may not contain the entire remaining content@@ -386,7 +387,7 @@ -- gives up, since it's not clear what state the client -- is in, and so not possible to recover. Just (ERROR _) -> return Nothing- -- When the client sends an unparseable message, the server+ -- When the client sends an unparsable message, the server -- responds with an error message, and loops. This allows -- expanding the protocol with new messages. Nothing -> do
Remote.hs view
@@ -99,7 +99,7 @@ Just k -> Just (k, mkv r) {- Map of UUIDs of repositories and their descriptions.- - The names of Remotes are added to suppliment any description that has+ - The names of Remotes are added to supplement any description that has - been set for a repository. -} uuidDescriptions :: Annex UUIDDescMap uuidDescriptions = M.unionWith addName
Remote/Borg.hs view
@@ -141,7 +141,7 @@ M.lookup borgrepoField c -- The borgrepo is stored in git config, as well as this repo's- -- persistant state, so it can vary between hosts.+ -- persistent state, so it can vary between hosts. gitConfigSpecialRemote u c [("borgrepo", borgrepo)] return (c, u)
Remote/Bup.hs view
@@ -137,7 +137,7 @@ storeBupUUID u buprepo -- The buprepo is stored in git config, as well as this repo's- -- persistant state, so it can vary between hosts.+ -- persistent state, so it can vary between hosts. gitConfigSpecialRemote u c' [("buprepo", buprepo)] return (c', u)
Remote/Ddar.hs view
@@ -14,6 +14,7 @@ import qualified Data.Map as M import qualified Data.ByteString.Lazy as L import System.IO.Error+import System.PosixCompat.Files (isDirectory) import Annex.Common import Types.Remote@@ -28,6 +29,7 @@ import Annex.UUID import Utility.SshHost import Types.ProposedAccepted+import qualified Utility.RawFilePath as R data DdarRepo = DdarRepo { ddarRepoConfig :: RemoteGitConfig@@ -118,7 +120,7 @@ (c', _encsetup) <- encryptionSetup c gc -- The ddarrepo is stored in git config, as well as this repo's- -- persistant state, so it can vary between hosts.+ -- persistent state, so it can vary between hosts. gitConfigSpecialRemote u c' [("ddarrepo", ddarrepo)] return (c', u)@@ -185,7 +187,7 @@ ddarDirectoryExists ddarrepo | ddarLocal ddarrepo = do maybeStatus <- liftIO $ tryJust (guard . isDoesNotExistError) $- getSymbolicLinkStatus $ ddarRepoLocation ddarrepo+ R.getSymbolicLinkStatus $ toRawFilePath $ ddarRepoLocation ddarrepo return $ case maybeStatus of Left _ -> Right False Right status -> Right $ isDirectory status
Remote/Directory.hs view
@@ -19,6 +19,7 @@ import qualified Data.Map as M import qualified System.FilePath.ByteString as P import Data.Default+import System.PosixCompat.Files (isRegularFile, getFdStatus, deviceID) import Annex.Common import Types.Remote@@ -152,7 +153,7 @@ (c', _encsetup) <- encryptionSetup c gc -- The directory is stored in git config, not in this remote's- -- persistant state, so it can vary between hosts.+ -- persistent state, so it can vary between hosts. gitConfigSpecialRemote u c' [("directory", absdir)] return (M.delete directoryField c', u) @@ -254,7 +255,7 @@ retrieveKeyFileCheapM d NoChunks = Just $ \k _af f -> liftIO $ do file <- fromRawFilePath <$> (absPath =<< getLocation d k) ifM (doesFileExist file)- ( createSymbolicLink file f+ ( R.createSymbolicLink (toRawFilePath file) (toRawFilePath f) , giveup "content file not present in remote" ) #else@@ -522,7 +523,7 @@ void $ liftIO $ fileCopier cow src tmpf p Nothing let tmpf' = toRawFilePath tmpf resetAnnexFilePerm tmpf'- liftIO (getSymbolicLinkStatus tmpf) >>= liftIO . mkContentIdentifier ii tmpf' >>= \case+ liftIO (R.getSymbolicLinkStatus tmpf') >>= liftIO . mkContentIdentifier ii tmpf' >>= \case Nothing -> giveup "unable to generate content identifier" Just newcid -> do checkExportContent ii dir loc
Remote/External.hs view
@@ -536,7 +536,7 @@ shutdownAddonProcess :: AddonProcess.ExternalAddonProcess -> Bool -> IO () shutdownAddonProcess = AddonProcess.externalShutdown -{- A response handler can yeild a result, or it can request that another+{- A response handler can yield a result, or it can request that another - message be consumed from the external. -} data ResponseHandlerResult a = Result a@@ -548,7 +548,7 @@ result = Just . return . Result {- Waits for a message from the external remote, and passes it to the- - apppropriate handler. + - appropriate handler. - - If the handler returns Nothing, this is a protocol error.-} receiveMessage
Remote/External/AsyncExtension.hs view
@@ -46,7 +46,7 @@ , externalReceive = atomically (readTBMChan receiveq) -- This shuts down the whole relay. , externalShutdown = shutdown external st sendq sender receiver- -- These three TMVars are shared amoung all+ -- These three TMVars are shared among all -- ExternalStates that use this relay; they're -- common state about the external process. , externalPrepared = externalPrepared st
Remote/Git.hs view
@@ -65,13 +65,10 @@ import Annex.Action import Messages.Progress -#ifndef mingw32_HOST_OS-import qualified Utility.RawFilePath as R-#endif- import Control.Concurrent import qualified Data.Map as M import qualified Data.ByteString as S+import qualified Utility.RawFilePath as R import Network.URI remote :: RemoteType@@ -700,7 +697,7 @@ mkFileCopier :: Bool -> State -> Annex FileCopier mkFileCopier remotewanthardlink (State _ _ copycowtried _ _) = do localwanthardlink <- wantHardLink- let linker = \src dest -> createLink src dest >> return True+ let linker = \src dest -> R.createLink (toRawFilePath src) (toRawFilePath dest) >> return True if remotewanthardlink || localwanthardlink then return $ \src dest k p check verifyconfig -> ifM (liftIO (catchBoolIO (linker src dest)))
Remote/GitLFS.hs view
@@ -84,7 +84,7 @@ gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> RemoteStateHandle -> Annex (Maybe Remote) gen r u rc gc rs = do c <- parsedRemoteConfig remote rc- -- If the repo uses gcrypt, get the underlaying repo without the+ -- If the repo uses gcrypt, get the underlying repo without the -- gcrypt url, to do LFS endpoint discovery on. r' <- if Git.GCrypt.isEncrypted r then do
Remote/Helper/Chunked.hs view
@@ -239,7 +239,7 @@ - chunkKeys until it finds one where the retriever successfully - gets the first chunked key. -- - If retrival of one of the subsequent chunks throws an exception,+ - If retrieval of one of the subsequent chunks throws an exception, - gives up. Note that partial data may have been written to the file - in this case. -
Remote/Helper/ExportImport.hs view
@@ -212,7 +212,7 @@ -- ones though, since they still allow accessing by Key. -- And for thirdPartyPopulated, it depends on how the -- content gets actually stored in the remote, so- -- is not overriddden here.+ -- is not overridden here. , untrustworthy = if versioned || thirdPartyPopulated (remotetype r) then untrustworthy r@@ -235,7 +235,7 @@ where thirdpartypopulated = thirdPartyPopulated (remotetype r) - -- exportActions adjusted to use the equivilant import actions,+ -- exportActions adjusted to use the equivalent import actions, -- which take ContentIdentifiers into account. exportActionsForImport dbv ciddbv ea = ea { storeExport = \f k loc p -> do
Remote/Helper/Git.hs view
@@ -11,8 +11,10 @@ import qualified Git import Types.Availability import qualified Types.Remote as Remote+import qualified Utility.RawFilePath as R import Data.Time.Clock.POSIX+import System.PosixCompat.Files (modificationTime) repoCheap :: Git.Repo -> Bool repoCheap = not . Git.repoIsUrl@@ -37,7 +39,7 @@ gitRepoInfo :: Remote -> Annex [(String, String)] gitRepoInfo r = do d <- fromRawFilePath <$> fromRepo Git.localGitDir- mtimes <- liftIO $ mapM (modificationTime <$$> getFileStatus)+ mtimes <- liftIO $ mapM (\p -> modificationTime <$> R.getFileStatus (toRawFilePath p)) =<< dirContentsRecursive (d </> "refs" </> "remotes" </> Remote.name r) let lastsynctime = case mtimes of [] -> "never"
Remote/Helper/Ssh.hs view
@@ -151,7 +151,7 @@ {- The rsync shell parameter controls where rsync - goes, so the source/dest parameter can be a dummy value, - that just enables remote rsync mode.- - For maximum compatability with some patched rsyncs,+ - For maximum compatibility with some patched rsyncs, - the dummy value needs to still contain a hostname, - even though this hostname will never be used. -} dummy = Param "dummy:"
Remote/Rsync.hs view
@@ -205,7 +205,7 @@ (c', _encsetup) <- encryptionSetup c gc -- The rsyncurl is stored in git config, not only in this remote's- -- persistant state, so it can vary between hosts.+ -- persistent state, so it can vary between hosts. gitConfigSpecialRemote u c' [("rsyncurl", url)] return (c', u) @@ -283,7 +283,7 @@ ps <- sendParams opts <- rsyncOptions o ok <- withRsyncScratchDir $ \tmp -> liftIO $ do- {- Send an empty directory to rysnc to make it delete. -}+ {- Send an empty directory to rsync to make it delete. -} rsync $ opts ++ ps ++ map (\s -> Param $ "--include=" ++ s) includes ++ [ Param "--exclude=*" -- exclude everything else
Remote/S3.hs view
@@ -868,7 +868,7 @@ warning $ needS3Creds u giveup "No S3 credentials configured" giveupS3HandleProblem S3HandleAnonymousOldAws _ =- giveup "This S3 special remote is configured with signature=anonymous, but git-annex is buit with too old a version of the aws library to support that."+ giveup "This S3 special remote is configured with signature=anonymous, but git-annex is built with too old a version of the aws library to support that." {- Prepares a S3Handle for later use. Does not connect to S3 or do anything - else expensive. -}
Remote/Web.hs view
@@ -202,7 +202,7 @@ getglob f pc = do glob <- getRemoteConfigValue f pc- Just $ compileGlob glob CaseInsensative (GlobFilePath False)+ Just $ compileGlob glob CaseInsensitive (GlobFilePath False) mk minclude mexclude = pure $ UrlIncludeExclude { checkUrlIncludeExclude = \u -> and
Remote/WebDAV.hs view
@@ -237,7 +237,7 @@ Right p -> withDavHandle hdl $ \h -> runExport h $ \_dav -> removeHelper p -- When the exportLocation is not legal for webdav,- -- the content is certianly not stored there, so it's ok for+ -- the content is certainly not stored there, so it's ok for -- removal to succeed. This allows recovery after failure to store -- content there, as the user can rename the problem file and -- this will be called to make sure it's gone.
Remote/WebDAV/DavLocation.hs view
@@ -66,7 +66,7 @@ - - This could be just the keyTmpLocation, but when the file is in a - subdirectory, the temp file is put in there. Partly this is to keep- - it close to the final destination; also certian webdav servers+ - it close to the final destination; also certain webdav servers - seem to be buggy when renaming files from the root into a subdir, - and so writing to the subdir avoids such problems. -}
RemoteDaemon/Common.hs view
@@ -42,7 +42,7 @@ | remoteAnnexPull gc = checkNewShas transporthandle shas | otherwise = return False --- Check if any of the shas are actally new in the local git repo,+-- Check if any of the shas are actually new in the local git repo, -- to avoid unnecessary fetching. checkNewShas :: TransportHandle -> [Git.Sha] -> IO Bool checkNewShas transporthandle = check
RemoteDaemon/Types.hs view
@@ -51,7 +51,7 @@ | WARNING RemoteURI String deriving (Show) --- Messages that the deamon consumes.+-- Messages that the daemon consumes. data Consumed = PAUSE | LOSTNET
Test.hs view
@@ -26,9 +26,9 @@ import Common import CmdLine.GitAnnex.Options+import qualified Utility.RawFilePath as R import qualified Utility.ShellEscape-import qualified Utility.RawFilePath as R import qualified Annex import qualified Git.Filename import qualified Git.Types@@ -706,7 +706,7 @@ annexed_notpresent annexedfile inmainrepo $ annexed_present annexedfile git_annex "get" [annexedfile] "get of file"- git_annex_shouldfail "move" ["--from", "origin", annexedfile] "move of file --from remote that violates numcopies setting not allowd"+ git_annex_shouldfail "move" ["--from", "origin", annexedfile] "move of file --from remote that violates numcopies setting not allowed" git_annex_shouldfail "move" ["--to", "origin", annexedfile] "move of file --to remote that violates numcopies setting not allowed" test_copy :: Assertion@@ -1164,7 +1164,7 @@ isjson readonly_query isjson -- When presented with an input that it does not support,- -- info does not stop but processess subsequent inputs too.+ -- info does not stop but processes subsequent inputs too. git_annex'' (const True) (sha1annexedfile `isInfixOf`) "info"@@ -1498,7 +1498,7 @@ git_annex "sync" [] "sync in r1" indir r2 $ do disconnectOrigin- createSymbolicLink symlinktarget "conflictor"+ R.createSymbolicLink (toRawFilePath symlinktarget) (toRawFilePath "conflictor") git "add" [conflictor] "git add conflictor" git_annex "sync" [] "sync in r2" pair r1 r2@@ -1518,8 +1518,8 @@ length v == 1 @? (what ++ " too many variant files in: " ++ show v) conflictor `elem` l @? (what ++ " conflictor file missing in: " ++ show l)- s <- catchMaybeIO (readSymbolicLink (d </> conflictor))- s == Just symlinktarget+ s <- catchMaybeIO (R.readSymbolicLink (toRawFilePath (d </> conflictor)))+ s == Just (toRawFilePath symlinktarget) @? (what ++ " wrong target for nonannexed symlink: " ++ show s) {- Check merge conflict resolution when there is a local file,@@ -1837,7 +1837,7 @@ testscheme scheme = Utility.Tmp.Dir.withTmpDir "gpgtmp" $ \gpgtmp -> do -- Use the system temp directory as gpg temp directory because -- it needs to be able to store the agent socket there,- -- which can be problimatic when testing some filesystems.+ -- which can be problematic when testing some filesystems. absgpgtmp <- fromRawFilePath <$> absPath (toRawFilePath gpgtmp) res <- testscheme' scheme absgpgtmp -- gpg may still be running and would prevent
Test/Framework.hs view
@@ -25,10 +25,12 @@ import System.Console.ANSI import GHC.Conc import System.IO.Unsafe (unsafePerformIO)+import System.PosixCompat.Files (isSymbolicLink, isRegularFile, fileMode, unionFileModes, ownerWriteMode) import Common import Types.Test import Types.Concurrency+import qualified Utility.RawFilePath as R import qualified Annex import qualified Annex.UUID@@ -351,24 +353,24 @@ ( (isJust <$> annexeval (Annex.Link.getAnnexLinkTarget (toRawFilePath f))) @? f ++ " is not a (crippled) symlink" , do- s <- getSymbolicLinkStatus f+ s <- R.getSymbolicLinkStatus (toRawFilePath f) isSymbolicLink s @? f ++ " is not a symlink" ) checkregularfile :: FilePath -> Assertion checkregularfile f = do- s <- getSymbolicLinkStatus f+ s <- R.getSymbolicLinkStatus (toRawFilePath f) isRegularFile s @? f ++ " is not a normal file" return () checkdoesnotexist :: FilePath -> Assertion checkdoesnotexist f = - (either (const True) (const False) <$> Utility.Exception.tryIO (getSymbolicLinkStatus f))+ (either (const True) (const False) <$> Utility.Exception.tryIO (R.getSymbolicLinkStatus (toRawFilePath f))) @? f ++ " exists unexpectedly" checkexists :: FilePath -> Assertion checkexists f = - (either (const False) (const True) <$> Utility.Exception.tryIO (getSymbolicLinkStatus f))+ (either (const False) (const True) <$> Utility.Exception.tryIO (R.getSymbolicLinkStatus (toRawFilePath f))) @? f ++ " does not exist" checkcontent :: FilePath -> Assertion@@ -381,14 +383,14 @@ -- Look at permissions bits rather than trying to write or -- using fileAccess because if run as root, any file can be -- modified despite permissions.- s <- getFileStatus f+ s <- R.getFileStatus (toRawFilePath f) let mode = fileMode s when (mode == mode `unionFileModes` ownerWriteMode) $ assertFailure $ "able to modify annexed file's " ++ f ++ " content" checkwritable :: FilePath -> Assertion checkwritable f = do- s <- getFileStatus f+ s <- R.getFileStatus (toRawFilePath f) let mode = fileMode s unless (mode == mode `unionFileModes` ownerWriteMode) $ assertFailure $ "unable to modify " ++ f@@ -722,7 +724,7 @@ \_ _ _ pid -> exitWith =<< waitForProcess pid runFakeSsh ps = error $ "fake ssh option parse error: " ++ show ps -{- Tests each TestTree in parallel, and exits with succcess/failure.+{- Tests each TestTree in parallel, and exits with success/failure. - - Tasty supports parallel tests, but this does not use it, because - many tests need to be run in test repos, and chdir would not be
Types/Backend.hs view
@@ -23,7 +23,7 @@ , verifyKeyContent :: Maybe (Key -> RawFilePath -> a Bool) -- Incrementally verifies the content of a key, using the same -- hash as verifyKeyContent, but with the content provided- -- incrementally a peice at a time, until finalized.+ -- incrementally a piece at a time, until finalized. , verifyKeyContentIncrementally :: Maybe (Key -> a IncrementalVerifier) -- Checks if a key can be upgraded to a better form. , canUpgradeKey :: Maybe (Key -> Bool)
Types/Difference.hs view
@@ -34,9 +34,9 @@ -- Describes differences from the v5 repository format. -- -- The serialization is stored in difference.log, so avoid changes that--- would break compatability.+-- would break compatibility. ----- Not breaking compatability is why a list of Differences is used, rather+-- Not breaking compatibility is why a list of Differences is used, rather -- than a record type. With a record type, adding a new field for some future -- difference would serialize to a value that an older version could not -- parse, even if that new field was not used. With the Differences list,
Types/FileMatcher.hs view
@@ -98,7 +98,7 @@ type FileMatcher a = Matcher (MatchFiles a) -- This is a matcher that can have tokens added to it while it's being--- built, and once complete is compiled to an unchangable matcher.+-- built, and once complete is compiled to an unchangeable matcher. data ExpandableMatcher a = BuildingMatcher [Token (MatchFiles a)] | CompleteMatcher (Matcher (MatchFiles a))
Types/Import.hs view
@@ -58,7 +58,7 @@ { importableContents :: [(ImportLocation, info)] , importableHistory :: [ImportableContents info] -- ^ Used by remotes that support importing historical versions of- -- files that are stored in them. This is equivilant to a git+ -- files that are stored in them. This is equivalent to a git -- commit history. -- -- When retrieving a historical version of a file,
Types/RefSpec.hs view
@@ -22,7 +22,7 @@ | RemoveMatching Glob allRefSpec :: RefSpec-allRefSpec = [AddMatching $ compileGlob "*" CaseSensative (GlobFilePath False)]+allRefSpec = [AddMatching $ compileGlob "*" CaseSensitive (GlobFilePath False)] parseRefSpec :: String -> Either String RefSpec parseRefSpec v = case partitionEithers (map mk $ splitc ':' v) of@@ -31,9 +31,9 @@ where mk ('+':s) | any (`elem` s) "*?" =- Right $ AddMatching $ compileGlob s CaseSensative (GlobFilePath False)+ Right $ AddMatching $ compileGlob s CaseSensitive (GlobFilePath False) | otherwise = Right $ AddRef $ Ref $ encodeBS s- mk ('-':s) = Right $ RemoveMatching $ compileGlob s CaseSensative (GlobFilePath False)+ mk ('-':s) = Right $ RemoveMatching $ compileGlob s CaseSensitive (GlobFilePath False) mk "reflog" = Right AddRefLog mk s = Left $ "bad refspec item \"" ++ s ++ "\" (expected + or - prefix)"
Types/Remote.hs view
@@ -137,7 +137,7 @@ , getRepo :: a Git.Repo -- a Remote's configuration from git , gitconfig :: RemoteGitConfig- -- a Remote can be assocated with a specific local filesystem path+ -- a Remote can be associated with a specific local filesystem path , localpath :: Maybe FilePath -- a Remote can be known to be readonly , readonly :: Bool
Types/UUID.hs view
@@ -82,9 +82,6 @@ toUUIDDesc :: String -> UUIDDesc toUUIDDesc = UUIDDesc . encodeBS -buildUUIDDesc :: UUIDDesc -> Builder-buildUUIDDesc (UUIDDesc b) = byteString b- type UUIDDescMap = M.Map UUID UUIDDesc instance Proto.Serializable UUID where
Upgrade/V0.hs view
@@ -11,7 +11,10 @@ import Types.Upgrade import Annex.Content import qualified Upgrade.V1+import qualified Utility.RawFilePath as R +import System.PosixCompat.Files (isRegularFile)+ upgrade :: Annex UpgradeResult upgrade = do showAction "v0 to v1"@@ -46,7 +49,8 @@ where present d = do result <- tryIO $- getFileStatus $ dir ++ "/" ++ takeFileName d+ R.getFileStatus $ toRawFilePath $+ dir ++ "/" ++ takeFileName d case result of Right s -> return $ isRegularFile s Left _ -> return False
Upgrade/V1.hs view
@@ -15,6 +15,7 @@ import qualified Data.ByteString.Short as S (toShort, fromShort) import qualified Data.ByteString.Lazy as L import qualified System.FilePath.ByteString as P+import System.PosixCompat.Files (isRegularFile) import Annex.Common import Types.Upgrade@@ -30,6 +31,7 @@ import Utility.FileMode import Utility.Tmp import qualified Upgrade.V2+import qualified Utility.RawFilePath as R -- v2 adds hashing of filenames of content and location log files. -- Key information is encoded in filenames differently, so@@ -101,7 +103,7 @@ link <- fromRawFilePath <$> calcRepo (gitAnnexLink (toRawFilePath f) k) liftIO $ removeFile f- liftIO $ createSymbolicLink link f+ liftIO $ R.createSymbolicLink (toRawFilePath link) (toRawFilePath f) Annex.Queue.addCommand [] "add" [Param "--"] [f] moveLocationLogs :: Annex ()@@ -203,7 +205,8 @@ Left _ -> return Nothing Right l -> makekey l where- getsymlink = takeFileName <$> readSymbolicLink file+ getsymlink = takeFileName . fromRawFilePath+ <$> R.readSymbolicLink (toRawFilePath file) makekey l = maybeLookupBackendVariety (fromKey keyVariety k) >>= \case Nothing -> do unless (null kname || null bname ||@@ -232,7 +235,7 @@ ) where present f = do- result <- tryIO $ getFileStatus f+ result <- tryIO $ R.getFileStatus (toRawFilePath f) case result of Right s -> return $ isRegularFile s Left _ -> return False
Upgrade/V5/Direct.hs view
@@ -40,7 +40,7 @@ coreworktree = ConfigKey "core.worktree" indirectworktree = ConfigKey "core.indirect-worktree" setbare = do- -- core.worktree is not compatable with+ -- core.worktree is not compatible with -- core.bare; git does not allow both to be set, so -- unset it when enabling direct mode, caching in -- core.indirect-worktree
Upgrade/V7.hs view
@@ -24,6 +24,7 @@ import qualified Utility.RawFilePath as R import qualified System.FilePath.ByteString as P+import System.PosixCompat.Files (isSymbolicLink) upgrade :: Bool -> Annex UpgradeResult upgrade automatic = do@@ -110,7 +111,7 @@ (l, cleanup) <- inRepo $ LsFiles.inodeCaches [top] forM_ l $ \case (_f, Nothing) -> giveup "Unable to parse git ls-files --debug output while upgrading git-annex sqlite databases."- (f, Just ic) -> unlessM (liftIO $ catchBoolIO $ isSymbolicLink <$> getSymbolicLinkStatus f) $ do+ (f, Just ic) -> unlessM (liftIO $ catchBoolIO $ isSymbolicLink <$> R.getSymbolicLinkStatus (toRawFilePath f)) $ do catKeyFile (toRawFilePath f) >>= \case Nothing -> noop Just k -> do
Utility/Base64.hs view
@@ -19,7 +19,7 @@ import Data.Char -- | This uses the FileSystemEncoding, so it can be used on Strings--- that repesent filepaths containing arbitrarily encoded characters.+-- that represent filepaths containing arbitrarily encoded characters. toB64 :: String -> String toB64 = toString . B64.encode . encodeBS
Utility/Bloom.hs view
@@ -1,4 +1,4 @@-{- bloomfilter compatability wrapper+{- bloomfilter compatibility wrapper - - Copyright 2014 Joey Hess <id@joeyh.name> -
Utility/Daemon.hs view
@@ -67,7 +67,7 @@ envvar = "DAEMONIZED" #endif -{- To run an action that is normally daemonized in the forground. -}+{- To run an action that is normally daemonized in the foreground. -} #ifndef mingw32_HOST_OS foreground :: IO Fd -> Maybe FilePath -> IO () -> IO () foreground openlogfd pidfile a = do
Utility/DataUnits.hs view
@@ -21,7 +21,7 @@ - error. This was bad. - - So, a committee was formed. And it arrived at a committee-like decision,- - which satisfied noone, confused everyone, and made the world an uglier+ - which satisfied no one, confused everyone, and made the world an uglier - place. As with all committees, this was meh. Or in this case, "mib". - - And the drive manufacturers happily continued selling drives that are@@ -82,7 +82,7 @@ , Unit (p 4) "TB" "terabyte" , Unit (p 3) "GB" "gigabyte" , Unit (p 2) "MB" "megabyte"- , Unit (p 1) "kB" "kilobyte" -- weird capitalization thanks to committe+ , Unit (p 1) "kB" "kilobyte" -- weird capitalization thanks to committee , Unit 1 "B" "byte" ] where@@ -122,7 +122,7 @@ , Unit (p 4) "Tbit" "terabit" , Unit (p 3) "Gbit" "gigabit" , Unit (p 2) "Mbit" "megabit"- , Unit (p 1) "kbit" "kilobit" -- weird capitalization thanks to committe+ , Unit (p 1) "kbit" "kilobit" -- weird capitalization thanks to committee ] where p :: Integer -> Integer
Utility/DirWatcher/FSEvents.hs view
@@ -7,8 +7,9 @@ module Utility.DirWatcher.FSEvents (watchDir) where -import Common hiding (isDirectory)+import Common import Utility.DirWatcher.Types+import qualified Utility.RawFilePath as R import System.OSX.FSEvents import qualified System.Posix.Files as Files@@ -51,7 +52,7 @@ else maybe (runhook delHook Nothing) handleadd =<< getstatus (eventPath evt) {- Add hooks are run when a file is modified for - - compatability with INotify, which calls the add+ - compatibility with INotify, which calls the add - hook when a file is closed, and so tends to call - both add and modify for file modifications. -} when (hasflag eventFlagItemModified && not (hasflag eventFlagItemIsDir)) $ do@@ -89,7 +90,7 @@ where runhook h s = maybe noop (\a -> a f s) (h hooks) - getstatus = catchMaybeIO . getSymbolicLinkStatus+ getstatus = catchMaybeIO . R.getSymbolicLinkStatus . toRawFilePath {- Check each component of the path to see if it's ignored. -} ignoredPath :: (FilePath -> Bool) -> FilePath -> Bool
Utility/DirWatcher/INotify.hs view
@@ -7,9 +7,10 @@ module Utility.DirWatcher.INotify (watchDir) where -import Common hiding (isDirectory)+import Common import Utility.ThreadLock import Utility.DirWatcher.Types+import qualified Utility.RawFilePath as R import System.INotify import qualified System.Posix.Files as Files@@ -149,14 +150,14 @@ indir f = dir </> f - getstatus f = catchMaybeIO $ getSymbolicLinkStatus $ indir f+ getstatus f = catchMaybeIO $ R.getSymbolicLinkStatus $ toRawFilePath $ indir f checkfiletype check h f = do ms <- getstatus f case ms of Just s | check s -> runhook h f ms _ -> noop- filetype t f = catchBoolIO $ t <$> getSymbolicLinkStatus (indir f)+ filetype t f = catchBoolIO $ t <$> R.getSymbolicLinkStatus (toRawFilePath (indir f)) failedaddwatch e -- Inotify fails when there are too many watches with a
Utility/DirWatcher/Win32Notify.hs view
@@ -9,9 +9,10 @@ import Common hiding (isDirectory) import Utility.DirWatcher.Types+import qualified Utility.RawFilePath as R import System.Win32.Notify-import qualified System.PosixCompat.Files as Files+import System.PosixCompat.Files (isRegularFile) watchDir :: FilePath -> (FilePath -> Bool) -> Bool -> WatchHooks -> IO WatchManager watchDir dir ignored scanevents hooks = do@@ -32,7 +33,7 @@ (Modified _ _) | isDirectory evt -> noop {- Add hooks are run when a file is modified for - - compatability with INotify, which calls the add+ - compatibility with INotify, which calls the add - hook when a file is closed, and so tends to call - both add and modify for file modifications. -} | otherwise -> do@@ -51,7 +52,7 @@ case ms of Nothing -> noop Just s- | Files.isRegularFile s ->+ | isRegularFile s -> when scanevents $ runhook addHook ms | otherwise ->@@ -59,7 +60,7 @@ where runhook h s = maybe noop (\a -> a f s) (h hooks) - getstatus = catchMaybeIO . getFileStatus+ getstatus = catchMaybeIO . R.getFileStatus . toRawFilePath {- Check each component of the path to see if it's ignored. -} ignoredPath :: (FilePath -> Bool) -> FilePath -> Bool
Utility/Directory.hs view
@@ -16,7 +16,7 @@ import Control.Monad import System.FilePath-import System.PosixCompat.Files (getSymbolicLinkStatus, isDirectory, isSymbolicLink)+import System.PosixCompat.Files (isDirectory, isSymbolicLink) import Control.Applicative import System.IO.Unsafe (unsafeInterleaveIO) import Data.Maybe@@ -25,7 +25,8 @@ import Utility.SystemDirectory import Utility.Exception import Utility.Monad-import Utility.Applicative+import Utility.FileSystemEncoding+import qualified Utility.RawFilePath as R dirCruft :: FilePath -> Bool dirCruft "." = True@@ -65,7 +66,7 @@ | otherwise = do let skip = collect (entry:files) dirs' entries let recurse = collect files (entry:dirs') entries- ms <- catchMaybeIO $ getSymbolicLinkStatus entry+ ms <- catchMaybeIO $ R.getSymbolicLinkStatus (toRawFilePath entry) case ms of (Just s) | isDirectory s -> recurse@@ -87,9 +88,10 @@ | skipdir (takeFileName dir) = go c dirs | otherwise = unsafeInterleaveIO $ do subdirs <- go []- =<< filterM (isDirectory <$$> getSymbolicLinkStatus)+ =<< filterM isdir =<< catchDefaultIO [] (dirContents dir) go (subdirs++dir:c) dirs+ isdir p = isDirectory <$> R.getSymbolicLinkStatus (toRawFilePath p) {- Use with an action that removes something, which may or may not exist. -
Utility/Glob.hs view
@@ -24,7 +24,7 @@ newtype Glob = Glob Regex -data GlobCase = CaseSensative | CaseInsensative+data GlobCase = CaseSensitive | CaseInsensitive -- Is the glob being used to match filenames? --@@ -44,8 +44,8 @@ where regex = '^' : wildToRegex globfilepath glob ++ "$" casesentitive = case globcase of- CaseSensative -> True- CaseInsensative -> False+ CaseSensitive -> True+ CaseInsensitive -> False wildToRegex :: GlobFilePath -> String -> String wildToRegex (GlobFilePath globfile) = concat . go
Utility/Hash.hs view
@@ -284,7 +284,7 @@ data IncrementalHasher = IncrementalHasher { updateIncrementalHasher :: S.ByteString -> IO ()- -- ^ Called repeatedly on each peice of the content.+ -- ^ Called repeatedly on each piece of the content. , finalizeIncrementalHasher :: IO (Maybe String) -- ^ Called once the full content has been sent, returns -- the hash. (Nothing if unableIncremental was called.)
Utility/HtmlDetect.hs view
@@ -48,7 +48,7 @@ -- | Check if the file is html. ----- It would be equivilant to use isHtml <$> readFile file,+-- It would be equivalent to use isHtml <$> readFile file, -- but since that would not read all of the file, the handle -- would remain open until it got garbage collected sometime later. isHtmlFile :: FilePath -> IO Bool
Utility/IPAddress.hs view
@@ -53,13 +53,13 @@ isLoopbackAddress (SockAddrInet _ ipv4) = case hostAddressToTuple ipv4 of -- localhost (127,_,_,_) -> True- -- current network; functions equivilant to loopback+ -- current network; functions equivalent to loopback (0,_,_, _) -> True _ -> False isLoopbackAddress (SockAddrInet6 _ _ ipv6 _) = case hostAddress6ToTuple ipv6 of -- localhost (0,0,0,0,0,0,0,1) -> True- -- unspecified address; functions equivilant to loopback+ -- unspecified address; functions equivalent to loopback (0,0,0,0,0,0,0,0) -> True v -> maybe False (isLoopbackAddress . SockAddrInet 0)
Utility/InodeCache.hs view
@@ -51,6 +51,7 @@ import qualified Utility.RawFilePath as R import System.PosixCompat.Types+import System.PosixCompat.Files (isRegularFile, fileID) import Data.Time.Clock.POSIX #ifdef mingw32_HOST_OS@@ -130,7 +131,7 @@ replaceInode inode (InodeCache (InodeCachePrim _ sz mtime)) = InodeCache (InodeCachePrim inode sz mtime) -{- For backwards compatability, support low-res mtime with no+{- For backwards compatibility, support low-res mtime with no - fractional seconds. -} data MTime = MTimeLowRes EpochTime | MTimeHighRes POSIXTime deriving (Show, Ord)@@ -248,7 +249,7 @@ - On Windows, time stamp differences are ignored, since they change - with the timezone. -- - When the sential file does not exist, InodeCaches canot reliably be+ - When the sential file does not exist, InodeCaches cannot reliably be - compared, so the assumption is that there is has been a change. -} checkSentinalFile :: SentinalFile -> IO SentinalStatus
Utility/LockFile/Windows.hs view
@@ -18,12 +18,10 @@ import System.Win32.Types import System.Win32.File import Control.Concurrent-import qualified Data.ByteString as B-import qualified System.FilePath.Windows.ByteString as P +import Utility.Path.Windows import Utility.FileSystemEncoding import Utility.Split-import Utility.Path.AbsRel type LockFile = RawFilePath @@ -60,7 +58,7 @@ -} openLock :: ShareMode -> LockFile -> IO (Maybe LockHandle) openLock sharemode f = do- f' <- convertToNativeNamespace f+ f' <- convertToWindowsNativeNamespace f #if MIN_VERSION_Win32(2,13,4) r <- tryNonAsync $ createFile_NoRetry f' gENERIC_READ sharemode security_attributes oPEN_ALWAYS fILE_ATTRIBUTE_NORMAL@@ -79,37 +77,11 @@ where security_attributes = maybePtr Nothing -{- Convert a filepath to use Windows's native namespace.- - This avoids filesystem length limits.- -- - This is similar to the way base converts filenames on windows,- - but as that is implemented in C (create_device_name) and not- - exported, it cannot be used here. Several edge cases are not handled,- - including network shares and dos short paths. - -}-convertToNativeNamespace :: RawFilePath -> IO RawFilePath-convertToNativeNamespace f- | win32_dev_namespace `B.isPrefixOf` f = return f- | win32_file_namespace `B.isPrefixOf` f = return f- | nt_device_namespace `B.isPrefixOf` f = return f- | otherwise = do- -- Make absolute because any '.' and '..' in the path- -- will not be resolved once it's converted.- p <- absPath f- -- Normalize slashes.- let p' = P.normalise p- return (win32_file_namespace <> p')- where- - win32_dev_namespace = "\\\\.\\"- win32_file_namespace = "\\\\?\\"- nt_device_namespace = "\\Device\\"- dropLock :: LockHandle -> IO () dropLock = closeHandle {- If the initial lock fails, this is a BUSY wait, and does not- - guarentee FIFO order of waiters. In other news, Windows is a POS. -}+ - guarantee FIFO order of waiters. In other news, Windows is a POS. -} waitToLock :: IO (Maybe lockhandle) -> IO lockhandle waitToLock locker = takelock where
Utility/LockPool/PidLock.hs view
@@ -39,7 +39,7 @@ -- or the Seconds timeout if the pid lock is held by another process. -- -- There are two levels of locks. A STM lock is used to handle--- fine-grained locking amoung threads, locking a specific lockfile,+-- fine-grained locking among threads, locking a specific lockfile, -- but only in memory. The pid lock handles locking between processes. -- -- The pid lock is only taken once, and LockShared is used for it,
Utility/LockPool/Windows.hs view
@@ -38,7 +38,7 @@ (\f _ -> fmap mk <$> F.lockExclusive f) {- If the initial lock fails, this is a BUSY wait, and does not- - guarentee FIFO order of waiters. In other news, Windows is a POS. -}+ - guarantee FIFO order of waiters. In other news, Windows is a POS. -} waitToLock :: IO (Maybe lockhandle) -> IO lockhandle waitToLock = F.waitToLock
Utility/Matcher.hs view
@@ -37,7 +37,7 @@ import Data.Kind {- A Token can be an Operation of an arbitrary type, or one of a few- - predefined peices of syntax. -}+ - predefined pieces of syntax. -} data Token op = Operation op | And | Or | Not | Open | Close deriving (Show, Eq)
Utility/Misc.hs view
@@ -12,6 +12,7 @@ readFileStrict, separate, separate',+ separateEnd', firstLine, firstLine', segment,@@ -62,6 +63,13 @@ | S.null b = r | otherwise = (a, S.tail b) +separateEnd' :: (Word8 -> Bool) -> S.ByteString -> (S.ByteString, S.ByteString)+separateEnd' c l = unbreak $ S.breakEnd c l+ where+ unbreak r@(a, b)+ | S.null a = r+ | otherwise = (S.init a, b)+ {- Breaks out the first line. -} firstLine :: String -> String firstLine = takeWhile (/= '\n')@@ -86,7 +94,7 @@ prop_segment_regressionTest = all id -- Even an empty list is a segment. [ segment (== "--") [] == [[]]- -- There are two segements in this list, even though the first is empty.+ -- There are two segments in this list, even though the first is empty. , segment (== "--") ["--", "foo", "bar"] == [[],["foo","bar"]] ]
Utility/Path.hs view
@@ -53,7 +53,7 @@ - - This does not guarantee that two paths that refer to the same location, - and are both relative to the same location (or both absolute) will- - yeild the same result. Run both through normalise from System.RawFilePath+ - yield the same result. Run both through normalise from System.RawFilePath - to ensure that. -} simplifyPath :: RawFilePath -> RawFilePath@@ -90,7 +90,7 @@ {- Checks if the first RawFilePath is, or could be said to contain the second. - For example, "foo/" contains "foo/bar". Also, "foo", "./foo", "foo/" etc- - are all equivilant.+ - are all equivalent. -} dirContains :: RawFilePath -> RawFilePath -> Bool dirContains a b = a == b
Utility/Path/AbsRel.hs view
@@ -37,7 +37,7 @@ - Also simplifies it using simplifyPath. - - The first parameter is a base directory (ie, the cwd) to use if the path- - is not already absolute, and should itsef be absolute.+ - is not already absolute, and should itself be absolute. - - Does not attempt to deal with edge cases or ensure security with - untrusted inputs.
+ Utility/Path/Windows.hs view
@@ -0,0 +1,47 @@+{- Windows paths+ -+ - Copyright 2022-2023 Joey Hess <id@joeyh.name>+ -+ - License: BSD-2-clause+ -}++{-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-tabs #-}++module Utility.Path.Windows (+ convertToWindowsNativeNamespace+) where++import Utility.Path+import Utility.FileSystemEncoding++import System.FilePath.ByteString (combine)+import qualified Data.ByteString as B+import qualified System.FilePath.Windows.ByteString as P+import System.Directory (getCurrentDirectory)++{- Convert a filepath to use Windows's native namespace.+ - This avoids filesystem length limits.+ -+ - This is similar to the way base converts filenames on windows,+ - but as that is implemented in C (create_device_name) and not+ - exported, it cannot be used here. Several edge cases are not handled,+ - including network shares and dos short paths.+ -}+convertToWindowsNativeNamespace :: RawFilePath -> IO RawFilePath+convertToWindowsNativeNamespace f+ | win32_dev_namespace `B.isPrefixOf` f = return f+ | win32_file_namespace `B.isPrefixOf` f = return f+ | nt_device_namespace `B.isPrefixOf` f = return f+ | otherwise = do+ -- Make absolute because any '.' and '..' in the path+ -- will not be resolved once it's converted.+ cwd <- toRawFilePath <$> getCurrentDirectory+ let p = simplifyPath (combine cwd f)+ -- Normalize slashes.+ let p' = P.normalise p+ return (win32_file_namespace <> p')+ where+ win32_dev_namespace = "\\\\.\\"+ win32_file_namespace = "\\\\?\\"+ nt_device_namespace = "\\Device\\"
Utility/QuickCheck.hs view
@@ -6,6 +6,7 @@ -} {-# OPTIONS_GHC -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-warn-tabs #-} {-# LANGUAGE TypeSynonymInstances #-} module Utility.QuickCheck
Utility/RawFilePath.hs view
@@ -5,9 +5,11 @@ - - On Windows, filenames are in unicode, so RawFilePaths have to be - decoded. So this library will work, but less efficiently than using- - FilePath would.+ - FilePath would. However, this library also takes care to support long+ - filenames on Windows, by either using other libraries that do, or by+ - doing UNC-style conversion itself. -- - Copyright 2019-2020 Joey Hess <id@joeyh.name>+ - Copyright 2019-2023 Joey Hess <id@joeyh.name> - - License: BSD-2-clause -}@@ -27,7 +29,10 @@ getCurrentDirectory, createDirectory, setFileMode,+ setOwnerAndGroup, rename,+ createNamedPipe,+ fileAccess, ) where #ifndef mingw32_HOST_OS@@ -48,23 +53,28 @@ #else import System.PosixCompat (FileStatus, FileMode)+-- System.PosixCompat does not handle UNC-style conversion itself,+-- so all uses of it library have to be pre-converted below. See+-- https://github.com/jacobstanley/unix-compat/issues/56 import qualified System.PosixCompat as P-import qualified System.PosixCompat.Files as F import qualified System.Directory as D import Utility.FileSystemEncoding+import Utility.Path.Windows readSymbolicLink :: RawFilePath -> IO RawFilePath readSymbolicLink f = toRawFilePath <$> P.readSymbolicLink (fromRawFilePath f) createSymbolicLink :: RawFilePath -> RawFilePath -> IO ()-createSymbolicLink a b = P.createSymbolicLink- (fromRawFilePath a)- (fromRawFilePath b)+createSymbolicLink a b = do+ a' <- fromRawFilePath <$> convertToWindowsNativeNamespace a+ b' <- fromRawFilePath <$> convertToWindowsNativeNamespace b+ P.createSymbolicLink a' b' createLink :: RawFilePath -> RawFilePath -> IO ()-createLink a b = P.createLink- (fromRawFilePath a)- (fromRawFilePath b)+createLink a b = do+ a' <- fromRawFilePath <$> convertToWindowsNativeNamespace a+ b' <- fromRawFilePath <$> convertToWindowsNativeNamespace b+ P.createLink a' b' {- On windows, removeLink is not available, so only remove files, - not symbolic links. -}@@ -72,10 +82,12 @@ removeLink = D.removeFile . fromRawFilePath getFileStatus :: RawFilePath -> IO FileStatus-getFileStatus = P.getFileStatus . fromRawFilePath+getFileStatus p = P.getFileStatus . fromRawFilePath+ =<< convertToWindowsNativeNamespace p getSymbolicLinkStatus :: RawFilePath -> IO FileStatus-getSymbolicLinkStatus = P.getSymbolicLinkStatus . fromRawFilePath+getSymbolicLinkStatus p = P.getSymbolicLinkStatus . fromRawFilePath+ =<< convertToWindowsNativeNamespace p doesPathExist :: RawFilePath -> IO Bool doesPathExist = D.doesPathExist . fromRawFilePath@@ -87,10 +99,27 @@ createDirectory = D.createDirectory . fromRawFilePath setFileMode :: RawFilePath -> FileMode -> IO () -setFileMode = F.setFileMode . fromRawFilePath+setFileMode p m = do+ p' <- fromRawFilePath <$> convertToWindowsNativeNamespace p+ P.setFileMode p' m {- Using renamePath rather than the rename provided in unix-compat - because of this bug https://github.com/jacobstanley/unix-compat/issues/56-} rename :: RawFilePath -> RawFilePath -> IO () rename a b = D.renamePath (fromRawFilePath a) (fromRawFilePath b)++setOwnerAndGroup :: RawFilePath -> P.UserID -> P.GroupID -> IO ()+setOwnerAndGroup p u g = do+ p' <- fromRawFilePath <$> convertToWindowsNativeNamespace p+ P.setOwnerAndGroup p' u g++createNamedPipe :: RawFilePath -> FileMode -> IO ()+createNamedPipe p m = do+ p' <- fromRawFilePath <$> convertToWindowsNativeNamespace p+ P.createNamedPipe p' m++fileAccess :: RawFilePath -> Bool -> Bool -> Bool -> IO Bool+fileAccess p a b c = do+ p' <- fromRawFilePath <$> convertToWindowsNativeNamespace p+ P.fileAccess p' a b c #endif
Utility/Scheduled.hs view
@@ -7,7 +7,7 @@ module Utility.Scheduled ( Schedule(..),- Recurrance(..),+ Recurrence(..), ScheduledTime(..), NextTime(..), WeekDay,@@ -19,8 +19,8 @@ fromSchedule, fromScheduledTime, toScheduledTime,- fromRecurrance,- toRecurrance,+ fromRecurrence,+ toRecurrence, toSchedule, parseSchedule, prop_past_sane,@@ -44,15 +44,15 @@ import Prelude {- Some sort of scheduled event. -}-data Schedule = Schedule Recurrance ScheduledTime+data Schedule = Schedule Recurrence ScheduledTime deriving (Eq, Read, Show, Ord) -data Recurrance+data Recurrence = Daily | Weekly (Maybe WeekDay) | Monthly (Maybe MonthDay) | Yearly (Maybe YearDay)- | Divisible Int Recurrance+ | Divisible Int Recurrence -- ^ Days, Weeks, or Months of the year evenly divisible by a number. -- (Divisible Year is years evenly divisible by a number.) deriving (Eq, Read, Show, Ord)@@ -89,7 +89,7 @@ -- | Calculate the next time that fits a Schedule, based on the -- last time it occurred, and the current time. calcNextTime :: Schedule -> Maybe LocalTime -> LocalTime -> Maybe NextTime-calcNextTime schedule@(Schedule recurrance scheduledtime) lasttime currenttime+calcNextTime schedule@(Schedule recurrence scheduledtime) lasttime currenttime | scheduledtime == AnyTime = do next <- findfromtoday True return $ case next of@@ -97,7 +97,7 @@ NextTimeExactly t -> window (localDay t) (localDay t) | otherwise = NextTimeExactly . startTime <$> findfromtoday False where- findfromtoday anytime = findfrom recurrance afterday today+ findfromtoday anytime = findfrom recurrence afterday today where today = localDay currenttime afterday = sameaslastrun || toolatetoday@@ -113,7 +113,7 @@ (LocalTime endd (TimeOfDay 23 59 0)) findfrom r afterday candidate | ynum candidate > (ynum (localDay currenttime)) + 100 =- -- avoid possible infinite recusion+ -- avoid possible infinite recursion error $ "bug: calcNextTime did not find a time within 100 years to run " ++ show (schedule, lasttime, currenttime) | otherwise = findfromChecked r afterday candidate@@ -225,24 +225,24 @@ maxwday :: Int maxwday = 7 -fromRecurrance :: Recurrance -> String-fromRecurrance (Divisible n r) =- fromRecurrance' (++ "s divisible by " ++ show n) r-fromRecurrance r = fromRecurrance' ("every " ++) r+fromRecurrence :: Recurrence -> String+fromRecurrence (Divisible n r) =+ fromRecurrence' (++ "s divisible by " ++ show n) r+fromRecurrence r = fromRecurrence' ("every " ++) r -fromRecurrance' :: (String -> String) -> Recurrance -> String-fromRecurrance' a Daily = a "day"-fromRecurrance' a (Weekly n) = onday n (a "week")-fromRecurrance' a (Monthly n) = onday n (a "month")-fromRecurrance' a (Yearly n) = onday n (a "year")-fromRecurrance' a (Divisible _n r) = fromRecurrance' a r -- not used+fromRecurrence' :: (String -> String) -> Recurrence -> String+fromRecurrence' a Daily = a "day"+fromRecurrence' a (Weekly n) = onday n (a "week")+fromRecurrence' a (Monthly n) = onday n (a "month")+fromRecurrence' a (Yearly n) = onday n (a "year")+fromRecurrence' a (Divisible _n r) = fromRecurrence' a r -- not used onday :: Maybe Int -> String -> String onday (Just n) s = "on day " ++ show n ++ " of " ++ s onday Nothing s = s -toRecurrance :: String -> Maybe Recurrance-toRecurrance s = case words s of+toRecurrence :: String -> Maybe Recurrence+toRecurrence s = case words s of ("every":"day":[]) -> Just Daily ("on":"day":sd:"of":"every":something:[]) -> withday sd something ("every":something:[]) -> noday something@@ -316,8 +316,8 @@ <*> if null m then Just 0 else readish m fromSchedule :: Schedule -> String-fromSchedule (Schedule recurrance scheduledtime) = unwords- [ fromRecurrance recurrance+fromSchedule (Schedule recurrence scheduledtime) = unwords+ [ fromRecurrence recurrence , "at" , fromScheduledTime scheduledtime ]@@ -327,14 +327,14 @@ parseSchedule :: String -> Either String Schedule parseSchedule s = do- r <- maybe (Left $ "bad recurrance: " ++ recurrance) Right- (toRecurrance recurrance)+ r <- maybe (Left $ "bad recurrence: " ++ recurrence) Right+ (toRecurrence recurrence) t <- maybe (Left $ "bad time of day: " ++ scheduledtime) Right (toScheduledTime scheduledtime) Right $ Schedule r t where (rws, tws) = separate (== "at") (words s)- recurrance = unwords rws+ recurrence = unwords rws scheduledtime = unwords tws prop_past_sane :: Bool
Utility/Scheduled/QuickCheck.hs view
@@ -26,7 +26,7 @@ <*> choose (1, 59) ] -instance Arbitrary Recurrance where+instance Arbitrary Recurrence where arbitrary = oneof [ pure Daily , Weekly <$> arbday
Utility/SshConfig.hs view
@@ -32,6 +32,7 @@ import Data.Char import Data.Ord import Data.Either+import System.PosixCompat.Files (groupWriteMode, otherWriteMode) data SshConfig = GlobalConfig SshSetting
Utility/SystemDirectory.hs view
@@ -1,4 +1,4 @@-{- System.Directory without its conflicting isSymbolicLink+{- System.Directory without its conflicting isSymbolicLink and getFileSize. - - Copyright 2016 Joey Hess <id@joeyh.name> -
Utility/Tmp.hs view
@@ -21,12 +21,12 @@ import System.FilePath import System.Directory import Control.Monad.IO.Class-import System.PosixCompat.Files hiding (removeLink) import System.IO.Error import Utility.Exception import Utility.FileSystemEncoding import Utility.FileMode+import qualified Utility.RawFilePath as R type Template = String @@ -62,14 +62,15 @@ _ <- tryIO $ hClose h tryIO $ removeFile tmpfile use (tmpfile, h) = do+ let tmpfile' = toRawFilePath tmpfile -- Make mode the same as if the file were created usually, -- not as a temp file. (This may fail on some filesystems -- that don't support file modes well, so ignore -- exceptions.)- _ <- liftIO $ tryIO $ setFileMode tmpfile =<< defaultFileMode+ _ <- liftIO $ tryIO $ R.setFileMode tmpfile' =<< defaultFileMode liftIO $ hClose h a tmpfile content- liftIO $ rename tmpfile file+ liftIO $ R.rename tmpfile' (toRawFilePath file) {- Runs an action with a tmp file located in the system's tmp directory - (or in "." if there is none) then removes the file. -}
Utility/Tor.hs view
@@ -22,8 +22,10 @@ import Common import Utility.ThreadScheduler import Utility.FileMode+import Utility.RawFilePath (setOwnerAndGroup) import System.PosixCompat.Types+import System.PosixCompat.Files (ownerReadMode, ownerWriteMode, ownerExecuteMode) import Data.Char import Network.Socket import Network.Socks5@@ -165,7 +167,7 @@ prepHiddenServiceSocketDir :: AppName -> UserID -> UniqueIdent -> IO () prepHiddenServiceSocketDir appname uid ident = do createDirectoryIfMissing True d- setOwnerAndGroup d uid (-1)+ setOwnerAndGroup (toRawFilePath d) uid (-1) modifyFileMode (toRawFilePath d) $ addModes [ownerReadMode, ownerExecuteMode, ownerWriteMode] where
Utility/Url.hs view
@@ -352,7 +352,7 @@ headRequest :: Request -> Request headRequest r = r { method = methodHead- -- remove defaut Accept-Encoding header, to get actual,+ -- remove default Accept-Encoding header, to get actual, -- not gzip compressed size. , requestHeaders = (hAcceptEncoding, B.empty) : filter (\(h, _) -> h /= hAcceptEncoding)
Utility/Yesod.hs view
@@ -1,6 +1,6 @@ {- Yesod stuff, that's typically found in the scaffolded site. -- - Also a bit of a compatability layer for older versions of yesod.+ - Also a bit of a compatibility layer for older versions of yesod. - - Copyright 2012-2014 Joey Hess <id@joeyh.name> -
doc/git-annex-adjust.mdwn view
@@ -59,7 +59,7 @@ * `--lock` - Lock all annexed file in the adjusted branch. This may be preferred+ Lock all annexed files in the adjusted branch. This may be preferred by those who like seeing broken symlinks when the content of an annexed file is not present. @@ -127,6 +127,8 @@ [[git-annex-upgrade]](1) [[git-annex-sync]](1)++[[git-annex-view]](1) # AUTHOR
doc/git-annex-status.mdwn view
@@ -1,6 +1,6 @@ # NAME -git-annex status - show the working tree status+git-annex status - show the working tree status (deprecated) # SYNOPSIS
doc/git-annex-view.mdwn view
@@ -62,6 +62,8 @@ [[git-annex-vcycle]](1) +[[git-annex-adjust]](1)+ # AUTHOR Joey Hess <id@joeyh.name>
doc/git-annex.mdwn view
@@ -92,8 +92,7 @@ * `status [path ...]` - Similar to `git status --short`, displays the status of the files in the- working tree.+ Show the working tree status. (deprecated) See [[git-annex-status]](1) for details.
git-annex.cabal view
@@ -1,5 +1,5 @@ Name: git-annex-Version: 10.20230227+Version: 10.20230321 Cabal-Version: 1.12 License: AGPL-3 Maintainer: Joey Hess <id@joeyh.name>@@ -30,7 +30,7 @@ to git and transferring them to other computers. The git-annex webapp makes it easy to set up and use git-annex this way. -- The tarball uploaded to hackage does not include every non-haskell--- file in the git repo. The website is left out, so is build machinary for+-- file in the git repo. The website is left out, so is build machinery for -- standalone apps, and packages. Include only files that are needed -- make cabal install git-annex work. Extra-Source-Files:@@ -397,7 +397,7 @@ else GHC-Options: -O0 - -- Avoid linking with unused dynamic libaries.+ -- Avoid linking with unused dynamic libraries. if os(linux) || os(freebsd) GHC-Options: -optl-Wl,--as-needed @@ -1122,6 +1122,7 @@ Utility.Path.AbsRel Utility.Path.Max Utility.Path.Tests+ Utility.Path.Windows Utility.Percentage Utility.Process Utility.Process.Shim
templates/configurators/addia.hamlet view
@@ -4,7 +4,7 @@ Adding an Internet Archive item <p> <a href="http://archive.org/">The Internet Archive</a> allows anyone #- to publically archive their information, for free. All you need to #+ to publicly archive their information, for free. All you need to # get started is to # <a href="http://archive.org/account/login.createaccount.php"> Create an account
templates/configurators/fsck/formcontent.hamlet view
@@ -7,7 +7,7 @@ ^{fvInput durationView} minutes # <div .form-group> \ - ^{fvInput recurranceView} #+ ^{fvInput recurrenceView} # \ starting at ^{fvInput timeView} # $if new