summaryrefslogtreecommitdiff
path: root/Annex/UUID.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-10-15 15:28:29 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-10-15 15:36:54 -0400
commit68ac4d8240612e43bf2a5b875d527f7912b10412 (patch)
treed91fffe25ea296d87ef9f09f2733ccf7b88d6535 /Annex/UUID.hs
parenta2194926bf04d79816195d79f6549b0276414813 (diff)
Avoid displaying network transport warning when a ssh remote does not yet have an annex.uuid set.
Instead, only display transport error if the configlist output doesn't include an annex.uuid line, even an empty one. A recent change made git-annex init try to get all the remote uuids, and so the transport error would be displayed by it. It was also displayed when eg, copying files to a remote that had no uuid yet.
Diffstat (limited to 'Annex/UUID.hs')
-rw-r--r--Annex/UUID.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Annex/UUID.hs b/Annex/UUID.hs
index 7776b778a..cdd06c9e6 100644
--- a/Annex/UUID.hs
+++ b/Annex/UUID.hs
@@ -15,6 +15,7 @@ module Annex.UUID (
getUUID,
getRepoUUID,
getUncachedUUID,
+ isUUIDConfigured,
prepUUID,
genUUID,
genUUIDInNameSpace,
@@ -84,6 +85,13 @@ getUncachedUUID = toUUID . Git.Config.get key ""
where
(ConfigKey key) = configkey
+-- Does the repo's config have a key for the UUID?
+-- True even when the key has no value.
+isUUIDConfigured :: Git.Repo -> Bool
+isUUIDConfigured = isJust . Git.Config.getMaybe key
+ where
+ (ConfigKey key) = configkey
+
{- Make sure that the repo has an annex.uuid setting. -}
prepUUID :: Annex ()
prepUUID = whenM ((==) NoUUID <$> getUUID) $