diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs index b2ca7dbf64..8b4712db10 100644 --- a/Annex/AdjustedBranch.hs +++ b/Annex/AdjustedBranch.hs @@ -14,6 +14,7 @@ module Annex.AdjustedBranch ( fromAdjustedBranch, getAdjustment, enterAdjustedBranch, + adjustToCrippledFileSystem, updateAdjustedBranch, propigateAdjustedCommits, ) where @@ -151,6 +152,18 @@ enterAdjustedBranch adj = go =<< originalBranch ] 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 adj origbranch = do sha <- adjust adj origbranch diff --git a/Annex/Init.hs b/Annex/Init.hs index 7501d9b8fe..99f8ece2c2 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -33,6 +33,7 @@ import Annex.UUID import Annex.Link import Config import Annex.Direct +import Annex.AdjustedBranch import Annex.Environment import Annex.Hook import Annex.InodeSentinal @@ -92,10 +93,13 @@ initialize' mversion = do whenM versionSupportsUnlockedPointers $ do configureSmudgeFilter Database.Keys.scanAssociatedFiles - ifM (crippledFileSystem <&&> (not <$> isBare) <&&> (not <$> versionSupportsUnlockedPointers)) - ( do - enableDirectMode - setDirect True + ifM (crippledFileSystem <&&> (not <$> isBare)) + ( ifM versionSupportsUnlockedPointers + ( adjustToCrippledFileSystem + , do + enableDirectMode + setDirect True + ) -- Handle case where this repo was cloned from a -- direct mode repo , unlessM isBare diff --git a/Command/Adjust.hs b/Command/Adjust.hs index 2ea39edd24..3f3fd0d825 100644 --- a/Command/Adjust.hs +++ b/Command/Adjust.hs @@ -36,5 +36,6 @@ start :: Adjustment -> CommandStart start adj = do unlessM versionSupportsAdjustedBranch $ error "Adjusted branches are only supported in v6 or newer repositories." + showStart "adjust" "" enterAdjustedBranch adj next $ next $ return True diff --git a/debian/changelog b/debian/changelog index 62caa20d14..f8cd5020c2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ git-annex (6.20160319) UNRELEASED; urgency=medium * adjust --unlock: Enters an adjusted branch in which all annexed files 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 Thanks, Robie Basak diff --git a/doc/todo/smudge.mdwn b/doc/todo/smudge.mdwn index c615f8f140..a80869dc0f 100644 --- a/doc/todo/smudge.mdwn +++ b/doc/todo/smudge.mdwn @@ -23,12 +23,6 @@ git-annex should use smudge/clean filters. (May need to use libgit2 to do this efficiently, cannot find any plumbing except git-update-index, which is very inneficient for 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. Note that the assistant forces repos into direct mode; that will need to be changed then, and it should enable annex.thin instead.