summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-05-05 14:05:02 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-05-05 14:05:02 -0400
commit4315fd674b0e9163f0026d8d164f03be53124b9f (patch)
tree5af6cc2b091d8b6f8396ac8f169c0e8cca3b08c2
parent37705c7157dd2190fee7da528024211b084412c0 (diff)
Support checking ftp urls for file presence.
-rw-r--r--Utility/Url.hs10
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn5
3 files changed, 13 insertions, 3 deletions
diff --git a/Utility/Url.hs b/Utility/Url.hs
index 9c5d6a708..1d34b558f 100644
--- a/Utility/Url.hs
+++ b/Utility/Url.hs
@@ -123,10 +123,14 @@ getUrlInfo url uo = case parseURIRelaxed url of
| Build.SysConfig.curl -> do
output <- catchDefaultIO "" $
readProcess "curl" $ toCommand curlparams
+ let len = extractlencurl output
+ let good = found len Nothing
case lastMaybe (lines output) of
- Just ('2':_:_) -> found
- (extractlencurl output)
- Nothing
+ Just ('2':_:_) -> good
+ -- don't try to parse ftp status
+ -- codes; if curl got a length,
+ -- it's good
+ _ | "ftp" `isInfixOf` uriScheme u && isJust len -> good
_ -> dne
| otherwise -> dne
Nothing -> dne
diff --git a/debian/changelog b/debian/changelog
index d7efa4228..39bfe5748 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -29,6 +29,7 @@ git-annex (5.20150421) UNRELEASED; urgency=medium
* Android: Updated bundled ssh from 6.1p1 to 6.4p1.
* Work around wget bug #784348 which could cause it to clobber git-annex
symlinks when downloading from ftp.
+ * Support checking ftp urls for file presence.
-- Joey Hess <id@joeyh.name> Tue, 21 Apr 2015 15:54:10 -0400
diff --git a/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn b/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn
index d9ab7670d..1081b7acf 100644
--- a/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn
+++ b/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn
@@ -105,3 +105,8 @@ $
"""]]
> workaround in place; [[done]] --[[Joey]]
+
+> Also, fixed it to allow dropping the file if the ftp server seems
+> to reply with a successful result (it's replying with 350, which is not
+> unambiguously good, but since curl is able to get the right file length,
+> the file is presumably still on the ftp server. --[[Joey]]