summaryrefslogtreecommitdiff
path: root/Annex/AdjustedBranch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-06-02 15:34:30 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-06-02 15:34:30 -0400
commitfc4fa86f301980f8e4ccd77a5ddf7d81e7560d17 (patch)
treeecd56ccc689c57213de04f105c079f20941f8255 /Annex/AdjustedBranch.hs
parent07f0f11f3cd8c8b52b2fe1324d5319613b5e2e79 (diff)
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.
Diffstat (limited to 'Annex/AdjustedBranch.hs')
-rw-r--r--Annex/AdjustedBranch.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs
index 4c127f97a..2d2a98531 100644
--- a/Annex/AdjustedBranch.hs
+++ b/Annex/AdjustedBranch.hs
@@ -542,13 +542,17 @@ diffTreeToTreeItem dti = TreeItem
{- 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, nor will the basis.
- - Create them. -}
-checkAdjustedClone :: Annex ()
+ - Create them.
+ -
+ - 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
where
- go Nothing = return ()
+ go Nothing = return False
go (Just currbranch) = case adjustedToOriginal currbranch of
- Nothing -> return ()
+ Nothing -> return False
Just (adj, origbranch) -> do
let remotebranch = Git.Ref.underBase "refs/remotes/origin" origbranch
let basis@(BasisBranch bb) = basisBranch (originalToAdjusted origbranch adj)
@@ -556,6 +560,7 @@ checkAdjustedClone = go =<< inRepo Git.Branch.current
setBasisBranch basis remotebranch
unlessM (inRepo $ Git.Ref.exists origbranch) $
inRepo $ Git.Branch.update' origbranch remotebranch
+ not <$> versionSupportsUnlockedPointers
-- git 2.2.0 needed for GIT_COMMON_DIR which is needed
-- by updateAdjustedBranch to use withWorkTreeRelated.