don't let git-annex direct be run in a v6 repo
This commit is contained in:
parent
ccc49861ca
commit
e7f75b079d
6 changed files with 26 additions and 6 deletions
|
@ -37,6 +37,12 @@ versionField = annexConfig "version"
|
||||||
getVersion :: Annex (Maybe Version)
|
getVersion :: Annex (Maybe Version)
|
||||||
getVersion = annexVersion <$> Annex.getGitConfig
|
getVersion = annexVersion <$> Annex.getGitConfig
|
||||||
|
|
||||||
|
versionSupportsDirectMode :: Annex Bool
|
||||||
|
versionSupportsDirectMode = go <$> getVersion
|
||||||
|
where
|
||||||
|
go (Just "6") = False
|
||||||
|
go _ = True
|
||||||
|
|
||||||
setVersion :: Version -> Annex ()
|
setVersion :: Version -> Annex ()
|
||||||
setVersion = setConfig versionField
|
setVersion = setConfig versionField
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import qualified Git.LsFiles
|
||||||
import qualified Git.Branch
|
import qualified Git.Branch
|
||||||
import Config
|
import Config
|
||||||
import Annex.Direct
|
import Annex.Direct
|
||||||
|
import Annex.Version
|
||||||
|
|
||||||
cmd :: Command
|
cmd :: Command
|
||||||
cmd = notBareRepo $ noDaemonRunning $
|
cmd = notBareRepo $ noDaemonRunning $
|
||||||
|
@ -24,7 +25,10 @@ seek :: CmdParams -> CommandSeek
|
||||||
seek = withNothing start
|
seek = withNothing start
|
||||||
|
|
||||||
start :: CommandStart
|
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 :: CommandPerform
|
||||||
perform = do
|
perform = do
|
||||||
|
|
|
@ -9,6 +9,13 @@ understand how to update its working tree.
|
||||||
|
|
||||||
[[!toc]]
|
[[!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
|
## enabling (and disabling) direct mode
|
||||||
|
|
||||||
Normally, git-annex repositories start off in indirect mode. With some
|
Normally, git-annex repositories start off in indirect mode. With some
|
||||||
|
|
|
@ -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
|
run in direct mode repositories. Use `git annex proxy` to safely run such
|
||||||
commands.
|
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
|
# SEE ALSO
|
||||||
|
|
||||||
[[git-annex]](1)
|
[[git-annex]](1)
|
||||||
|
|
||||||
[[git-annex-indirect]](1)
|
[[git-annex-indirect]](1)
|
||||||
|
|
||||||
|
[[git-annex-unlock]](1)
|
||||||
|
|
||||||
# AUTHOR
|
# AUTHOR
|
||||||
|
|
||||||
Joey Hess <id@joeyh.name>
|
Joey Hess <id@joeyh.name>
|
||||||
|
|
|
@ -11,9 +11,8 @@ git annex indirect
|
||||||
Switches a repository back from direct mode to the default, indirect
|
Switches a repository back from direct mode to the default, indirect
|
||||||
mode.
|
mode.
|
||||||
|
|
||||||
Some systems cannot support git-annex in indirect mode, because they
|
Note that the direct mode/indirect mode distinction is removed in v6
|
||||||
do not support symbolic links. Repositories on such systems instead
|
git-annex repositories.
|
||||||
default to using direct mode.
|
|
||||||
|
|
||||||
# SEE ALSO
|
# SEE ALSO
|
||||||
|
|
||||||
|
|
|
@ -306,8 +306,6 @@ just look at the repo content in the first place..
|
||||||
|
|
||||||
annex.version changes to 6
|
annex.version changes to 6
|
||||||
|
|
||||||
Upgrade should be handled automatically.
|
|
||||||
|
|
||||||
On upgrade, update $GIT_DIR/info/attributes with a stock configuration,
|
On upgrade, update $GIT_DIR/info/attributes with a stock configuration,
|
||||||
unless it already mentions "filter=annex".
|
unless it already mentions "filter=annex".
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue