From 806819be57107818bf4bbb17837bb46ab6f93ebe Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Oct 2015 15:28:29 -0400 Subject: [PATCH] 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. --- Annex/UUID.hs | 8 ++++++++ Remote/Git.hs | 2 +- debian/changelog | 2 ++ ...nt_1_943ff286824bd59a164b161553d65698._comment | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 doc/forum/error_setting_up_centralized_server_on_OSX_-_failed_to_get_annex.uuid_configuration_of_repository_origin/comment_1_943ff286824bd59a164b161553d65698._comment diff --git a/Annex/UUID.hs b/Annex/UUID.hs index 7776b778a3..cdd06c9e68 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) $ diff --git a/Remote/Git.hs b/Remote/Git.hs index 1c2573642d..33eadd3d09 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -221,7 +221,7 @@ tryGitConfigRead autoinit r v <- Git.Config.fromPipe r cmd params case v of Right (r', val) -> do - when (getUncachedUUID r' == NoUUID && not (null val)) $ do + unless (isUUIDConfigured r' || null val) $ do warningIO $ "Failed to get annex.uuid configuration of repository " ++ Git.repoDescribe r warningIO $ "Instead, got: " ++ show val warningIO $ "This is unexpected; please check the network transport!" diff --git a/debian/changelog b/debian/changelog index 5be414bd1d..92265fe50f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -42,6 +42,8 @@ git-annex (5.20150931) UNRELEASED; urgency=medium that could omit such files or otherwise be bad. Fixed by aborting the whole merge process when git merge fails for any reason other than a merge conflict. + * Avoid displaying network transport warning when a ssh remote + does not yet have an annex.uuid set. * Debian: Add torrent library to build-depends as it's packaged now, and stop recommending bittornado | bittorrent. * Debian: Remove dependency on transformers library, as it is now diff --git a/doc/forum/error_setting_up_centralized_server_on_OSX_-_failed_to_get_annex.uuid_configuration_of_repository_origin/comment_1_943ff286824bd59a164b161553d65698._comment b/doc/forum/error_setting_up_centralized_server_on_OSX_-_failed_to_get_annex.uuid_configuration_of_repository_origin/comment_1_943ff286824bd59a164b161553d65698._comment new file mode 100644 index 0000000000..eed9dfda96 --- /dev/null +++ b/doc/forum/error_setting_up_centralized_server_on_OSX_-_failed_to_get_annex.uuid_configuration_of_repository_origin/comment_1_943ff286824bd59a164b161553d65698._comment @@ -0,0 +1,15 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2015-10-15T18:55:42Z" + content=""" +Yeah, this is a bug, and one I was able to reproduce. It was introduced in +the last release of git-annex. + +Luckily, it's only a cosmetic bug. The `git annex init` does +succeed, and your repo is left in an ok state. If you continue +along the walkthrough path, adding some files and syncing with origin, it +will proceed to set up the origin appropriately and everything should work. + +I'm gonna fix the bug of course. Indeed, it's fixed in git master now. +"""]]