add git bundle interface

Sponsored-by: mycroft on Patreon
This commit is contained in:
Joey Hess 2024-05-07 14:22:41 -04:00
parent 8d58a23548
commit e1447dc2e2
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 26 additions and 0 deletions

25
Git/Bundle.hs Normal file
View file

@ -0,0 +1,25 @@
{- git bundles
-
- Copyright 2024 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
module Git.Bundle where
import Common
import Git
import Git.Command
import Data.Char (ord)
import qualified Data.ByteString.Char8 as S8
listHeads :: FilePath -> Repo -> IO [(Sha, Ref)]
listHeads bundle repo = map gen . S8.lines <$>
pipeReadStrict [Param "bundle", Param "list-heads", File bundle] repo
where
gen l = let (s, r) = separate' (== fromIntegral (ord ' ')) l
in (Ref s, Ref r)
unbundle :: FilePath -> Repo -> IO ()
unbundle bundle = runQuiet [Param "bundle", Param "unbundle", File bundle]

View file

@ -760,6 +760,7 @@ Executable git-annex
Git.AutoCorrect
Git.Branch
Git.BuildVersion
Git.Bundle
Git.CatFile
Git.CheckAttr
Git.CheckIgnore