[darcs-devel] darcs patch: Simplify getCurrentDirectorySansDarcs out of existence.
Kevin Quick
quick at sparq.org
Mon Nov 19 05:28:11 UTC 2007
And on further consideration, this doesn't guarantee that it ends up
in a valid directory, either.
Maybe using breakup in src/FileName.lhs would be a better solution,
since you are really trying to operate on directory names rather than
individual characters.
-KQ
On 18 Nov 2007, at 10:20 PM, Kevin Quick wrote:
> This could still get false positive matches on things like: /foo/
> _darcs_is_great/bar/baz (although it nicely sidesteps any impossible
> cases :-).
>
> -KQ
>
> On 18 Nov 2007, at 9:13 PM, Eric Kow wrote:
>
>> Oops! Amended version.
>>
>> Mon Nov 19 05:13:26 CET 2007 Eric Kow <eric.kow at gmail.com>
>> * Simplify getCurrentDirectorySansDarcs out of existence.
>>
>> It was buggy and needlessly complicated.
>>
>>
>> New patches:
>>
>> [Simplify getCurrentDirectorySansDarcs out of existence.
>> Eric Kow <eric.kow at gmail.com>**20071119041326
>>
>> It was buggy and needlessly complicated.
>> ] {
>> hunk ./src/Darcs/Lock.lhs 36
>> -import Data.List ( isPrefixOf, inits )
>> hunk ./src/Darcs/Lock.lhs 63
>> -#include "impossible.h"
>> hunk ./src/Darcs/Lock.lhs 175
>> - look_for_tmp [] = try_directory "/tmp"
>> getCurrentDirectorySansDarcs
>> + look_for_tmp [] = try_directory "/tmp" (sansDarcs `fmap`
>> getCurrentDirectory)
>> hunk ./src/Darcs/Lock.lhs 180
>> -getCurrentDirectorySansDarcs :: IO FilePath
>> -getCurrentDirectorySansDarcs = do
>> - c <- getCurrentDirectory
>> - case drop 5 $ reverse $ takeWhile no_darcs $ inits c of
>> - [] -> impossible
>> - (d:_) -> return d
>> - where no_darcs x = not $ "_darcs" `isPrefixOf` x
>> +sansDarcs :: FilePath -> FilePath
>> +sansDarcs "" = ""
>> +sansDarcs ('/':'_':'d':'a':'r':'c':'s':_) = ""
>> +sansDarcs (x:xs) = x : sansDarcs xs
>> }
>>
>> Context:
>>
>> [TAG darcs unstable 2007-11-04
>> Eric Kow <eric.kow at loria.fr>**20071104235616]
>> Patch bundle hash:
>> 7ce6830afbed903a55c05dc1fb803b2143481e1d
>> _______________________________________________
>> darcs-devel mailing list
>> darcs-devel at darcs.net
>> http://lists.osuosl.org/mailman/listinfo/darcs-devel
>
> _______________________________________________
> darcs-devel mailing list
> darcs-devel at darcs.net
> http://lists.osuosl.org/mailman/listinfo/darcs-devel
More information about the darcs-devel
mailing list