Sped up git-annex init in a clone of an existing repository
Seems that hasOrigin was never finding origin's git-annex branch, so a new one got created each time. And so then it later needed to merge the two branches, which is expensive. Added --no-track to git branch to avoid it displaying a message about setting up tracking branches. Of course there's no reason to make the git-annex branch a tracking branch since git-annex auto-merges it.
This commit is contained in:
parent
798f685077
commit
5d78cd9d08
4 changed files with 19 additions and 3 deletions
|
@ -89,7 +89,7 @@ fullname = Git.Ref $ "refs/heads/" <> fromRef' name
|
||||||
|
|
||||||
{- Branch's name in origin. -}
|
{- Branch's name in origin. -}
|
||||||
originname :: Git.Ref
|
originname :: Git.Ref
|
||||||
originname = Git.Ref $ "origin/" <> fromRef' name
|
originname = Git.Ref $ "refs/remotes/origin/" <> fromRef' name
|
||||||
|
|
||||||
{- Does origin/git-annex exist? -}
|
{- Does origin/git-annex exist? -}
|
||||||
hasOrigin :: Annex Bool
|
hasOrigin :: Annex Bool
|
||||||
|
@ -114,7 +114,11 @@ getBranch = maybe (hasOrigin >>= go >>= use) return =<< branchsha
|
||||||
where
|
where
|
||||||
go True = do
|
go True = do
|
||||||
inRepo $ Git.Command.run
|
inRepo $ Git.Command.run
|
||||||
[Param "branch", Param $ fromRef name, Param $ fromRef originname]
|
[ Param "branch"
|
||||||
|
, Param "--no-track"
|
||||||
|
, Param $ fromRef name
|
||||||
|
, Param $ fromRef originname
|
||||||
|
]
|
||||||
fromMaybe (error $ "failed to create " ++ fromRef name)
|
fromMaybe (error $ "failed to create " ++ fromRef name)
|
||||||
<$> branchsha
|
<$> branchsha
|
||||||
go False = withIndex' True $ do
|
go False = withIndex' True $ do
|
||||||
|
|
|
@ -23,6 +23,7 @@ git-annex (8.20210311) UNRELEASED; urgency=medium
|
||||||
operating on keys.
|
operating on keys.
|
||||||
* New annex.supportunlocked config that can be set to false to avoid
|
* New annex.supportunlocked config that can be set to false to avoid
|
||||||
some expensive things needed to support unlocked files.
|
some expensive things needed to support unlocked files.
|
||||||
|
* Sped up git-annex init in a clone of an existing repository.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 12 Mar 2021 12:06:37 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 12 Mar 2021 12:06:37 -0400
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,8 @@ dateRef r (RefDate d) = Ref $ fromRef' r <> "@" <> encodeBS' d
|
||||||
fileFromRef :: Ref -> RawFilePath -> Ref
|
fileFromRef :: Ref -> RawFilePath -> Ref
|
||||||
fileFromRef r f = let (Ref fr) = fileRef f in Ref (fromRef' r <> fr)
|
fileFromRef r f = let (Ref fr) = fileRef f in Ref (fromRef' r <> fr)
|
||||||
|
|
||||||
{- Checks if a ref exists. -}
|
{- Checks if a ref exists. Note that it must be fully qualified,
|
||||||
|
- eg refs/heads/master rather than master. -}
|
||||||
exists :: Ref -> Repo -> IO Bool
|
exists :: Ref -> Repo -> IO Bool
|
||||||
exists ref = runBool
|
exists ref = runBool
|
||||||
[ Param "show-ref"
|
[ Param "show-ref"
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 6"""
|
||||||
|
date="2021-03-23T19:15:23Z"
|
||||||
|
content="""
|
||||||
|
Found a way to speed up git-annex init's setup of the git-annex branch when
|
||||||
|
run in a clone of an existing repo. In a 100,000 file repo, it improved
|
||||||
|
from 17s to 10s. I have a feeling that might have been what was really
|
||||||
|
making it seem slow to you.
|
||||||
|
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue