aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/AddUrl.hs25
-rw-r--r--doc/bugs/problem_to_addurl_--file_with_ftp.mdwn1
2 files changed, 15 insertions, 11 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index 1c73cd24f..b108be507 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -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
diff --git a/doc/bugs/problem_to_addurl_--file_with_ftp.mdwn b/doc/bugs/problem_to_addurl_--file_with_ftp.mdwn
index 55a38c094..99381b961 100644
--- a/doc/bugs/problem_to_addurl_--file_with_ftp.mdwn
+++ b/doc/bugs/problem_to_addurl_--file_with_ftp.mdwn
@@ -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]]