Fix doubled progress display when downloading an url when -J is used.

downloadUrl uses meteredFile, which sets up one progress meter,
and Remote.Web also uses metered, so two progress meters are displayed for
the same download.

Reversion introduced with the http-conduit switch in
c34152777b -- I don't know why the extra
call to metered was added there.

When -J is not used, the extra progress meter didn't display,
but an extra blank line did get output, which is also fixed.

This commit was sponsored by John Pellman on Patreon.
This commit is contained in:
Joey Hess 2018-12-30 12:29:49 -04:00
parent 260ac417dd
commit a26514d67e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 4 additions and 3 deletions

View file

@ -880,7 +880,8 @@ saveState nocommit = doSideAction $ do
whenM (annexAlwaysCommit <$> Annex.getGitConfig) $
Annex.Branch.commit =<< Annex.Branch.commitMessage
{- Downloads content from any of a list of urls. -}
{- Downloads content from any of a list of urls, displaying a progress
- meter. -}
downloadUrl :: Key -> MeterUpdate -> [Url.URLString] -> FilePath -> Annex Bool
downloadUrl k p urls file =
-- Poll the file to handle configurations where an external

View file

@ -10,6 +10,7 @@ git-annex (7.20181212) UNRELEASED; urgency=medium
adjusted unlocked. (Fixes test suite on crippled filesystems.)
* unused: Update suggested git log message to see where data was previously
used so it will also work with v7 unlocked pointer files.
* Fix doubled progress display when downloading an url when -J is used.
-- Joey Hess <id@joeyh.name> Tue, 18 Dec 2018 12:24:52 -0400

View file

@ -87,8 +87,7 @@ downloadKey key _af dest p = unVerified $ get =<< getWebUrls key
YoutubeDownloader -> do
showOutput
youtubeDlTo key u' dest
_ -> metered (Just p) key (pure Nothing) $ \_ p' ->
downloadUrl key p' [u'] dest
_ -> downloadUrl key p [u'] dest
downloadKeyCheap :: Key -> AssociatedFile -> FilePath -> Annex Bool
downloadKeyCheap _ _ _ = return False