From 5e1d7bbc005c4fbd3244ea84834e02d0062c972b Mon Sep 17 00:00:00 2001
From: Joey Hess <joeyh@joeyh.name>
Date: Tue, 29 Mar 2016 12:05:02 -0400
Subject: [PATCH] limit git annex adjust to v6 mode

doesn't work in v5
---
 Annex/Version.hs  | 3 +++
 Command/Adjust.hs | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/Annex/Version.hs b/Annex/Version.hs
index f294f8cd3b..b5f038c0d0 100644
--- a/Annex/Version.hs
+++ b/Annex/Version.hs
@@ -52,6 +52,9 @@ versionSupportsUnlockedPointers = go <$> getVersion
 	go (Just "6") = True
 	go _ = False
 
+versionSupportsAdjustedBranch :: Annex Bool
+versionSupportsAdjustedBranch = versionSupportsUnlockedPointers
+
 setVersion :: Version -> Annex ()
 setVersion = setConfig versionField
 
diff --git a/Command/Adjust.hs b/Command/Adjust.hs
index 7646cfa576..2ea39edd24 100644
--- a/Command/Adjust.hs
+++ b/Command/Adjust.hs
@@ -9,6 +9,7 @@ module Command.Adjust where
 
 import Command
 import Annex.AdjustedBranch
+import Annex.Version
 
 cmd :: Command
 cmd = notBareRepo $ notDirect $
@@ -33,5 +34,7 @@ seek = commandAction . start
 
 start :: Adjustment -> CommandStart
 start adj = do
+	unlessM versionSupportsAdjustedBranch $
+		error "Adjusted branches are only supported in v6 or newer repositories."
 	enterAdjustedBranch adj
 	next $ next $ return True