don't let git-annex direct be run in a v6 repo

This commit is contained in:
Joey Hess 2015-12-04 16:29:27 -04:00
parent ccc49861ca
commit e7f75b079d
Failed to extract signature
6 changed files with 26 additions and 6 deletions

View 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

View 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

View 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

View 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>

View 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

View 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".