don't let git-annex direct be run in a v6 repo
authorJoey Hess <joeyh@joeyh.name>
Fri, 4 Dec 2015 20:29:27 +0000 (16:29 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 4 Dec 2015 20:33:09 +0000 (16:33 -0400)
Annex/Version.hs
Command/Direct.hs
doc/direct_mode.mdwn
doc/git-annex-direct.mdwn
doc/git-annex-indirect.mdwn
doc/todo/smudge.mdwn

index e1983fc67a2463b11ac52a161e02621cfd45b032..f9b24d9c499533c13f4613bba490a83b22edd17c 100644 (file)
@@ -37,6 +37,12 @@ versionField = annexConfig "version"
 getVersion :: Annex (Maybe Version)
 getVersion = annexVersion <$> Annex.getGitConfig
 
+versionSupportsDirectMode :: Annex Bool
+versionSupportsDirectMode = go <$> getVersion
+  where
+       go (Just "6") = False
+       go _ = True
+
 setVersion :: Version -> Annex ()
 setVersion = setConfig versionField
 
index 162780dd5cd1d9321b5abcd8f1a546c9e94a68b3..9cfd258ebdd7cedbde5d4b200e9ae62fe2920300 100644 (file)
@@ -14,6 +14,7 @@ import qualified Git.LsFiles
 import qualified Git.Branch
 import Config
 import Annex.Direct
+import Annex.Version
 
 cmd :: Command
 cmd = notBareRepo $ noDaemonRunning $
@@ -24,7 +25,10 @@ seek :: CmdParams -> CommandSeek
 seek = withNothing start
 
 start :: CommandStart
-start = ifM isDirect ( stop , next perform )
+start = ifM versionSupportsDirectMode
+       ( ifM isDirect ( stop , next perform )
+       , error "Direct mode is not suppported by this repository version. Use git-annex unlock instead."
+       )
 
 perform :: CommandPerform
 perform = do
index 4c2cb2dd7c41e0e0b9a2147e41dc1a9832d02540..d3e1067f9acc367eebf1547854c47242ad053f28 100644 (file)
@@ -9,6 +9,13 @@ understand how to update its working tree.
 
 [[!toc]]
 
+## deprecated
+
+Direct mode is deprecated! Intead, git-annex v6 repositories can simply
+have files that are unlocked and thus can be directly accessed and
+modified. See [[upgrades]] for details about the transition to v6
+repositories.
+
 ## enabling (and disabling) direct mode
 
 Normally, git-annex repositories start off in indirect mode. With some
index 457ae31162eb4a2bd1cefa7138d55e307fcc751c..3cade1a8c9e96465778e71d4652401771bbf3ad3 100644 (file)
@@ -17,12 +17,18 @@ Note that git commands that operate on the work tree will refuse to
 run in direct mode repositories. Use `git annex proxy` to safely run such
 commands.
 
+Note that the direct mode/indirect mode distinction is removed in v6
+git-annex repositories. In such a repository, you can
+use [[git-annex-unlock]](1) to make a file's content be directly present.
+
 # SEE ALSO
 
 [[git-annex]](1)
 
 [[git-annex-indirect]](1)
 
+[[git-annex-unlock]](1)
+
 # AUTHOR
 
 Joey Hess <id@joeyh.name>
index 99def614483543ee43d2314f15dff2b1f6b4bcf2..321e0fb369953371995812e1376155f87e06e8da 100644 (file)
@@ -11,9 +11,8 @@ git annex indirect
 Switches a repository back from direct mode to the default, indirect
 mode.
 
-Some systems cannot support git-annex in indirect mode, because they
-do not support symbolic links. Repositories on such systems instead
-default to using direct mode.
+Note that the direct mode/indirect mode distinction is removed in v6
+git-annex repositories.
 
 # SEE ALSO
 
index 6e6af6f65b15726fc7d60aafb81a8465c6e856e8..7a232123a6005e336ee4bf8e81ded2d8a46cbafa 100644 (file)
@@ -306,8 +306,6 @@ just look at the repo content in the first place..
 
 annex.version changes to 6
 
-Upgrade should be handled automatically.
-
 On upgrade, update $GIT_DIR/info/attributes with a stock configuration,
 unless it already mentions "filter=annex".