summaryrefslogtreecommitdiff
path: root/RemoteDaemon
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-06-02 16:34:52 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-06-02 16:34:52 -0400
commit0ff2732d9583fd70d75cd8e365587803a7ac75ed (patch)
tree8dde2949bfd29ea6adcf2a40f992fe6970872ebd /RemoteDaemon
parentb986b85cec119403c1a62fc268e26ff948de9fca (diff)
make LocalRepo a newtype
Diffstat (limited to 'RemoteDaemon')
-rw-r--r--RemoteDaemon/Common.hs2
-rw-r--r--RemoteDaemon/Core.hs6
-rw-r--r--RemoteDaemon/Transport/GCrypt.hs2
-rw-r--r--RemoteDaemon/Transport/Ssh.hs4
-rw-r--r--RemoteDaemon/Types.hs2
5 files changed, 8 insertions, 8 deletions
diff --git a/RemoteDaemon/Common.hs b/RemoteDaemon/Common.hs
index 9efc0c4a0..982a84b43 100644
--- a/RemoteDaemon/Common.hs
+++ b/RemoteDaemon/Common.hs
@@ -30,7 +30,7 @@ liftAnnex (TransportHandle _ annexstate) a = do
return r
inLocalRepo :: TransportHandle -> (Git.Repo -> IO a) -> IO a
-inLocalRepo (TransportHandle g _) a = a g
+inLocalRepo (TransportHandle (LocalRepo g) _) a = a g
-- Check if any of the shas are actally new in the local git repo,
-- to avoid unnecessary fetching.
diff --git a/RemoteDaemon/Core.hs b/RemoteDaemon/Core.hs
index e74da889b..5fa413155 100644
--- a/RemoteDaemon/Core.hs
+++ b/RemoteDaemon/Core.hs
@@ -111,7 +111,7 @@ runController ichan ochan = do
-- Generates a map with a transport for each supported remote in the git repo,
-- except those that have annex.sync = false
genRemoteMap :: TransportHandle -> TChan Emitted -> IO RemoteMap
-genRemoteMap h@(TransportHandle g _) ochan =
+genRemoteMap h@(TransportHandle (LocalRepo g) _) ochan =
M.fromList . catMaybes <$> mapM gen (Git.remotes g)
where
gen r = case Git.location r of
@@ -132,11 +132,11 @@ genTransportHandle :: IO TransportHandle
genTransportHandle = do
annexstate <- newMVar =<< Annex.new =<< Git.CurrentRepo.get
g <- Annex.repo <$> readMVar annexstate
- return $ TransportHandle g annexstate
+ return $ TransportHandle (LocalRepo g) annexstate
updateTransportHandle :: TransportHandle -> IO TransportHandle
updateTransportHandle h@(TransportHandle _g annexstate) = do
g' <- liftAnnex h $ do
reloadConfig
Annex.fromRepo id
- return (TransportHandle g' annexstate)
+ return (TransportHandle (LocalRepo g') annexstate)
diff --git a/RemoteDaemon/Transport/GCrypt.hs b/RemoteDaemon/Transport/GCrypt.hs
index 48b9da179..ec71b1842 100644
--- a/RemoteDaemon/Transport/GCrypt.hs
+++ b/RemoteDaemon/Transport/GCrypt.hs
@@ -16,7 +16,7 @@ import Remote.Helper.Ssh
import Remote.GCrypt (accessShellConfig)
transport :: Transport
-transport rr@(RemoteRepo r gc) url h@(TransportHandle g _) ichan ochan
+transport rr@(RemoteRepo r gc) url h@(TransportHandle (LocalRepo g) _) ichan ochan
| accessShellConfig gc = do
r' <- encryptedRemote g r
v <- liftAnnex h $ git_annex_shell r' "notifychanges" [] []
diff --git a/RemoteDaemon/Transport/Ssh.hs b/RemoteDaemon/Transport/Ssh.hs
index eda6bca1c..73c88054c 100644
--- a/RemoteDaemon/Transport/Ssh.hs
+++ b/RemoteDaemon/Transport/Ssh.hs
@@ -29,10 +29,10 @@ transport rr@(RemoteRepo r _) url h ichan ochan = do
Just (cmd, params) -> transportUsingCmd cmd params rr url h ichan ochan
transportUsingCmd :: FilePath -> [CommandParam] -> Transport
-transportUsingCmd cmd params rr@(RemoteRepo r gc) url h@(TransportHandle g s) ichan ochan = do
+transportUsingCmd cmd params rr@(RemoteRepo r gc) url h@(TransportHandle (LocalRepo g) s) ichan ochan = do
-- enable ssh connection caching wherever inLocalRepo is called
g' <- liftAnnex h $ sshOptionsTo r gc g
- let transporthandle = TransportHandle g' s
+ let transporthandle = TransportHandle (LocalRepo g') s
transportUsingCmd' cmd params rr url transporthandle ichan ochan
transportUsingCmd' :: FilePath -> [CommandParam] -> Transport
diff --git a/RemoteDaemon/Types.hs b/RemoteDaemon/Types.hs
index 5fd074a1e..f85219ea5 100644
--- a/RemoteDaemon/Types.hs
+++ b/RemoteDaemon/Types.hs
@@ -29,7 +29,7 @@ newtype RemoteURI = RemoteURI URI
type Transport = RemoteRepo -> RemoteURI -> TransportHandle -> TChan Consumed -> TChan Emitted -> IO ()
data RemoteRepo = RemoteRepo Git.Repo RemoteGitConfig
-type LocalRepo = Git.Repo
+newtype LocalRepo = LocalRepo Git.Repo
-- All Transports share a single AnnexState MVar
--