assistant: Pass ssh-options through 3 more git pull/push calls that were missed before.
It was used for regular pull, but not for regular push, tagged push, or the fallback fetching.
This commit is contained in:
parent
4cc95f3fd3
commit
7c741302cc
5 changed files with 34 additions and 12 deletions
11
Annex/Ssh.hs
11
Annex/Ssh.hs
|
@ -263,9 +263,10 @@ inRepoWithSshOptionsTo remote gc a =
|
||||||
|
|
||||||
{- To make any git commands be run with ssh caching enabled,
|
{- To make any git commands be run with ssh caching enabled,
|
||||||
- and configured ssh-options alters the local Git.Repo's gitEnv
|
- and configured ssh-options alters the local Git.Repo's gitEnv
|
||||||
- to set GIT_SSH=git-annex, and sets sshOptionsEnv. -}
|
- to set GIT_SSH=git-annex, and set sshOptionsEnv when running git
|
||||||
|
- commands. -}
|
||||||
sshOptionsTo :: Git.Repo -> RemoteGitConfig -> Git.Repo -> Annex Git.Repo
|
sshOptionsTo :: Git.Repo -> RemoteGitConfig -> Git.Repo -> Annex Git.Repo
|
||||||
sshOptionsTo remote gc g
|
sshOptionsTo remote gc localr
|
||||||
| not (Git.repoIsUrl remote) || Git.repoIsHttp remote = unchanged
|
| not (Git.repoIsUrl remote) || Git.repoIsHttp remote = unchanged
|
||||||
| otherwise = case Git.Url.hostuser remote of
|
| otherwise = case Git.Url.hostuser remote of
|
||||||
Nothing -> unchanged
|
Nothing -> unchanged
|
||||||
|
@ -277,7 +278,7 @@ sshOptionsTo remote gc g
|
||||||
prepSocket sockfile
|
prepSocket sockfile
|
||||||
use (sshConnectionCachingParams sockfile)
|
use (sshConnectionCachingParams sockfile)
|
||||||
where
|
where
|
||||||
unchanged = return g
|
unchanged = return localr
|
||||||
|
|
||||||
use opts = do
|
use opts = do
|
||||||
let sshopts = concat
|
let sshopts = concat
|
||||||
|
@ -289,9 +290,9 @@ sshOptionsTo remote gc g
|
||||||
else do
|
else do
|
||||||
command <- liftIO programPath
|
command <- liftIO programPath
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
g' <- addGitEnv g sshOptionsEnv
|
localr' <- addGitEnv localr sshOptionsEnv
|
||||||
(toSshOptionsEnv sshopts)
|
(toSshOptionsEnv sshopts)
|
||||||
addGitEnv g' "GIT_SSH" command
|
addGitEnv localr' "GIT_SSH" command
|
||||||
|
|
||||||
runSshOptions :: [String] -> String -> IO ()
|
runSshOptions :: [String] -> String -> IO ()
|
||||||
runSshOptions args s = do
|
runSshOptions args s = do
|
||||||
|
|
|
@ -28,6 +28,7 @@ import qualified Remote.List as Remote
|
||||||
import qualified Annex.Branch
|
import qualified Annex.Branch
|
||||||
import Annex.UUID
|
import Annex.UUID
|
||||||
import Annex.TaggedPush
|
import Annex.TaggedPush
|
||||||
|
import Annex.Ssh
|
||||||
import qualified Config
|
import qualified Config
|
||||||
import Git.Config
|
import Git.Config
|
||||||
import Assistant.NamedThread
|
import Assistant.NamedThread
|
||||||
|
@ -148,7 +149,7 @@ pushToRemotes' now notifypushes remotes = do
|
||||||
go _ _ _ _ [] = return [] -- no remotes, so nothing to do
|
go _ _ _ _ [] = return [] -- no remotes, so nothing to do
|
||||||
go shouldretry (Just branch) g u rs = do
|
go shouldretry (Just branch) g u rs = do
|
||||||
debug ["pushing to", show rs]
|
debug ["pushing to", show rs]
|
||||||
(succeeded, failed) <- liftIO $ inParallel (push g branch) rs
|
(succeeded, failed) <- parallelPush g rs (push branch)
|
||||||
updatemap succeeded []
|
updatemap succeeded []
|
||||||
if null failed
|
if null failed
|
||||||
then do
|
then do
|
||||||
|
@ -172,15 +173,24 @@ pushToRemotes' now notifypushes remotes = do
|
||||||
|
|
||||||
fallback branch g u rs = do
|
fallback branch g u rs = do
|
||||||
debug ["fallback pushing to", show rs]
|
debug ["fallback pushing to", show rs]
|
||||||
(succeeded, failed) <- liftIO $
|
(succeeded, failed) <- parallelPush g rs (taggedPush u Nothing branch)
|
||||||
inParallel (\r -> taggedPush u Nothing branch r g) rs
|
|
||||||
updatemap succeeded failed
|
updatemap succeeded failed
|
||||||
when (notifypushes && (not $ null succeeded)) $
|
when (notifypushes && (not $ null succeeded)) $
|
||||||
sendNetMessage $ NotifyPush $
|
sendNetMessage $ NotifyPush $
|
||||||
map Remote.uuid succeeded
|
map Remote.uuid succeeded
|
||||||
return failed
|
return failed
|
||||||
|
|
||||||
push g branch remote = Command.Sync.pushBranch remote branch g
|
push branch remote = Command.Sync.pushBranch remote branch
|
||||||
|
|
||||||
|
parallelPush :: Git.Repo -> [Remote] -> (Remote -> Git.Repo -> IO Bool)-> Assistant ([Remote], [Remote])
|
||||||
|
parallelPush g rs a = do
|
||||||
|
rgs <- liftAnnex $ mapM topush rs
|
||||||
|
(succeededrgs, failedrgs) <- liftIO $ inParallel (uncurry a) rgs
|
||||||
|
return (map fst succeededrgs, map fst failedrgs)
|
||||||
|
where
|
||||||
|
topush r = (,)
|
||||||
|
<$> pure r
|
||||||
|
<*> sshOptionsTo (Remote.repo r) (Remote.gitconfig r) g
|
||||||
|
|
||||||
{- Displays an alert while running an action that syncs with some remotes,
|
{- Displays an alert while running an action that syncs with some remotes,
|
||||||
- and returns any remotes that it failed to sync with.
|
- and returns any remotes that it failed to sync with.
|
||||||
|
@ -221,8 +231,9 @@ manualPull :: Maybe Git.Ref -> [Remote] -> Assistant ([Remote], Bool)
|
||||||
manualPull currentbranch remotes = do
|
manualPull currentbranch remotes = do
|
||||||
g <- liftAnnex gitRepo
|
g <- liftAnnex gitRepo
|
||||||
let (xmppremotes, normalremotes) = partition Remote.isXMPPRemote remotes
|
let (xmppremotes, normalremotes) = partition Remote.isXMPPRemote remotes
|
||||||
failed <- liftIO $ forM normalremotes $ \r ->
|
failed <- forM normalremotes $ \r -> do
|
||||||
ifM (Git.Command.runBool [Param "fetch", Param $ Remote.name r] g)
|
g' <- liftAnnex $ sshOptionsTo (Remote.repo r) (Remote.gitconfig r) g
|
||||||
|
ifM (liftIO $ Git.Command.runBool [Param "fetch", Param $ Remote.name r] g')
|
||||||
( return Nothing
|
( return Nothing
|
||||||
, return $ Just r
|
, return $ Just r
|
||||||
)
|
)
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -25,6 +25,8 @@ git-annex (5.20151102.2) UNRELEASED; urgency=medium
|
||||||
* fsck: When fscking a dead repo, avoid incorrect "fixing location log"
|
* fsck: When fscking a dead repo, avoid incorrect "fixing location log"
|
||||||
message, and display a message, since it's unusual to have access to a
|
message, and display a message, since it's unusual to have access to a
|
||||||
dead repo.
|
dead repo.
|
||||||
|
* assistant: Pass ssh-options through 3 more git pull/push calls
|
||||||
|
that were missed before.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 04 Nov 2015 12:50:20 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 04 Nov 2015 12:50:20 -0400
|
||||||
|
|
||||||
|
|
|
@ -44,4 +44,4 @@ log from .git/annex/daemon.log:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 1"""
|
||||||
|
date="2015-11-10T19:56:03Z"
|
||||||
|
content="""
|
||||||
|
Ok, I was able to reproduce it, when using the assistant it seems the
|
||||||
|
option is not passed when pushing and fetching there.
|
||||||
|
"""]]
|
Loading…
Reference in a new issue