summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-03-29 13:52:13 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-03-29 13:54:42 -0400
commitd3eac61d33603ef2896be9e4b20217e63505a4d6 (patch)
treeb97d6480e05ee7d4dc22ea595d1309d227ac5729
parent2c2a41bce93797f348604fd11fdbd77fe12eaa9c (diff)
init: Automatically enter the adjusted unlocked branch when in a v6 repo on a filesystem not supporting symlinks.
-rw-r--r--Annex/AdjustedBranch.hs13
-rw-r--r--Annex/Init.hs12
-rw-r--r--Command/Adjust.hs1
-rw-r--r--debian/changelog2
-rw-r--r--doc/todo/smudge.mdwn6
5 files changed, 24 insertions, 10 deletions
diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs
index b2ca7dbf6..8b4712db1 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 7501d9b8f..99f8ece2c 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 2ea39edd2..3f3fd0d82 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 62caa20d1..f8cd5020c 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 c615f8f14..a80869dc0 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.