addurl --pathdepth: Fix failure when the pathdepth specified is deeper than the urls's path.

This commit is contained in:
Joey Hess 2013-07-05 12:46:38 -04:00
parent d84a000e92
commit 74ad3072e4
3 changed files with 9 additions and 0 deletions

View file

@ -151,6 +151,7 @@ url2file :: URI -> Maybe Int -> FilePath
url2file url pathdepth = case pathdepth of
Nothing -> filesize $ escape fullurl
Just depth
| depth >= length urlbits -> frombits id
| depth > 0 -> frombits $ drop depth
| depth < 0 -> frombits $ reverse . take (negate depth) . reverse
| otherwise -> error "bad --pathdepth"

2
debian/changelog vendored
View file

@ -15,6 +15,8 @@ git-annex (4.20130628) UNRELEASED; urgency=low
* init: Detect systems on which git commit fails due to not being able to
determine the FQDN, and put in a workaround so committing to the git-annex
branch works.
* addurl --pathdepth: Fix failure when the pathdepth specified is deeper
than the urls's path.
-- Joey Hess <joeyh@debian.org> Tue, 02 Jul 2013 15:40:55 -0400

View file

@ -189,3 +189,9 @@ All interesting transcripts are posted above with cruft removed.
# End of transcript or log.
"""]]
> The cause of this bug is using --pathdepth=3 when the url
> only has two components in its path. So, kinda GIGO, but
> let's fix this anyway. ;)
>
> [[fixed|done]] --[[Joey]]