Avoid throwing fatal errors when asked to write to a readonly git remote on http

Test suite found one of them, looking for giveup turned up several more.
This commit is contained in:
Joey Hess 2020-02-14 14:38:13 -04:00
parent a490947068
commit 399319ccbc
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 16 additions and 3 deletions

View file

@ -4,6 +4,8 @@ git-annex (7.20200205) UNRELEASED; urgency=medium
caching, default annex.sshcaching to false, but let the user override it.
* Improve warning messages further when ssh connection caching cannot
be used, to clearly state why.
* Avoid throwing fatal errors when asked to write to a readonly
git remote on http.
-- Joey Hess <id@joeyh.name> Fri, 14 Feb 2020 14:12:25 -0400

View file

@ -432,7 +432,9 @@ dropKey' repo r (State connpool duc _ _) key
return True
, return False
)
| Git.repoIsHttp repo = giveup "dropping from http remote not supported"
| Git.repoIsHttp repo = do
warning "dropping from http remote not supported"
return False
| otherwise = commitOnCleanup repo r $ do
let fallback = Ssh.dropKey repo key
P2PHelper.remove (Ssh.runProto r connpool (return False) fallback) key
@ -536,7 +538,9 @@ copyFromRemote'' repo forcersync r st@(State connpool _ _ _) key file dest meter
else P2PHelper.retrieve
(\p -> Ssh.runProto r connpool (return (False, UnVerified)) (fallback p))
key file dest meterupdate
| otherwise = giveup "copying from non-ssh, non-http remote not supported"
| otherwise = do
warning "copying from non-ssh, non-http remote not supported"
unVerified (return False)
where
fallback p = unVerified $ feedprogressback $ \p' -> do
oh <- mkOutputHandlerQuiet
@ -649,7 +653,9 @@ copyToRemote' repo r st@(State connpool duc _ _) key file meterupdate
(\p -> Ssh.runProto r connpool (return False) (copyremotefallback p))
key file meterupdate
| otherwise = giveup "copying to non-ssh repo not supported"
| otherwise = do
warning "copying to non-ssh repo not supported"
return False
where
copylocal Nothing = return False
copylocal (Just (object, checksuccess)) = do

View file

@ -78,3 +78,8 @@ It's possible there's another issue here I'm not entirely aware of.
### 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)
Of course! I use and rely on it daily :)
> This is not a bug in the test suite, it turns out, but in
> git-annex's handling of a http remote. It was throwing fatal errors
> rather than the correct behavior of displaying a warning. [[fixed|done]]
> --[[Joey]]