diff --git a/CmdLine/GitRemoteAnnex.hs b/CmdLine/GitRemoteAnnex.hs index 7d9204bff6..a2ee9cdaca 100644 --- a/CmdLine/GitRemoteAnnex.hs +++ b/CmdLine/GitRemoteAnnex.hs @@ -454,7 +454,8 @@ parseSpecialRemoteUrl url remotename = case parseURI url of -- Runs an action with a Remote as specified by the SpecialRemoteConfig. withSpecialRemote :: SpecialRemoteConfig -> StartAnnexBranch -> (Remote -> Annex a) -> Annex a -withSpecialRemote (ExistingSpecialRemote remotename) _ a = +withSpecialRemote (ExistingSpecialRemote remotename) _ a = do + liftIO $ hPutStrLn stderr "case 1" getEnabledSpecialRemoteByName remotename >>= maybe (giveup $ "There is no special remote named " ++ remotename) a @@ -514,9 +515,15 @@ getEnabledSpecialRemoteByName :: RemoteName -> Annex (Maybe Remote) getEnabledSpecialRemoteByName remotename = Remote.byNameOnly remotename >>= \case Nothing -> return Nothing - Just rmt -> - maybe (return (Just rmt)) giveup - (checkSpecialRemoteProblems rmt) + Just rmt + -- If the git-annex branch is missing or does not + -- have a remote config for this remote, but the + -- git config has the remote, it can't be used. + | unparsedRemoteConfig (Remote.config rmt) == mempty -> + return Nothing + | otherwise -> + maybe (return (Just rmt)) giveup + (checkSpecialRemoteProblems rmt) parseManifest :: B.ByteString -> Either String Manifest parseManifest b = @@ -540,10 +547,10 @@ parseManifest b = checkvalid _ (Nothing:_) = Left "Error parsing manifest" --- Avoid using special remotes that are thirdparty populated, because --- there is no way to push the git repository keys into one. checkSpecialRemoteProblems :: Remote -> Maybe String checkSpecialRemoteProblems rmt + -- Avoid using special remotes that are thirdparty populated, + -- because there is no way to push the git repository keys into one. | Remote.thirdPartyPopulated (Remote.remotetype rmt) = Just $ "Cannot use this thirdparty-populated special" ++ " remote as a git remote." diff --git a/doc/todo/git-remote-annex.mdwn b/doc/todo/git-remote-annex.mdwn index 99509e697f..7aa96ec618 100644 --- a/doc/todo/git-remote-annex.mdwn +++ b/doc/todo/git-remote-annex.mdwn @@ -12,9 +12,6 @@ This is implememented and working. Remaining todo list for it: * Test incremental push edge cases involving checkprereq. -* Cloning a special remote with an empty manifest results in a repo where - git fetch fails, claiming the special remote is encrypted, when it's not. - * Cloning from an annex:: url with importtree=yes doesn't work (with or without exporttree=yes). This is because the ContentIdentifier db is not populated. It should be possible to work around this.