diff --git a/CHANGELOG b/CHANGELOG index e9a1d4a09d..f0395a4a64 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,14 @@ +git-annex (8.20200502) UNRELEASED; urgency=medium + + * Display a warning message when a remote uses a protocol, such as + git://, that git-annex does not support. Silently skipping such a + remote was confusing behavior. + * Also display a warning message when a remote, without a known uuid, + is located in a directory that does not currently exist, to avoid + silently skipping such a remote. + + -- Joey Hess Mon, 04 May 2020 12:46:11 -0400 + git-annex (8.20200501) upstream; urgency=medium * Improve git-annex's ability to find the path to its program, diff --git a/Remote/Git.hs b/Remote/Git.hs index d0c6b3ce17..1fc4c35926 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -149,15 +149,15 @@ gitSetup (Enable _) Nothing _ _ _ = error "unable to enable git remote with no s configRead :: Bool -> Git.Repo -> Annex Git.Repo configRead autoinit r = do gc <- Annex.getRemoteGitConfig r - u <- getRepoUUID r + hasuuid <- (/= NoUUID) <$> getRepoUUID r annexignore <- liftIO $ getDynamicConfig (remoteAnnexIgnore gc) - case (repoCheap r, annexignore, u) of + case (repoCheap r, annexignore, hasuuid) of (_, True, _) -> return r (True, _, _) - | remoteAnnexCheckUUID gc -> tryGitConfigRead autoinit r + | remoteAnnexCheckUUID gc -> tryGitConfigRead autoinit r hasuuid | otherwise -> return r - (False, _, NoUUID) -> configSpecialGitRemotes r >>= \case - Nothing -> tryGitConfigRead autoinit r + (False, _, False) -> configSpecialGitRemotes r >>= \case + Nothing -> tryGitConfigRead autoinit r False Just r' -> return r' _ -> return r @@ -244,8 +244,8 @@ repoAvail r {- Tries to read the config for a specified remote, updates state, and - returns the updated repo. -} -tryGitConfigRead :: Bool -> Git.Repo -> Annex Git.Repo -tryGitConfigRead autoinit r +tryGitConfigRead :: Bool -> Git.Repo -> Bool -> Annex Git.Repo +tryGitConfigRead autoinit r hasuuid | haveconfig r = return r -- already read | Git.repoIsSsh r = storeUpdatedRemote $ do v <- Ssh.onRemote NoConsumeStdin r @@ -258,9 +258,12 @@ tryGitConfigRead autoinit r Left _ -> configlist_failed | Git.repoIsHttp r = storeUpdatedRemote geturlconfig | Git.GCrypt.isEncrypted r = handlegcrypt =<< getConfigMaybe (remoteAnnexConfig r "uuid") - | Git.repoIsUrl r = return r - | otherwise = storeUpdatedRemote $ liftIO $ - readlocalannexconfig `catchNonAsync` (const $ return r) + | Git.repoIsUrl r = do + set_ignore "uses a protocol not supported by git-annex" False + return r + | otherwise = storeUpdatedRemote $ + liftIO readlocalannexconfig + `catchNonAsync` const failedreadlocalconfig where haveconfig = not . M.null . Git.config @@ -339,6 +342,13 @@ tryGitConfigRead autoinit r s <- Annex.new r Annex.eval s $ check `finally` stopCoProcesses + failedreadlocalconfig = do + unless hasuuid $ case Git.remoteName r of + Nothing -> noop + Just n -> do + warning $ "Remote " ++ n ++ " cannot currently be accessed." + return r + configlistfields = if autoinit then [(Fields.autoInit, "1")] else [] @@ -898,7 +908,7 @@ mkState r u gc = do rv <- liftIO newEmptyMVar let getrepo = ifM (liftIO $ isEmptyMVar rv) ( do - r' <- tryGitConfigRead False r + r' <- tryGitConfigRead False r True let t = (r', extractGitConfig FromGitConfig r') void $ liftIO $ tryPutMVar rv t return t diff --git a/doc/bugs/annex_get_fails_with___39__not_available__39___for_git__58____47____47___protocol.mdwn b/doc/bugs/annex_get_fails_with___39__not_available__39___for_git__58____47____47___protocol.mdwn index 23853b7030..863d9eb5f5 100644 --- a/doc/bugs/annex_get_fails_with___39__not_available__39___for_git__58____47____47___protocol.mdwn +++ b/doc/bugs/annex_get_fails_with___39__not_available__39___for_git__58____47____47___protocol.mdwn @@ -175,3 +175,6 @@ Already posted above ### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders) Well... it did work for git's local protocol... + +> [[done]], this was not really a bug, but I have added a warning message +> --[[Joey]] diff --git a/doc/bugs/annex_get_fails_with___39__not_available__39___for_git__58____47____47___protocol/comment_2_874c2c2dc99362b559c8fe1715d3c0c4._comment b/doc/bugs/annex_get_fails_with___39__not_available__39___for_git__58____47____47___protocol/comment_2_874c2c2dc99362b559c8fe1715d3c0c4._comment new file mode 100644 index 0000000000..8867addac1 --- /dev/null +++ b/doc/bugs/annex_get_fails_with___39__not_available__39___for_git__58____47____47___protocol/comment_2_874c2c2dc99362b559c8fe1715d3c0c4._comment @@ -0,0 +1,26 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 2""" + date="2020-05-04T16:13:02Z" + content=""" +git-annex cannot possibly support operation over the git protocol, because +that protocol does not have any way to add an extension such as git-annex +to it. + +So git-annex currently completely ignores git:// repositories, the same as +it would any git repository using some other foreign protocol. +(eg rsync or a protocol added by a git extension) + +This is actually identical behavior to if the remote had "url = +/media/whatever" and the drive was unmounted after the repo was cloned. +git-annex is not able to discover a uuid for the remote, and so it does +not know the remote contains the content, and so it does not say anything +about not being able to get the content from the remote, because it +never tried. IOW, this is a "beware of the leopard" situation. + +So, it would better for this to be handled the same way that a ssh remote +that lacks git-annex-shell is handled, by explicitly setting annex-ignore +on first use and displaying a warning. (Although it should not set +annex-ignore for the /media/whatever case, because the drive may later get +mounted again.) +"""]]