summaryrefslogtreecommitdiff
path: root/Annex/Direct.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-03-02 16:43:44 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-03-02 16:43:44 -0400
commit9b4db1bab69b678a13a1d0d2ca74a48626364c93 (patch)
treecab518e0c5b6575509fc36ebb23ff686cb3007f2 /Annex/Direct.hs
parent8f4da219cd9989092afa6a8873421894a6f73eb4 (diff)
Submodules are now supported by git-annex!
Seems to work, but still experimental until it's been tested more. When repositories are on filesystems not supporting symlinks, the .git dir symlink trick cannot be used. Since we're going to be in direct mode anyway, the .git dir symlink is not strictly needed. However, I have not fixed the code that creates new annex symlinks to handle this case -- the committed symlinks will be wrong. git annex sync happens to currently fail in a submodule using direct mode, because there's no HEAD ref. That also needs to be dealt with to get this fully working in crippled filesystems. Leaving http://github.com/datalad/datalad/issues/44 open until these issues are dealt with.
Diffstat (limited to 'Annex/Direct.hs')
-rw-r--r--Annex/Direct.hs20
1 files changed, 19 insertions, 1 deletions
diff --git a/Annex/Direct.hs b/Annex/Direct.hs
index 1c733cb55..bb470e04c 100644
--- a/Annex/Direct.hs
+++ b/Annex/Direct.hs
@@ -406,7 +406,25 @@ setDirect wantdirect = do
Annex.changeGitConfig $ \c -> c { annexDirect = wantdirect }
where
val = Git.Config.boolConfig wantdirect
- setbare = setConfig (ConfigKey Git.Config.coreBare) val
+ coreworktree = ConfigKey "core.worktree"
+ indirectworktree = ConfigKey "core.indirect-worktree"
+ setbare = do
+ -- core.worktree is not compatable with
+ -- core.bare; git does not allow both to be set, so
+ -- unset it when enabling direct mode, caching in
+ -- core.indirect-worktree
+ if wantdirect
+ then moveconfig coreworktree indirectworktree
+ else moveconfig indirectworktree coreworktree
+ setConfig (ConfigKey Git.Config.coreBare) val
+ moveconfig src dest = do
+ v <- getConfigMaybe src
+ case v of
+ Nothing -> noop
+ Just wt -> do
+ unsetConfig src
+ setConfig dest wt
+ reloadConfig
{- Since direct mode sets core.bare=true, incoming pushes could change
- the currently checked out branch. To avoid this problem, HEAD