fix update of export tracking branch when exporting branch:subdir
This commit is contained in:
parent
2912429640
commit
e46e40bf05
2 changed files with 16 additions and 4 deletions
|
@ -79,9 +79,10 @@ seek o = do
|
||||||
setConfig (remoteConfig r "annex-tracking-branch")
|
setConfig (remoteConfig r "annex-tracking-branch")
|
||||||
(fromRef $ exportTreeish o)
|
(fromRef $ exportTreeish o)
|
||||||
|
|
||||||
mtbcommitsha <- getExportCommit r (exportTreeish o)
|
|
||||||
tree <- fromMaybe (giveup "unknown tree") <$>
|
tree <- fromMaybe (giveup "unknown tree") <$>
|
||||||
inRepo (Git.Ref.tree (fromMaybe (exportTreeish o) (fmap snd mtbcommitsha)))
|
inRepo (Git.Ref.tree (exportTreeish o))
|
||||||
|
|
||||||
|
mtbcommitsha <- getExportCommit r (exportTreeish o)
|
||||||
|
|
||||||
db <- openDb (uuid r)
|
db <- openDb (uuid r)
|
||||||
writeLockDbWhile db $ do
|
writeLockDbWhile db $ do
|
||||||
|
@ -93,6 +94,10 @@ seek o = do
|
||||||
-- | When the treeish is a branch like master or refs/heads/master
|
-- | When the treeish is a branch like master or refs/heads/master
|
||||||
-- (but not refs/remotes/...), find the commit it points to
|
-- (but not refs/remotes/...), find the commit it points to
|
||||||
-- and the corresponding remote tracking branch.
|
-- and the corresponding remote tracking branch.
|
||||||
|
--
|
||||||
|
-- The treeish may also be a subdir within a branch, like master:subdir,
|
||||||
|
-- that results in this returning the same thing it does for the master
|
||||||
|
-- branch.
|
||||||
getExportCommit :: Remote -> Git.Ref -> Annex (Maybe (RemoteTrackingBranch, Sha))
|
getExportCommit :: Remote -> Git.Ref -> Annex (Maybe (RemoteTrackingBranch, Sha))
|
||||||
getExportCommit r treeish
|
getExportCommit r treeish
|
||||||
| '/' `notElem` fromRef baseref = do
|
| '/' `notElem` fromRef baseref = do
|
||||||
|
@ -101,7 +106,8 @@ getExportCommit r treeish
|
||||||
return (fmap (tb, ) commitsha)
|
return (fmap (tb, ) commitsha)
|
||||||
| otherwise = return Nothing
|
| otherwise = return Nothing
|
||||||
where
|
where
|
||||||
baseref = Git.Ref.removeBase refsheads treeish
|
baseref = Ref $ takeWhile (/= ':') $ fromRef $
|
||||||
|
Git.Ref.removeBase refsheads treeish
|
||||||
refsheads = "refs/heads"
|
refsheads = "refs/heads"
|
||||||
|
|
||||||
-- | Changes what's exported to the remote. Does not upload any new
|
-- | Changes what's exported to the remote. Does not upload any new
|
||||||
|
|
|
@ -10,7 +10,13 @@ this.
|
||||||
|
|
||||||
## implementation notes
|
## implementation notes
|
||||||
|
|
||||||
* Does export of master:subdir update the remote tracking branch right?
|
* When doing `git annex export master:subdir` followed by
|
||||||
|
`git annex import master:subdir` which imports a new file,
|
||||||
|
followed by merging the import and re-export, it does unncessary
|
||||||
|
work deleting stuff not in the subdir from the remote.
|
||||||
|
|
||||||
|
Why? Seems that the import recorded the exported tree wrong, using the
|
||||||
|
whole tree and not the sub-tree.
|
||||||
|
|
||||||
* Does sync --content with remote.name.annex-tracking-branch=master:subdir
|
* Does sync --content with remote.name.annex-tracking-branch=master:subdir
|
||||||
export the right tree and update the remote tracking branch right?
|
export the right tree and update the remote tracking branch right?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue