gh <[email protected]> added the comment: Good to go, see below.
> [Cope with initial spaces in URLs > Florent Becker <[email protected]>**20101102103147 > Ignore-this: f0d58cb6310ffa08cfd072190f2eaea5 > ] hunk ./src/Darcs/URL.hs 26 > > Path resolving: > > - * A URL contains the sequence @\":\/\/\"@. > + * An http URL contains the sequence @\"http(s):\/\/\"@. Ok. > > * A local filepath does not contain colons, except > as second character (windows drives) when this > hunk ./src/Darcs/URL.hs 32 > filepath is meant to be used as repository name > > - * A path that is neither a URL nor a local file > + * A path that is neither an http URL nor a local file Ok. > is an ssh-path. > > Examples: > hunk ./src/Darcs/URL.hs 57 > > import Darcs.Global(darcsdir) > import Data.List ( isPrefixOf, isInfixOf ) > +import Data.Char ( isSpace ) Ok. > import qualified System.FilePath as FP (isRelative, isAbsolute, isValid) > > #include "impossible.h" > hunk ./src/Darcs/URL.hs 75 > isFile f = FP.isValid f > > isHttpUrl :: String -> Bool > -isHttpUrl u = ("http://" `isPrefixOf`u) || ("https://" `isPrefixOf` u) > +isHttpUrl u = > + let u' = dropWhile isSpace u in > + ("http://" `isPrefixOf` u') || ("https://" `isPrefixOf` u') Ok. > > > isSshUrl :: String -> Bool > hunk ./src/Darcs/URL.hs 81 > -isSshUrl s > - | "ssh://" `isPrefixOf` s = True > - | "://" `isInfixOf` s = False > - | otherwise = not (isFile s) > +isSshUrl s = isu' (dropWhile isSpace s) > + where > + isu' s' > + | "ssh://" `isPrefixOf` s' = True > + | "://" `isInfixOf` s' = False > + | otherwise = ":" `isInfixOf` s' Same ok. > > isSshNopath :: String -> Bool > isSshNopath s = case reverse s of > hunk ./src/Darcs/URL.hs 96 > -- | Gives the (user, host, dir) out of an ssh url > splitSshUrl :: String -> SshFilePath > splitSshUrl s | "ssh://" `isPrefixOf` s = > - let s' = drop (length "ssh://") s > + let s' = drop (length "ssh://") $ dropWhile isSpace s Ok. > (dir, file) = cleanrepodir '/' s' > in > SshFP { sshUhost = takeWhile (/= '/') s' > hunk ./src/Darcs/URL.hs 104 > , sshFile = file } > splitSshUrl s = > let (dir, file) = cleanrepodir ':' s in > - SshFP { sshUhost = takeWhile (/= ':') s > + SshFP { sshUhost = dropWhile isSpace $ takeWhile (/= ':') s Ok. > , sshRepo = dir > , sshFile = file } > __________________________________ Darcs bug tracker <[email protected]> <http://bugs.darcs.net/patch444> __________________________________ _______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
