improve addurl --file behavior in a confusing corner case involving a ftp url

This commit is contained in:
Joey Hess 2014-04-02 15:22:39 -04:00
parent f02cf1ab5a
commit 1c965f5918
Failed to extract signature
2 changed files with 15 additions and 11 deletions

View file

@ -134,17 +134,20 @@ perform relaxed url file = ifAnnexed file addurl geturl
| relaxed = do
setUrlPresent key url
next $ return True
| otherwise = do
(exists, samesize) <- Url.withUrlOptions $ Url.check url (keySize key)
if exists && samesize
then do
setUrlPresent key url
next $ return True
else do
warning $ if exists
then "url does not have expected file size (use --relaxed to bypass this check) " ++ url
else "failed to verify url exists: " ++ url
stop
| otherwise = ifM (elem url <$> getUrls key)
( stop
, do
(exists, samesize) <- Url.withUrlOptions $ Url.check url (keySize key)
if exists && samesize
then do
setUrlPresent key url
next $ return True
else do
warning $ "while adding a new url to an already annexed file, " ++ if exists
then "url does not have expected file size (use --relaxed to bypass this check) " ++ url
else "failed to verify url exists: " ++ url
stop
)
addUrlFile :: Bool -> URLString -> FilePath -> Annex Bool
addUrlFile relaxed url file = do

View file

@ -64,3 +64,4 @@ I am using current git-annex binary linux version on Fedora 19.
supported repository version: 5
upgrade supported from repository versions: 0 1 2 4
> [[done]] --[[Joey]]