fix edge case where git-annex branch does not have config for enabled special remote
One way this could happen is cloning an empty special remote. A later fetch would then fail.
This commit is contained in:
parent
3e7324bbcb
commit
b3d7ae51f0
2 changed files with 13 additions and 9 deletions
|
@ -454,7 +454,8 @@ parseSpecialRemoteUrl url remotename = case parseURI url of
|
||||||
|
|
||||||
-- Runs an action with a Remote as specified by the SpecialRemoteConfig.
|
-- Runs an action with a Remote as specified by the SpecialRemoteConfig.
|
||||||
withSpecialRemote :: SpecialRemoteConfig -> StartAnnexBranch -> (Remote -> Annex a) -> Annex a
|
withSpecialRemote :: SpecialRemoteConfig -> StartAnnexBranch -> (Remote -> Annex a) -> Annex a
|
||||||
withSpecialRemote (ExistingSpecialRemote remotename) _ a =
|
withSpecialRemote (ExistingSpecialRemote remotename) _ a = do
|
||||||
|
liftIO $ hPutStrLn stderr "case 1"
|
||||||
getEnabledSpecialRemoteByName remotename >>=
|
getEnabledSpecialRemoteByName remotename >>=
|
||||||
maybe (giveup $ "There is no special remote named " ++ remotename)
|
maybe (giveup $ "There is no special remote named " ++ remotename)
|
||||||
a
|
a
|
||||||
|
@ -514,7 +515,13 @@ getEnabledSpecialRemoteByName :: RemoteName -> Annex (Maybe Remote)
|
||||||
getEnabledSpecialRemoteByName remotename =
|
getEnabledSpecialRemoteByName remotename =
|
||||||
Remote.byNameOnly remotename >>= \case
|
Remote.byNameOnly remotename >>= \case
|
||||||
Nothing -> return Nothing
|
Nothing -> return Nothing
|
||||||
Just 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
|
maybe (return (Just rmt)) giveup
|
||||||
(checkSpecialRemoteProblems rmt)
|
(checkSpecialRemoteProblems rmt)
|
||||||
|
|
||||||
|
@ -540,10 +547,10 @@ parseManifest b =
|
||||||
checkvalid _ (Nothing:_) =
|
checkvalid _ (Nothing:_) =
|
||||||
Left "Error parsing manifest"
|
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 :: Remote -> Maybe String
|
||||||
checkSpecialRemoteProblems rmt
|
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) =
|
| Remote.thirdPartyPopulated (Remote.remotetype rmt) =
|
||||||
Just $ "Cannot use this thirdparty-populated special"
|
Just $ "Cannot use this thirdparty-populated special"
|
||||||
++ " remote as a git remote."
|
++ " remote as a git remote."
|
||||||
|
|
|
@ -12,9 +12,6 @@ This is implememented and working. Remaining todo list for it:
|
||||||
|
|
||||||
* Test incremental push edge cases involving checkprereq.
|
* 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
|
* Cloning from an annex:: url with importtree=yes doesn't work
|
||||||
(with or without exporttree=yes). This is because the ContentIdentifier
|
(with or without exporttree=yes). This is because the ContentIdentifier
|
||||||
db is not populated. It should be possible to work around this.
|
db is not populated. It should be possible to work around this.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue