init: Automatically enter the adjusted unlocked branch when in a v6 repo on a filesystem not supporting symlinks.

This commit is contained in:
Joey Hess 2016-03-29 13:52:13 -04:00
parent bcd2350fc7
commit 8a69298bf2
Failed to extract signature
5 changed files with 24 additions and 10 deletions

View file

@ -14,6 +14,7 @@ module Annex.AdjustedBranch (
fromAdjustedBranch, fromAdjustedBranch,
getAdjustment, getAdjustment,
enterAdjustedBranch, enterAdjustedBranch,
adjustToCrippledFileSystem,
updateAdjustedBranch, updateAdjustedBranch,
propigateAdjustedCommits, propigateAdjustedCommits,
) where ) where
@ -151,6 +152,18 @@ enterAdjustedBranch adj = go =<< originalBranch
] ]
go Nothing = error "not on any branch!" go Nothing = error "not on any branch!"
adjustToCrippledFileSystem :: Annex ()
adjustToCrippledFileSystem = do
warning "Entering an adjusted branch where files are unlocked as this filesystem does not support locked files."
whenM (isNothing <$> originalBranch) $
void $ inRepo $ Git.Branch.commitCommand Git.Branch.AutomaticCommit
[ Param "--quiet"
, Param "--allow-empty"
, Param "-m"
, Param "commit before entering adjusted unlocked branch"
]
enterAdjustedBranch UnlockAdjustment
adjustBranch :: Adjustment -> OrigBranch -> Annex AdjBranch adjustBranch :: Adjustment -> OrigBranch -> Annex AdjBranch
adjustBranch adj origbranch = do adjustBranch adj origbranch = do
sha <- adjust adj origbranch sha <- adjust adj origbranch

View file

@ -33,6 +33,7 @@ import Annex.UUID
import Annex.Link import Annex.Link
import Config import Config
import Annex.Direct import Annex.Direct
import Annex.AdjustedBranch
import Annex.Environment import Annex.Environment
import Annex.Hook import Annex.Hook
import Annex.InodeSentinal import Annex.InodeSentinal
@ -92,10 +93,13 @@ initialize' mversion = do
whenM versionSupportsUnlockedPointers $ do whenM versionSupportsUnlockedPointers $ do
configureSmudgeFilter configureSmudgeFilter
Database.Keys.scanAssociatedFiles Database.Keys.scanAssociatedFiles
ifM (crippledFileSystem <&&> (not <$> isBare) <&&> (not <$> versionSupportsUnlockedPointers)) ifM (crippledFileSystem <&&> (not <$> isBare))
( do ( ifM versionSupportsUnlockedPointers
( adjustToCrippledFileSystem
, do
enableDirectMode enableDirectMode
setDirect True setDirect True
)
-- Handle case where this repo was cloned from a -- Handle case where this repo was cloned from a
-- direct mode repo -- direct mode repo
, unlessM isBare , unlessM isBare

View file

@ -36,5 +36,6 @@ start :: Adjustment -> CommandStart
start adj = do start adj = do
unlessM versionSupportsAdjustedBranch $ unlessM versionSupportsAdjustedBranch $
error "Adjusted branches are only supported in v6 or newer repositories." error "Adjusted branches are only supported in v6 or newer repositories."
showStart "adjust" ""
enterAdjustedBranch adj enterAdjustedBranch adj
next $ next $ return True next $ next $ return True

2
debian/changelog vendored
View file

@ -2,6 +2,8 @@ git-annex (6.20160319) UNRELEASED; urgency=medium
* adjust --unlock: Enters an adjusted branch in which all annexed files * adjust --unlock: Enters an adjusted branch in which all annexed files
are unlocked. The v6 equivilant of direct mode, but much cleaner! are unlocked. The v6 equivilant of direct mode, but much cleaner!
* init --version=6: Automatically enter the adjusted unlocked branch
when filesystem doesn't support symlinks.
* ddar remote: fix ssh calls * ddar remote: fix ssh calls
Thanks, Robie Basak Thanks, Robie Basak

View file

@ -23,12 +23,6 @@ git-annex should use smudge/clean filters.
(May need to use libgit2 to do this efficiently, cannot find (May need to use libgit2 to do this efficiently, cannot find
any plumbing except git-update-index, which is very inneficient for any plumbing except git-update-index, which is very inneficient for
smudged files.) smudged files.)
* Crippled filesystem should cause all files to be transparently unlocked.
Note that this presents problems when dealing with merge conflicts and
when pushing changes committed in such a repo. Ideally, should avoid
committing implicit unlocks, or should prevent such commits leaking out
in pushes. See [[design/adjusted_branches]].
* Eventually (but not yet), make v6 the default for new repositories. * Eventually (but not yet), make v6 the default for new repositories.
Note that the assistant forces repos into direct mode; that will need to Note that the assistant forces repos into direct mode; that will need to
be changed then, and it should enable annex.thin instead. be changed then, and it should enable annex.thin instead.