export: When a submodule is in the tree to be exported, skip it.
This commit is contained in:
parent
ca25e94790
commit
f2a425bd92
3 changed files with 31 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
git-annex (8.20210311) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
* export: When a submodule is in the tree to be exported, skip it.
|
||||||
|
|
||||||
|
-- Joey Hess <id@joeyh.name> Fri, 12 Mar 2021 12:06:37 -0400
|
||||||
|
|
||||||
git-annex (8.20210310) upstream; urgency=medium
|
git-annex (8.20210310) upstream; urgency=medium
|
||||||
|
|
||||||
* When non-annexed files in a tree are exported to a special remote,
|
* When non-annexed files in a tree are exported to a special remote,
|
||||||
|
|
|
@ -241,7 +241,9 @@ fillExport r db (PreferredFiltered newtree) mtbcommitsha = do
|
||||||
(l, cleanup) <- inRepo $ Git.LsTree.lsTree Git.LsTree.LsTreeRecursive newtree
|
(l, cleanup) <- inRepo $ Git.LsTree.lsTree Git.LsTree.LsTreeRecursive newtree
|
||||||
cvar <- liftIO $ newMVar (FileUploaded False)
|
cvar <- liftIO $ newMVar (FileUploaded False)
|
||||||
allfilledvar <- liftIO $ newMVar (AllFilled True)
|
allfilledvar <- liftIO $ newMVar (AllFilled True)
|
||||||
commandActions $ map (startExport r db cvar allfilledvar) l
|
commandActions $
|
||||||
|
map (startExport r db cvar allfilledvar)
|
||||||
|
(filter shouldexport l)
|
||||||
void $ liftIO $ cleanup
|
void $ liftIO $ cleanup
|
||||||
waitForAllRunningCommandActions
|
waitForAllRunningCommandActions
|
||||||
|
|
||||||
|
@ -253,6 +255,14 @@ fillExport r db (PreferredFiltered newtree) mtbcommitsha = do
|
||||||
>>= setRemoteTrackingBranch tb
|
>>= setRemoteTrackingBranch tb
|
||||||
|
|
||||||
liftIO $ fromFileUploaded <$> takeMVar cvar
|
liftIO $ fromFileUploaded <$> takeMVar cvar
|
||||||
|
where
|
||||||
|
shouldexport ti = case readObjectType (Git.LsTree.typeobj ti) of
|
||||||
|
Just BlobObject -> True
|
||||||
|
Just CommitObject -> False
|
||||||
|
-- ^ submodule is not exported
|
||||||
|
Just TreeObject -> False
|
||||||
|
-- ^ should never happen, lstree is recursing into subtrees
|
||||||
|
Nothing -> False
|
||||||
|
|
||||||
startExport :: Remote -> ExportHandle -> MVar FileUploaded -> MVar AllFilled -> Git.LsTree.TreeItem -> CommandStart
|
startExport :: Remote -> ExportHandle -> MVar FileUploaded -> MVar AllFilled -> Git.LsTree.TreeItem -> CommandStart
|
||||||
startExport r db cvar allfilledvar ti = do
|
startExport r db cvar allfilledvar ti = do
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 2"""
|
||||||
|
date="2021-03-12T16:16:44Z"
|
||||||
|
content="""
|
||||||
|
Easy enough to exclude them from export, that's done.
|
||||||
|
|
||||||
|
But the other side of the coin is, importing back from there will generate
|
||||||
|
a remote-tracking branch without the submodule, and merging it will result
|
||||||
|
in a tree that does not include the submodule, as if it were deleted.
|
||||||
|
|
||||||
|
So, importing needs to somehow add back submodules,
|
||||||
|
unless the submodule location has been overwritten with a file on the remote.
|
||||||
|
"""]]
|
Loading…
Add table
Reference in a new issue