summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-15 15:40:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-15 15:48:21 -0400
commit87fb9c690e776852e8dc3fa2ba53a3e267f203d8 (patch)
tree5d2a9f4500fc3352a922bbf570b472cc8e794a1b /Annex
parentb453ea8b48b882430052695f465d1747539693d8 (diff)
remove withIndexUpdate helper
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Branch.hs27
1 files changed, 13 insertions, 14 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs
index f36f1c57b..b403f0c74 100644
--- a/Annex/Branch.hs
+++ b/Annex/Branch.hs
@@ -85,7 +85,7 @@ getBranch = maybe (hasOrigin >>= go >>= use) return =<< branchsha
return sha
branchsha = inRepo $ Git.Ref.sha fullname
-{- Ensures that the branch and index are is up-to-date; should be
+{- Ensures that the branch and index are up-to-date; should be
- called before data is read from it. Runs only once per git-annex run.
-}
update :: Annex ()
@@ -145,7 +145,8 @@ updateTo pairs = do
isnewer (r, _) = inRepo $ Git.Branch.changed fullname r
{- Gets the content of a file on the branch, or content from the journal, or
- - staged in the index.
+ - staged in the index. Merges remote versions of the branch if necessary,
+ - to ensure the most up-to-date available content is available.
-
- Returns an empty string if the file doesn't exist yet. -}
get :: FilePath -> Annex String
@@ -165,7 +166,9 @@ get' staleok file = fromcache =<< getCache file
fromjournal (Just content) = cache content
fromjournal Nothing
| staleok = withIndex frombranch
- | otherwise = withIndexUpdate $ frombranch >>= cache
+ | otherwise = do
+ update
+ withIndex $ frombranch >>= cache
frombranch = L.unpack <$> catFile fullname file
cache content = do
setCache file content
@@ -249,12 +252,13 @@ commitBranch branchref message parents = do
{- Lists all files on the branch. There may be duplicates in the list. -}
files :: Annex [FilePath]
-files = withIndexUpdate $ do
- bfiles <- inRepo $ Git.Command.pipeNullSplit
- [Params "ls-tree --name-only -r -z", Param $ show fullname]
- jfiles <- getJournalledFiles
- return $ jfiles ++ bfiles
-
+files = do
+ update
+ withIndex $ do
+ bfiles <- inRepo $ Git.Command.pipeNullSplit
+ [Params "ls-tree --name-only -r -z", Param $ show fullname]
+ jfiles <- getJournalledFiles
+ return $ jfiles ++ bfiles
{- Populates the branch's index file with the current branch contents.
-
@@ -292,11 +296,6 @@ withIndex' bootstrapping a = do
return r
-{- Runs an action using the branch's index file, first making sure that
- - the branch and index are up-to-date. -}
-withIndexUpdate :: Annex a -> Annex a
-withIndexUpdate a = update >> withIndex a
-
{- Updates the branch's index to reflect the current contents of the branch.
- Any changes staged in the index will be preserved.
-