diff options
author | 2016-04-22 12:29:32 -0400 | |
---|---|---|
committer | 2016-04-22 12:29:32 -0400 | |
commit | 8ac4cd6904ca80a6d115f3ce2ade66495a77a45f (patch) | |
tree | 88610a8e4c8b5f71568f230d8e6303bc389c4a5e | |
parent | e896c249fa876cbf6f281ce9e934bde6cb92e345 (diff) |
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.
-rw-r--r-- | Annex/AdjustedBranch.hs | 16 | ||||
-rw-r--r-- | Annex/GitOverlay.hs | 5 | ||||
-rw-r--r-- | Command/Adjust.hs | 4 | ||||
-rw-r--r-- | Test.hs | 3 | ||||
-rw-r--r-- | debian/changelog | 5 |
5 files changed, 28 insertions, 5 deletions
diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs index e9e6ab461..26a24d8e6 100644 --- a/Annex/AdjustedBranch.hs +++ b/Annex/AdjustedBranch.hs @@ -21,6 +21,8 @@ module Annex.AdjustedBranch ( updateAdjustedBranch, propigateAdjustedCommits, checkAdjustedClone, + isGitVersionSupported, + checkVersionSupported, ) where import Annex.Common @@ -39,6 +41,8 @@ import Git.Env import Git.Index import Git.FilePath import qualified Git.LockFile +import qualified Git.Version +import Annex.Version import Annex.CatFile import Annex.Link import Annex.AutoMerge @@ -507,3 +511,15 @@ checkAdjustedClone = go =<< inRepo Git.Branch.current setBasisBranch basis remotebranch unlessM (inRepo $ Git.Ref.exists origbranch) $ 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." diff --git a/Annex/GitOverlay.hs b/Annex/GitOverlay.hs index 7e18d225b..e33d8a83c 100644 --- a/Annex/GitOverlay.hs +++ b/Annex/GitOverlay.hs @@ -40,7 +40,10 @@ withWorkTree d = withAltRepo - files that are related to the work tree coming from an overlay - directory other than the usual. This is done by pointing - 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 d = withAltRepo modrepo unmodrepo where diff --git a/Command/Adjust.hs b/Command/Adjust.hs index e2850a361..addc652db 100644 --- a/Command/Adjust.hs +++ b/Command/Adjust.hs @@ -9,7 +9,6 @@ module Command.Adjust where import Command import Annex.AdjustedBranch -import Annex.Version cmd :: Command cmd = notBareRepo $ notDirect $ noDaemonRunning $ @@ -34,8 +33,7 @@ seek = commandAction . start start :: Adjustment -> CommandStart start adj = do - unlessM versionSupportsAdjustedBranch $ - error "Adjusted branches are only supported in v6 or newer repositories." + checkVersionSupported showStart "adjust" "" enterAdjustedBranch adj next $ next $ return True @@ -72,6 +72,7 @@ import qualified Annex.Link import qualified Annex.Init import qualified Annex.CatFile import qualified Annex.Path +import qualified Annex.AdjustedBranch import qualified Annex.View import qualified Annex.View.ViewedFile import qualified Logs.View @@ -1048,7 +1049,7 @@ test_conflict_resolution = {- Conflict resolution while in an adjusted branch. -} test_conflict_resolution_adjusted_branch :: Assertion -test_conflict_resolution_adjusted_branch = +test_conflict_resolution_adjusted_branch = whenM Annex.AdjustedBranch.isGitVersionSupported $ withtmpclonerepo $ \r1 -> withtmpclonerepo $ \r2 -> do indir r1 $ do diff --git a/debian/changelog b/debian/changelog index 7dc48edee..accb890b3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,11 +6,16 @@ git-annex (6.20160419) UNRELEASED; urgency=medium fixed to not hang when it cannot find locale files. * reinject: When src file's content cannot be verified, leave it alone, 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 to refer to a file. * Fix bug that prevented annex.sshcaching=false configuration from taking effect when on a crippled filesystem. Thanks, divergentdave. * 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 |