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.
-- Joey Hess <id@joeyh.name> Mon, 27 Feb 2023 12:31:14 -0400
-
- 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,
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
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
the log correctly. This can also be seen by passing a value
with a newline to `git-annex describe`. It would also happen in the
case with the newline directory if it didn't fail earlier.
-
-Another log file that has a similar problem BTW is config.log,
-which can get a newline in a value with eg
-`git annex config --set annex.largefiles "xxx\nyyy"`
-and the result is that reading the value back out omits
-the part after the newline.
"""]]