deal with cloning a repo that has an ajdusted branch checked out
This commit is contained in:
parent
83ac453bc4
commit
7c7f3a0f76
3 changed files with 16 additions and 2 deletions
|
@ -18,6 +18,7 @@ module Annex.AdjustedBranch (
|
||||||
adjustToCrippledFileSystem,
|
adjustToCrippledFileSystem,
|
||||||
updateAdjustedBranch,
|
updateAdjustedBranch,
|
||||||
propigateAdjustedCommits,
|
propigateAdjustedCommits,
|
||||||
|
checkAdjustedClone,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Annex.Common
|
import Annex.Common
|
||||||
|
@ -419,3 +420,17 @@ diffTreeToTreeItem dti = TreeItem
|
||||||
(Git.DiffTree.file dti)
|
(Git.DiffTree.file dti)
|
||||||
(Git.DiffTree.dstmode dti)
|
(Git.DiffTree.dstmode dti)
|
||||||
(Git.DiffTree.dstsha dti)
|
(Git.DiffTree.dstsha dti)
|
||||||
|
|
||||||
|
{- Cloning a repository that has an adjusted branch checked out will
|
||||||
|
- result in the clone having the same adjusted branch checked out -- but
|
||||||
|
- the origbranch won't exist in the clone. Create the origbranch. -}
|
||||||
|
checkAdjustedClone :: Annex ()
|
||||||
|
checkAdjustedClone = go =<< inRepo Git.Branch.current
|
||||||
|
where
|
||||||
|
go Nothing = return ()
|
||||||
|
go (Just currbranch) = case adjustedToOriginal currbranch of
|
||||||
|
Nothing -> return ()
|
||||||
|
Just (_adj, origbranch) ->
|
||||||
|
unlessM (inRepo $ Git.Ref.exists origbranch) $ do
|
||||||
|
let remotebranch = Git.Ref.underBase "refs/remotes/origin" origbranch
|
||||||
|
inRepo $ Git.Branch.update' origbranch remotebranch
|
||||||
|
|
|
@ -105,6 +105,7 @@ initialize' mversion = do
|
||||||
, unlessM isBare
|
, unlessM isBare
|
||||||
switchHEADBack
|
switchHEADBack
|
||||||
)
|
)
|
||||||
|
checkAdjustedClone
|
||||||
createInodeSentinalFile False
|
createInodeSentinalFile False
|
||||||
|
|
||||||
uninitialize :: Annex ()
|
uninitialize :: Annex ()
|
||||||
|
|
|
@ -351,8 +351,6 @@ into adjusted view worktrees.]
|
||||||
will make copies of the content of annexed files, so this would need
|
will make copies of the content of annexed files, so this would need
|
||||||
to checkout the adjusted branch some other way. Maybe generalize so this
|
to checkout the adjusted branch some other way. Maybe generalize so this
|
||||||
more efficient checkout is available as a git-annex command?
|
more efficient checkout is available as a git-annex command?
|
||||||
* Cloning a repo that has an adjusted branch checked out gets into an ugly
|
|
||||||
state.
|
|
||||||
* There are potentially races in code that assumes a branch like
|
* There are potentially races in code that assumes a branch like
|
||||||
master is not being changed by someone else. In particular,
|
master is not being changed by someone else. In particular,
|
||||||
propigateAdjustedCommits rebases the adjusted branch on top of master.
|
propigateAdjustedCommits rebases the adjusted branch on top of master.
|
||||||
|
|
Loading…
Reference in a new issue