optimize index updating
The last branch ref that the index was updated to is stored in .git/annex/index.lck, and the index only updated when the current branch ref differs. (The .lck file should later be used for locking too.) Some more optimization is still needed, since there is some redundancy in calls to git show-ref.
This commit is contained in:
parent
8680c415de
commit
cfbbda99f4
4 changed files with 52 additions and 14 deletions
5
Git.hs
5
Git.hs
|
@ -463,8 +463,8 @@ shaSize :: Int
|
|||
shaSize = 40
|
||||
|
||||
{- Commits the index into the specified branch (or other ref),
|
||||
- with the specified parent refs. -}
|
||||
commit :: String -> Ref -> [Ref] -> Repo -> IO ()
|
||||
- with the specified parent refs, and returns the new ref -}
|
||||
commit :: String -> Ref -> [Ref] -> Repo -> IO Ref
|
||||
commit message newref parentrefs repo = do
|
||||
tree <- getSha "write-tree" $ asString $
|
||||
pipeRead [Param "write-tree"] repo
|
||||
|
@ -473,6 +473,7 @@ commit message newref parentrefs repo = do
|
|||
(map Param $ ["commit-tree", show tree] ++ ps)
|
||||
(L.pack message) repo
|
||||
run "update-ref" [Param $ show newref, Param $ show sha] repo
|
||||
return sha
|
||||
where
|
||||
ignorehandle a = snd <$> a
|
||||
asString a = L.unpack <$> a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue