cross-repo import now working correctly

This commit is contained in:
Joey Hess 2019-03-07 12:31:35 -04:00
parent ee251b2e2e
commit 68d1661251
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 12 additions and 7 deletions

View file

@ -307,12 +307,13 @@ updateContentIdentifierDbFromBranch :: CIDDb.ContentIdentifierHandle -> Annex ()
updateContentIdentifierDbFromBranch db = do
oldtree <- liftIO $ CIDDb.getAnnexBranchTree db
inRepo (Git.Ref.tree Annex.Branch.fullname) >>= \case
Just t | t /= oldtree -> do
(l, cleanup) <- inRepo $ DiffTree.diffTree oldtree t
Just currtree | currtree /= oldtree -> do
(l, cleanup) <- inRepo $
DiffTree.diffTreeRecursive oldtree currtree
mapM_ go l
void $ liftIO $ cleanup
liftIO $ do
CIDDb.recordAnnexBranchTree db t
CIDDb.recordAnnexBranchTree db t currtree
CIDDb.flushDbQueue db
_ -> return ()
where

View file

@ -17,10 +17,6 @@ this.
* Need to support annex-tracking-branch configuration, which documentation
says makes git-annex sync and assistant do imports.
* Test behavior when multiple repos import from same special remote;
the second importer should not re-download as long as it has pulled
from the first importer.
* When on an adjusted unlocked branch, need to import the files unlocked.
Also, the tracking branch code needs to know about such branches,
currently it will generate the wrong tracking branch.
@ -28,6 +24,14 @@ this.
The test case for `export_import` currently has a line commented out
that fails on adjusted unlocked branches.
Alternatively, could not do anything special for adjusted branches,
so generating a non-adjusted branch, and require the user use `git annex
sync` to merge in that branch. Rationalle: After fetching from a normal
git repo in an adjusted branch, merging does the same thing, and the docs
say to use `git annex sync` instead. Any improvments to that workflow
(like eg a way to merge a specified branch and update the adjustment)
would thus benefit both uses cases.
* What if the remote lists importable filenames that are absolute paths,
or contain a "../" attack? Does git already guard against merging such
trees?