configure: Check if ssh connection caching is supported by the installed version of ssh and default annex.sshcaching accordingly.
This commit is contained in:
parent
c3fbe07d7a
commit
12b89a3eb8
8 changed files with 27 additions and 7 deletions
|
@ -313,7 +313,8 @@ saveState :: Bool -> Annex ()
|
||||||
saveState oneshot = do
|
saveState oneshot = do
|
||||||
Annex.Queue.flush False
|
Annex.Queue.flush False
|
||||||
unless oneshot $ do
|
unless oneshot $ do
|
||||||
alwayscommit <- Git.configTrue <$> fromRepo (Git.Config.get "annex.alwayscommit" "true")
|
alwayscommit <- fromMaybe True . Git.configTrue
|
||||||
|
<$> fromRepo (Git.Config.get "annex.alwayscommit" "")
|
||||||
if alwayscommit
|
if alwayscommit
|
||||||
then Annex.Branch.commit "update"
|
then Annex.Branch.commit "update"
|
||||||
else Annex.Branch.stage
|
else Annex.Branch.stage
|
||||||
|
|
|
@ -16,6 +16,7 @@ import Common.Annex
|
||||||
import Annex.LockPool
|
import Annex.LockPool
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import qualified Git.Config
|
import qualified Git.Config
|
||||||
|
import qualified Build.SysConfig as SysConfig
|
||||||
|
|
||||||
{- Generates parameters to ssh to a given host (or user@host) on a given
|
{- Generates parameters to ssh to a given host (or user@host) on a given
|
||||||
- port, with connection caching. -}
|
- port, with connection caching. -}
|
||||||
|
@ -37,7 +38,8 @@ sshParams (host, port) opts = go =<< sshInfo (host, port)
|
||||||
|
|
||||||
sshInfo :: (String, Maybe Integer) -> Annex (Maybe FilePath, [CommandParam])
|
sshInfo :: (String, Maybe Integer) -> Annex (Maybe FilePath, [CommandParam])
|
||||||
sshInfo (host, port) = do
|
sshInfo (host, port) = do
|
||||||
caching <- Git.configTrue <$> fromRepo (Git.Config.get "annex.sshcaching" "true")
|
caching <- fromMaybe SysConfig.sshconnectioncaching . Git.configTrue
|
||||||
|
<$> fromRepo (Git.Config.get "annex.sshcaching" "")
|
||||||
if caching
|
if caching
|
||||||
then do
|
then do
|
||||||
dir <- fromRepo gitAnnexSshDir
|
dir <- fromRepo gitAnnexSshDir
|
||||||
|
|
|
@ -69,7 +69,7 @@ prop_cost_sane = False `notElem`
|
||||||
|
|
||||||
{- Checks if a repo should be ignored. -}
|
{- Checks if a repo should be ignored. -}
|
||||||
repoNotIgnored :: Git.Repo -> Annex Bool
|
repoNotIgnored :: Git.Repo -> Annex Bool
|
||||||
repoNotIgnored r = not . Git.configTrue <$> getConfig r "ignore" "false"
|
repoNotIgnored r = not . fromMaybe False . Git.configTrue <$> getConfig r "ignore" ""
|
||||||
|
|
||||||
{- If a value is specified, it is used; otherwise the default is looked up
|
{- If a value is specified, it is used; otherwise the default is looked up
|
||||||
- in git config. forcenumcopies overrides everything. -}
|
- in git config. forcenumcopies overrides everything. -}
|
||||||
|
|
12
Git.hs
12
Git.hs
|
@ -85,7 +85,8 @@ assertLocal repo action =
|
||||||
else error $ "acting on non-local git repo " ++ repoDescribe repo ++
|
else error $ "acting on non-local git repo " ++ repoDescribe repo ++
|
||||||
" not supported"
|
" not supported"
|
||||||
configBare :: Repo -> Bool
|
configBare :: Repo -> Bool
|
||||||
configBare repo = maybe unknown configTrue $ M.lookup "core.bare" $ config repo
|
configBare repo = maybe unknown (fromMaybe False . configTrue) $
|
||||||
|
M.lookup "core.bare" $ config repo
|
||||||
where
|
where
|
||||||
unknown = error $ "it is not known if git repo " ++
|
unknown = error $ "it is not known if git repo " ++
|
||||||
repoDescribe repo ++
|
repoDescribe repo ++
|
||||||
|
@ -112,5 +113,10 @@ workTree Repo { location = Dir d } = d
|
||||||
workTree Repo { location = Unknown } = undefined
|
workTree Repo { location = Unknown } = undefined
|
||||||
|
|
||||||
{- Checks if a string from git config is a true value. -}
|
{- Checks if a string from git config is a true value. -}
|
||||||
configTrue :: String -> Bool
|
configTrue :: String -> Maybe Bool
|
||||||
configTrue s = map toLower s == "true"
|
configTrue s
|
||||||
|
| s' == "true" = Just True
|
||||||
|
| s' == "false" = Just False
|
||||||
|
| otherwise = Nothing
|
||||||
|
where
|
||||||
|
s' = map toLower s
|
||||||
|
|
|
@ -4,9 +4,11 @@ import System.Directory
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import System.Cmd.Utils
|
import System.Cmd.Utils
|
||||||
|
import Control.Applicative
|
||||||
|
|
||||||
import Build.TestConfig
|
import Build.TestConfig
|
||||||
import Utility.StatFS
|
import Utility.StatFS
|
||||||
|
import Utility.SafeCommand
|
||||||
|
|
||||||
tests :: [TestCase]
|
tests :: [TestCase]
|
||||||
tests =
|
tests =
|
||||||
|
@ -23,6 +25,7 @@ tests =
|
||||||
, TestCase "wget" $ testCmd "wget" "wget --version >/dev/null"
|
, TestCase "wget" $ testCmd "wget" "wget --version >/dev/null"
|
||||||
, TestCase "bup" $ testCmd "bup" "bup --version >/dev/null"
|
, TestCase "bup" $ testCmd "bup" "bup --version >/dev/null"
|
||||||
, TestCase "gpg" $ testCmd "gpg" "gpg --version >/dev/null"
|
, TestCase "gpg" $ testCmd "gpg" "gpg --version >/dev/null"
|
||||||
|
, TestCase "ssh connection caching" getSshConnectionCaching
|
||||||
, TestCase "StatFS" testStatFS
|
, TestCase "StatFS" testStatFS
|
||||||
] ++ shaTestCases [1, 256, 512, 224, 384]
|
] ++ shaTestCases [1, 256, 512, 224, 384]
|
||||||
|
|
||||||
|
@ -66,6 +69,10 @@ getGitVersion = do
|
||||||
let version = last $ words $ head $ lines s
|
let version = last $ words $ head $ lines s
|
||||||
return $ Config "gitversion" (StringConfig version)
|
return $ Config "gitversion" (StringConfig version)
|
||||||
|
|
||||||
|
getSshConnectionCaching :: Test
|
||||||
|
getSshConnectionCaching = Config "sshconnectioncaching" . BoolConfig <$>
|
||||||
|
boolSystem "sh" [Param "-c", Param "ssh -o ControlPersist=yes -V >/dev/null 2>/dev/null"]
|
||||||
|
|
||||||
testStatFS :: Test
|
testStatFS :: Test
|
||||||
testStatFS = do
|
testStatFS = do
|
||||||
s <- getFileSystemStats "."
|
s <- getFileSystemStats "."
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -34,6 +34,8 @@ git-annex (3.20120124) UNRELEASED; urgency=low
|
||||||
* To avoid commits of data to the git-annex branch after each command
|
* To avoid commits of data to the git-annex branch after each command
|
||||||
is run, set annex.alwayscommit=false. Its data will then be committed
|
is run, set annex.alwayscommit=false. Its data will then be committed
|
||||||
less frequently, when a merge or sync is done.
|
less frequently, when a merge or sync is done.
|
||||||
|
* configure: Check if ssh connection caching is supported by the installed
|
||||||
|
version of ssh and default annex.sshcaching accordingly.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Tue, 24 Jan 2012 16:21:55 -0400
|
-- Joey Hess <joeyh@debian.org> Tue, 24 Jan 2012 16:21:55 -0400
|
||||||
|
|
||||||
|
|
1
debian/control
vendored
1
debian/control
vendored
|
@ -23,6 +23,7 @@ Build-Depends:
|
||||||
git,
|
git,
|
||||||
uuid,
|
uuid,
|
||||||
rsync,
|
rsync,
|
||||||
|
openssh-client,
|
||||||
Maintainer: Joey Hess <joeyh@debian.org>
|
Maintainer: Joey Hess <joeyh@debian.org>
|
||||||
Standards-Version: 3.9.2
|
Standards-Version: 3.9.2
|
||||||
Vcs-Git: git://git.kitenet.net/git-annex
|
Vcs-Git: git://git.kitenet.net/git-annex
|
||||||
|
|
|
@ -604,7 +604,8 @@ Here are all the supported configuration settings.
|
||||||
|
|
||||||
* `annex.sshcaching`
|
* `annex.sshcaching`
|
||||||
|
|
||||||
By default, git-annex caches ssh connections. To disable this, set to `false`.
|
By default, git-annex caches ssh connections
|
||||||
|
(if built using a new enough ssh). To disable this, set to `false`.
|
||||||
|
|
||||||
* `annex.alwayscommit`
|
* `annex.alwayscommit`
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue