summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex/Content.hs3
-rw-r--r--Annex/Ssh.hs4
-rw-r--r--Config.hs2
-rw-r--r--Git.hs12
-rw-r--r--configure.hs7
-rw-r--r--debian/changelog2
-rw-r--r--debian/control1
-rw-r--r--doc/git-annex.mdwn3
8 files changed, 27 insertions, 7 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index f328051e3..fdd03f320 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -313,7 +313,8 @@ saveState :: Bool -> Annex ()
saveState oneshot = do
Annex.Queue.flush False
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
then Annex.Branch.commit "update"
else Annex.Branch.stage
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index df9f0e410..47f0ee4f6 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -16,6 +16,7 @@ import Common.Annex
import Annex.LockPool
import qualified Git
import qualified Git.Config
+import qualified Build.SysConfig as SysConfig
{- Generates parameters to ssh to a given host (or user@host) on a given
- 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 (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
then do
dir <- fromRepo gitAnnexSshDir
diff --git a/Config.hs b/Config.hs
index 349ddf67f..a93e2610e 100644
--- a/Config.hs
+++ b/Config.hs
@@ -69,7 +69,7 @@ prop_cost_sane = False `notElem`
{- Checks if a repo should be ignored. -}
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
- in git config. forcenumcopies overrides everything. -}
diff --git a/Git.hs b/Git.hs
index d8db471e9..284bf331c 100644
--- a/Git.hs
+++ b/Git.hs
@@ -85,7 +85,8 @@ assertLocal repo action =
else error $ "acting on non-local git repo " ++ repoDescribe repo ++
" not supported"
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
unknown = error $ "it is not known if git repo " ++
repoDescribe repo ++
@@ -112,5 +113,10 @@ workTree Repo { location = Dir d } = d
workTree Repo { location = Unknown } = undefined
{- Checks if a string from git config is a true value. -}
-configTrue :: String -> Bool
-configTrue s = map toLower s == "true"
+configTrue :: String -> Maybe Bool
+configTrue s
+ | s' == "true" = Just True
+ | s' == "false" = Just False
+ | otherwise = Nothing
+ where
+ s' = map toLower s
diff --git a/configure.hs b/configure.hs
index 772df3e38..9dcc6a501 100644
--- a/configure.hs
+++ b/configure.hs
@@ -4,9 +4,11 @@ import System.Directory
import Data.List
import Data.Maybe
import System.Cmd.Utils
+import Control.Applicative
import Build.TestConfig
import Utility.StatFS
+import Utility.SafeCommand
tests :: [TestCase]
tests =
@@ -23,6 +25,7 @@ tests =
, TestCase "wget" $ testCmd "wget" "wget --version >/dev/null"
, TestCase "bup" $ testCmd "bup" "bup --version >/dev/null"
, TestCase "gpg" $ testCmd "gpg" "gpg --version >/dev/null"
+ , TestCase "ssh connection caching" getSshConnectionCaching
, TestCase "StatFS" testStatFS
] ++ shaTestCases [1, 256, 512, 224, 384]
@@ -66,6 +69,10 @@ getGitVersion = do
let version = last $ words $ head $ lines s
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 = do
s <- getFileSystemStats "."
diff --git a/debian/changelog b/debian/changelog
index 9436d2e6d..94bc09389 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -34,6 +34,8 @@ git-annex (3.20120124) UNRELEASED; urgency=low
* 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
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
diff --git a/debian/control b/debian/control
index 983c3da1e..28f171c75 100644
--- a/debian/control
+++ b/debian/control
@@ -23,6 +23,7 @@ Build-Depends:
git,
uuid,
rsync,
+ openssh-client,
Maintainer: Joey Hess <joeyh@debian.org>
Standards-Version: 3.9.2
Vcs-Git: git://git.kitenet.net/git-annex
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index 0dc22b88d..0928c36f6 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -604,7 +604,8 @@ Here are all the supported configuration settings.
* `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`