summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/FilterBranch.hs35
-rw-r--r--Git/Branch.hs7
-rw-r--r--Logs.hs10
-rw-r--r--doc/git-annex-filter-branch.mdwn6
-rw-r--r--doc/git-annex.mdwn2
5 files changed, 44 insertions, 16 deletions
diff --git a/Command/FilterBranch.hs b/Command/FilterBranch.hs
index c6a7fa846b..c26aeb3890 100644
--- a/Command/FilterBranch.hs
+++ b/Command/FilterBranch.hs
@@ -22,6 +22,7 @@ import Git.Index
import Git.Env
import Git.UpdateIndex
import qualified Git.LsTree as LsTree
+import qualified Git.Branch as Git
import Utility.RawFilePath
import qualified Data.Set as S
@@ -107,12 +108,12 @@ seek :: FilterBranchOptions -> CommandSeek
seek o = withOtherTmp $ \tmpdir -> do
let tmpindex = tmpdir P.</> "index"
gc <- Annex.getGitConfig
- r' <- Annex.inRepo $ \r ->
+ tmpindexrepo <- Annex.inRepo $ \r ->
addGitEnv r indexEnv (fromRawFilePath tmpindex)
- withUpdateIndex r' $ \h -> do
+ withUpdateIndex tmpindexrepo $ \h -> do
keyinfomatcher <- mkUUIDMatcher (keyInformation o)
- configmatcher <- mkUUIDMatcher (repoConfig o)
-
+ repoconfigmatcher <- mkUUIDMatcher (repoConfig o)
+
let addtoindex f sha = liftIO $ streamUpdateIndex' h $
pureStreamer $ L.fromStrict $ LsTree.formatLsTree $ LsTree.TreeItem
{ LsTree.mode = fromTreeItemType TreeFile
@@ -133,12 +134,14 @@ seek o = withOtherTmp $ \tmpdir -> do
-- up the sha of the file in the branch.
PreserveFile -> addtoindex f =<< hashBlob c
+ -- Add information for all keys that are being included,
+ -- filtering out information for repositories that are not
+ -- being included.
let addkeyinfo k = startingCustomOutput k $ do
forM_ (keyLogFiles gc k) $ \f ->
filterbanch keyinfomatcher f
=<< Annex.Branch.get f
next (return True)
-
let seeker = AnnexedFileSeeker
{ startAction = \_ _ k -> addkeyinfo k
, checkContentPresent = Nothing
@@ -154,7 +157,27 @@ seek o = withOtherTmp $ \tmpdir -> do
(withFilesInGitAnnex ww seeker)
=<< workTreeItems ww (includeFiles o)
- -- TODO output commit
+ -- Add repository configs for all repositories that are
+ -- being included.
+ -- TODO need to include configs for sameas remotes
+ forM_ topLevelUUIDBasedLogs $ \f ->
+ filterbanch repoconfigmatcher f
+ =<< Annex.Branch.get f
+
+ -- Add global configs when included.
+ when (includeGlobalConfig o) $
+ forM_ otherTopLevelLogs $ \f -> do
+ c <- Annex.Branch.get f
+ unless (L.null c) $
+ addtoindex f =<< hashBlob c
+
+ -- Commit the temporary index, and output the result.
+ t <- liftIO $ Git.writeTree tmpindexrepo
liftIO $ removeWhenExistsWith removeLink tmpindex
+ cmode <- annexCommitMode <$> Annex.getGitConfig
+ cmessage <- Annex.Branch.commitMessage
+ c <- inRepo $ Git.commitTree cmode cmessage [] t
+ -- TODO export.log trees
+ liftIO $ putStrLn (fromRef c)
where
ww = WarnUnmatchLsFiles
diff --git a/Git/Branch.hs b/Git/Branch.hs
index fcae905f64..70faca335f 100644
--- a/Git/Branch.hs
+++ b/Git/Branch.hs
@@ -1,6 +1,6 @@
{- git branch stuff
-
- - Copyright 2011 Joey Hess <id@joeyh.name>
+ - Copyright 2011-2021 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@@ -166,7 +166,7 @@ commitCommand' runner commitmode ps = runner $
-}
commit :: CommitMode -> Bool -> String -> Branch -> [Ref] -> Repo -> IO (Maybe Sha)
commit commitmode allowempty message branch parentrefs repo = do
- tree <- getSha "write-tree" $ pipeReadStrict [Param "write-tree"] repo
+ tree <- writeTree repo
ifM (cancommit tree)
( do
sha <- commitTree commitmode message parentrefs tree repo
@@ -185,6 +185,9 @@ commitAlways :: CommitMode -> String -> Branch -> [Ref] -> Repo -> IO Sha
commitAlways commitmode message branch parentrefs repo = fromJust
<$> commit commitmode True message branch parentrefs repo
+writeTree :: Repo -> IO Sha
+writeTree repo = getSha "write-tree" $ pipeReadStrict [Param "write-tree"] repo
+
commitTree :: CommitMode -> String -> [Ref] -> Ref -> Repo -> IO Sha
commitTree commitmode message parentrefs tree repo =
getSha "commit-tree" $
diff --git a/Logs.hs b/Logs.hs
index 2948106692..fae8c24a9c 100644
--- a/Logs.hs
+++ b/Logs.hs
@@ -72,13 +72,9 @@ keyLogFiles config k =
, chunkLogFile config k
] ++ oldurlLogs config k
-{- All the log files that do not contain information specific to a key. -}
-nonKeyLogFiles :: [RawFilePath]
-nonKeyLogFiles = concat
- [ topLevelNewUUIDBasedLogs
- , topLevelOldUUIDBasedLogs
- , otherTopLevelLogs
- ]
+{- All uuid-based logs stored in the top of the git-annex branch. -}
+topLevelUUIDBasedLogs :: [RawFilePath]
+topLevelUUIDBasedLogs = topLevelNewUUIDBasedLogs ++ topLevelOldUUIDBasedLogs
{- All the old-format uuid-based logs stored in the top of the git-annex branch. -}
topLevelOldUUIDBasedLogs :: [RawFilePath]
diff --git a/doc/git-annex-filter-branch.mdwn b/doc/git-annex-filter-branch.mdwn
index e960ec4db3..328a26ee0e 100644
--- a/doc/git-annex-filter-branch.mdwn
+++ b/doc/git-annex-filter-branch.mdwn
@@ -25,6 +25,12 @@ With no options, no information at all will be included from the git-annex
branch. Use options to specify what to include. All options can be specified
multiple times.
+Note that, when the repository contains information about a private
+repository (due to `annex.private` being set, or `--private` being used
+with [[git-annex-initremote](1)), that private information will be included
+when allowed by the options, even though it is not recorded on the git-annex
+branch.
+
# OPTIONS
* `path`
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index bfa1a3a06d..f355359bb3 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -1014,7 +1014,7 @@ repository, using [[git-annex-config]]. See its man page for a list.)
* `annex.commitmessage`
When git-annex updates the git-annex branch, it usually makes up
- its own commit message ("update"), since users rarely look at or
+ its own commit message (eg "update"), since users rarely look at or
care about changes to that branch. If you do care, you can
specify this setting by running commands with
`-c annex.commitmessage=whatever`