[darcs-users] [patch266] Resolve Issue1210: global cache gets recorded in _darcs/prefs/sources

Eric Kow kowey at darcs.net
Mon Jun 7 08:30:59 UTC 2010

On Sun, Jun 06, 2010 at 21:36:16 +0000, Adolfo Builes wrote:
> Sun Jun  6 16:19:15 COT 2010  builes.adolfo at googlemail.com
>   * Resolve issue1210: global cache gets recorded in _darcs/prefs/sources

Applied, thanks!  Trivial comments below (not a request for amending,
just me making sort of useless comments)

Resolve issue1210: global cache gets recorded in _darcs/prefs/sources
> +    globalcacheDirectory <- globalCacheDir

There's a useful Hungarian-ish pseudo-convention in Darcs to prefix
Maybe (or similar things like Either) with m.  Here for example, I
might have said something like mglobal.

> +    let repoCache   = extractCache $
> +                      case globalcacheDirectory of
> +                         Just d -> modifyCache repo (dropLocalCache (Cache DarcsCache.Directory Writable d))
> +                         _      -> repo

Two things I would have done differently here are (a) to use an explicit
Nothing and (b) to put the Cache DarcsCache.Directory Writable in the
dropLocalCache function.  People may disagree with me on (b), though.

It doesn't matter much.  For pattern matching on these sum types,
particularly types of my own, I've grown somewhat leery of the catch-all
pattern because what inevitably happens is that I catch something
unexpected (for example, if I later tweak the type and introduce a new
branch).  I don't know what the right answer is, to be honest, but
lately I tend to lean slightly away from the '_'

> hunk ./src/Darcs/Repository/Prefs.lhs 34
>                     boringRegexps, boringFileFilter, darcsdirFilter,
>                     FileType(..), filetypeFunction,
>                     getCaches,
> -                   binariesFileHelp
> +                   binariesFileHelp,
> +                   globalCacheDir
>                   ) where

I *think* you can actually use the trick of appending a comma to
globalCacheDir, which keeps future patches minimal.

Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100607/33136fc3/attachment.pgp>

More information about the darcs-users mailing list