adjusted branches need git 2.2.0 or newer
When git-annex is used with a git version older than 2.2.0, disable support for adjusted branches, since GIT_COMMON_DIR is needed to update them and was first added in that version of git.
This commit is contained in:
parent
a3465c6327
commit
0273cd5005
5 changed files with 28 additions and 5 deletions
|
@ -21,6 +21,8 @@ module Annex.AdjustedBranch (
|
||||||
updateAdjustedBranch,
|
updateAdjustedBranch,
|
||||||
propigateAdjustedCommits,
|
propigateAdjustedCommits,
|
||||||
checkAdjustedClone,
|
checkAdjustedClone,
|
||||||
|
isGitVersionSupported,
|
||||||
|
checkVersionSupported,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Annex.Common
|
import Annex.Common
|
||||||
|
@ -39,6 +41,8 @@ import Git.Env
|
||||||
import Git.Index
|
import Git.Index
|
||||||
import Git.FilePath
|
import Git.FilePath
|
||||||
import qualified Git.LockFile
|
import qualified Git.LockFile
|
||||||
|
import qualified Git.Version
|
||||||
|
import Annex.Version
|
||||||
import Annex.CatFile
|
import Annex.CatFile
|
||||||
import Annex.Link
|
import Annex.Link
|
||||||
import Annex.AutoMerge
|
import Annex.AutoMerge
|
||||||
|
@ -507,3 +511,15 @@ 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
|
||||||
|
|
||||||
|
-- git 2.2.0 needed for GIT_COMMON_DIR which is needed
|
||||||
|
-- by updateAdjustedBranch to use withWorkTreeRelated.
|
||||||
|
isGitVersionSupported :: IO Bool
|
||||||
|
isGitVersionSupported = not <$> Git.Version.older "2.2.0"
|
||||||
|
|
||||||
|
checkVersionSupported :: Annex ()
|
||||||
|
checkVersionSupported = do
|
||||||
|
unlessM versionSupportsAdjustedBranch $
|
||||||
|
error "Adjusted branches are only supported in v6 or newer repositories."
|
||||||
|
unlessM (liftIO isGitVersionSupported) $
|
||||||
|
error "Your version of git is too old; upgrade it to 2.2.0 or newer to use adjusted branches."
|
||||||
|
|
|
@ -40,7 +40,10 @@ withWorkTree d = withAltRepo
|
||||||
- files that are related to the work tree coming from an overlay
|
- files that are related to the work tree coming from an overlay
|
||||||
- directory other than the usual. This is done by pointing
|
- directory other than the usual. This is done by pointing
|
||||||
- GIT_COMMON_DIR at the regular git directory, and GIT_DIR at the
|
- GIT_COMMON_DIR at the regular git directory, and GIT_DIR at the
|
||||||
- overlay directory. -}
|
- overlay directory.
|
||||||
|
-
|
||||||
|
- Needs git 2.2.0 or newer.
|
||||||
|
-}
|
||||||
withWorkTreeRelated :: FilePath -> Annex a -> Annex a
|
withWorkTreeRelated :: FilePath -> Annex a -> Annex a
|
||||||
withWorkTreeRelated d = withAltRepo modrepo unmodrepo
|
withWorkTreeRelated d = withAltRepo modrepo unmodrepo
|
||||||
where
|
where
|
||||||
|
|
|
@ -9,7 +9,6 @@ module Command.Adjust where
|
||||||
|
|
||||||
import Command
|
import Command
|
||||||
import Annex.AdjustedBranch
|
import Annex.AdjustedBranch
|
||||||
import Annex.Version
|
|
||||||
|
|
||||||
cmd :: Command
|
cmd :: Command
|
||||||
cmd = notBareRepo $ notDirect $ noDaemonRunning $
|
cmd = notBareRepo $ notDirect $ noDaemonRunning $
|
||||||
|
@ -34,8 +33,7 @@ seek = commandAction . start
|
||||||
|
|
||||||
start :: Adjustment -> CommandStart
|
start :: Adjustment -> CommandStart
|
||||||
start adj = do
|
start adj = do
|
||||||
unlessM versionSupportsAdjustedBranch $
|
checkVersionSupported
|
||||||
error "Adjusted branches are only supported in v6 or newer repositories."
|
|
||||||
showStart "adjust" ""
|
showStart "adjust" ""
|
||||||
enterAdjustedBranch adj
|
enterAdjustedBranch adj
|
||||||
next $ next $ return True
|
next $ next $ return True
|
||||||
|
|
3
Test.hs
3
Test.hs
|
@ -72,6 +72,7 @@ import qualified Annex.Link
|
||||||
import qualified Annex.Init
|
import qualified Annex.Init
|
||||||
import qualified Annex.CatFile
|
import qualified Annex.CatFile
|
||||||
import qualified Annex.Path
|
import qualified Annex.Path
|
||||||
|
import qualified Annex.AdjustedBranch
|
||||||
import qualified Annex.View
|
import qualified Annex.View
|
||||||
import qualified Annex.View.ViewedFile
|
import qualified Annex.View.ViewedFile
|
||||||
import qualified Logs.View
|
import qualified Logs.View
|
||||||
|
@ -1048,7 +1049,7 @@ test_conflict_resolution =
|
||||||
|
|
||||||
{- Conflict resolution while in an adjusted branch. -}
|
{- Conflict resolution while in an adjusted branch. -}
|
||||||
test_conflict_resolution_adjusted_branch :: Assertion
|
test_conflict_resolution_adjusted_branch :: Assertion
|
||||||
test_conflict_resolution_adjusted_branch =
|
test_conflict_resolution_adjusted_branch = whenM Annex.AdjustedBranch.isGitVersionSupported $
|
||||||
withtmpclonerepo $ \r1 ->
|
withtmpclonerepo $ \r1 ->
|
||||||
withtmpclonerepo $ \r2 -> do
|
withtmpclonerepo $ \r2 -> do
|
||||||
indir r1 $ do
|
indir r1 $ do
|
||||||
|
|
5
debian/changelog
vendored
5
debian/changelog
vendored
|
@ -6,11 +6,16 @@ git-annex (6.20160419) UNRELEASED; urgency=medium
|
||||||
fixed to not hang when it cannot find locale files.
|
fixed to not hang when it cannot find locale files.
|
||||||
* reinject: When src file's content cannot be verified, leave it alone,
|
* reinject: When src file's content cannot be verified, leave it alone,
|
||||||
instead of deleting it.
|
instead of deleting it.
|
||||||
|
* reinject: Added new mode which can reinject known files into the annex.
|
||||||
|
For example: git-annex reinject --known /mnt/backup/*
|
||||||
* calckey: New plumbing command, calculates the key that would be used
|
* calckey: New plumbing command, calculates the key that would be used
|
||||||
to refer to a file.
|
to refer to a file.
|
||||||
* Fix bug that prevented annex.sshcaching=false configuration from taking
|
* Fix bug that prevented annex.sshcaching=false configuration from taking
|
||||||
effect when on a crippled filesystem. Thanks, divergentdave.
|
effect when on a crippled filesystem. Thanks, divergentdave.
|
||||||
* Isolate test suite from global git config settings.
|
* Isolate test suite from global git config settings.
|
||||||
|
* When git-annex is used with a git version older than 2.2.0, disable
|
||||||
|
support for adjusted branches, since GIT_COMMON_DIR is needed to update
|
||||||
|
them and was first added in that version of git.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Tue, 19 Apr 2016 12:57:15 -0400
|
-- Joey Hess <id@joeyh.name> Tue, 19 Apr 2016 12:57:15 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue