summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-26 18:11:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-26 19:33:26 -0400
commit1e95a0a8add800dda786e47e6afc6f4b2c2355db (patch)
tree462aca8140074ea41334f8ed7f00acfdc3ffe7b0 /Annex
parent8539e76037382622cc7c49bfd9aef2255c0a4125 (diff)
fix reversion in relative paths to local remotes of direct mode repos
52ad9a1528bc51f65411aca263def97615367943 broke support for local remotes from direct mode repos, because the relative path was taken to be from the gitdir, rather than from the work tree.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Direct/Fixup.hs31
1 files changed, 31 insertions, 0 deletions
diff --git a/Annex/Direct/Fixup.hs b/Annex/Direct/Fixup.hs
new file mode 100644
index 000000000..13485242a
--- /dev/null
+++ b/Annex/Direct/Fixup.hs
@@ -0,0 +1,31 @@
+{- git-annex direct mode guard fixup
+ -
+ - Copyright 2013 Joey Hess <joey@kitenet.net>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+module Annex.Direct.Fixup where
+
+import Git.Types
+import Git.Config
+import qualified Git.Construct as Construct
+import Utility.Path
+import Utility.SafeCommand
+
+{- Direct mode repos have core.bare=true, but are not really bare.
+ - Fix up the Repo to be a non-bare repo, and arrange for git commands
+ - run by git-annex to be passed parameters that override this setting. -}
+fixupDirect :: Repo -> IO Repo
+fixupDirect r@(Repo { location = l@(Local { gitdir = d, worktree = Nothing }) }) = do
+ let r' = r
+ { location = l { worktree = Just (parentDir d) }
+ , gitGlobalOpts = gitGlobalOpts r ++
+ [ Param "-c"
+ , Param $ coreBare ++ "=" ++ boolConfig False
+ ]
+ }
+ -- Recalc now that the worktree is correct.
+ rs' <- Construct.fromRemotes r'
+ return $ r' { remotes = rs' }
+fixupDirect r = return r