summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex/AdjustedBranch.hs16
-rw-r--r--Annex/GitOverlay.hs5
-rw-r--r--Command/Adjust.hs4
-rw-r--r--Test.hs3
-rw-r--r--debian/changelog5
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
diff --git a/Test.hs b/Test.hs
index a98a3df3b..3bd627957 100644
--- a/Test.hs
+++ b/Test.hs
@@ -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