mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-21 23:37:23 +03:00
More simplification
This commit is contained in:
parent
8226d60983
commit
e3843dbed7
@ -1085,16 +1085,17 @@ pushGitBranch srcConn branch repo (PushGitBranchOpts setRoot _syncMode) = Unlift
|
||||
--
|
||||
-- set up the cache dir
|
||||
pathToCachedRemote <- time "Git fetch" $ throwExceptTWith C.GitProtocolError $ pullRepo (writeToRead repo)
|
||||
throwEitherMWith C.GitProtocolError . withIsolatedRepo pathToCachedRemote $ \tempRemotePath -> do
|
||||
throwEitherMWith C.GitProtocolError . withIsolatedRepo pathToCachedRemote $ \isolatedRemotePath -> do
|
||||
-- Connect to codebase in the cached git repo so we can copy it over.
|
||||
withOpenOrCreateCodebaseConnection @m "push.cached" pathToCachedRemote $ \cachedRemoteConn -> do
|
||||
copyCodebase cachedRemoteConn tempRemotePath
|
||||
-- Copy our cached remote database cleanly into our isolated directory.
|
||||
copyCodebase cachedRemoteConn isolatedRemotePath
|
||||
-- Connect to the newly copied database which we know has been properly closed and
|
||||
-- nobody else could be using.
|
||||
withConnection @m "push.dest" tempRemotePath $ \destConn -> do
|
||||
withConnection @m "push.dest" isolatedRemotePath $ \destConn -> do
|
||||
flip runReaderT destConn $ Q.withSavepoint_ @(ReaderT _ m) "push" $ do
|
||||
throwExceptT $ doSync tempRemotePath srcConn destConn
|
||||
void $ push tempRemotePath repo
|
||||
throwExceptT $ doSync isolatedRemotePath srcConn destConn
|
||||
void $ push isolatedRemotePath repo
|
||||
where
|
||||
doSync :: FilePath -> Connection -> Connection -> ExceptT C.GitError (ReaderT Connection m) ()
|
||||
doSync remotePath srcConn destConn = do
|
||||
|
Loading…
Reference in New Issue
Block a user