Automatically enable v6 mode when initializing in a clone from a repo that has an adjusted branch checked out.
The clone also has the adjusted branch checked out, so it needs to be initialized to a version that supports that.
This commit is contained in:
parent
02a20288ef
commit
72f0d3d384
3 changed files with 13 additions and 5 deletions
|
@ -542,13 +542,17 @@ diffTreeToTreeItem dti = TreeItem
|
||||||
{- Cloning a repository that has an adjusted branch checked out will
|
{- Cloning a repository that has an adjusted branch checked out will
|
||||||
- result in the clone having the same adjusted branch checked out -- but
|
- result in the clone having the same adjusted branch checked out -- but
|
||||||
- the origbranch won't exist in the clone, nor will the basis.
|
- the origbranch won't exist in the clone, nor will the basis.
|
||||||
- Create them. -}
|
- Create them.
|
||||||
checkAdjustedClone :: Annex ()
|
-
|
||||||
|
- The repository may also need to be upgraded to a new version, if the
|
||||||
|
- current version is too old to support adjusted branches. Returns True
|
||||||
|
- when this is the case. -}
|
||||||
|
checkAdjustedClone :: Annex Bool
|
||||||
checkAdjustedClone = go =<< inRepo Git.Branch.current
|
checkAdjustedClone = go =<< inRepo Git.Branch.current
|
||||||
where
|
where
|
||||||
go Nothing = return ()
|
go Nothing = return False
|
||||||
go (Just currbranch) = case adjustedToOriginal currbranch of
|
go (Just currbranch) = case adjustedToOriginal currbranch of
|
||||||
Nothing -> return ()
|
Nothing -> return False
|
||||||
Just (adj, origbranch) -> do
|
Just (adj, origbranch) -> do
|
||||||
let remotebranch = Git.Ref.underBase "refs/remotes/origin" origbranch
|
let remotebranch = Git.Ref.underBase "refs/remotes/origin" origbranch
|
||||||
let basis@(BasisBranch bb) = basisBranch (originalToAdjusted origbranch adj)
|
let basis@(BasisBranch bb) = basisBranch (originalToAdjusted origbranch adj)
|
||||||
|
@ -556,6 +560,7 @@ checkAdjustedClone = go =<< inRepo Git.Branch.current
|
||||||
setBasisBranch basis remotebranch
|
setBasisBranch basis remotebranch
|
||||||
unlessM (inRepo $ Git.Ref.exists origbranch) $
|
unlessM (inRepo $ Git.Ref.exists origbranch) $
|
||||||
inRepo $ Git.Branch.update' origbranch remotebranch
|
inRepo $ Git.Branch.update' origbranch remotebranch
|
||||||
|
not <$> versionSupportsUnlockedPointers
|
||||||
|
|
||||||
-- git 2.2.0 needed for GIT_COMMON_DIR which is needed
|
-- git 2.2.0 needed for GIT_COMMON_DIR which is needed
|
||||||
-- by updateAdjustedBranch to use withWorkTreeRelated.
|
-- by updateAdjustedBranch to use withWorkTreeRelated.
|
||||||
|
|
|
@ -105,7 +105,8 @@ initialize' mversion = do
|
||||||
, unlessM isBare
|
, unlessM isBare
|
||||||
switchHEADBack
|
switchHEADBack
|
||||||
)
|
)
|
||||||
checkAdjustedClone
|
whenM checkAdjustedClone $
|
||||||
|
void $ upgrade True
|
||||||
createInodeSentinalFile False
|
createInodeSentinalFile False
|
||||||
|
|
||||||
uninitialize :: Annex ()
|
uninitialize :: Annex ()
|
||||||
|
|
|
@ -11,6 +11,8 @@ git-annex (6.20160528) UNRELEASED; urgency=medium
|
||||||
* Pass -S to git commit-tree when commit.gpgsign is set and when
|
* Pass -S to git commit-tree when commit.gpgsign is set and when
|
||||||
making a non-automatic commit, in order to preserve current behavior
|
making a non-automatic commit, in order to preserve current behavior
|
||||||
when used with git 1.9, which has stopped doing this itself.
|
when used with git 1.9, which has stopped doing this itself.
|
||||||
|
* Automatically enable v6 mode when initializing in a clone from a repo
|
||||||
|
that has an adjusted branch checked out.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 27 May 2016 13:12:48 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 27 May 2016 13:12:48 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue