[darcs-devel] [darcs #375] Add ~/.darcs/environment as alternative to environment variables.

David Roundy via RT bugs at darcs.net
Mon May 2 04:22:47 PDT 2005


Mon May 02 07:22:46 2005: New ticket: 375.
Transaction: Ticket created by droundy
       Queue: Darcs
     Subject: Add ~/.darcs/environment as alternative to environment variables.
       Owner: Nobody
  Requestors: droundy at abridgegame.org
      Status: new
 Ticket <URL: http://bugs.darcs.net/.//Ticket/Display.html?id=375 >

Starting this as a new bug... I hope it's not a repeat.

On Mon, May 02, 2005 at 10:34:47AM +0100, Ralph Corderoy wrote:
> > I think Benedikt has already thought about this.  From looking at the
> > patch, darcs will try DARCS_PAGER before PAGER, so you can have a
> > special pager configuration just for darcs.
> 
> It's a shame that the environment typically shared by all processes has
> to be cluttered with lots of PREFIX_FOO variables that are of no
> interest to all the other programs.  A ~/.darcsrc entry would be less
> cluttering, perhaps with just a single way of over-riding the rc file's
> location, e.g. DARCSRC=/dev/null would stop it having an effect.

My leaning would be to have a file ~/.darcs/environment, which would
contain statements like FOO=foo.  We could then define a function

darcsGetEnvironment :: String -> IO (Maybe String)

which would first look for its input FOO in ~/.darcs/environment (maybe
first in _darcs/prefs/environment?), and then as an environment variable
DARCS_FOO, and finally as an environment variable FOO.  This will keep the
environment-using code simple, will allow users who want to have variable
settings (depending, for example on terminal) to use environment variables
to configure things, while not requiring that users clutter up their
environment to configure darcs.

I guess probably the DARCS_FOO environment variable should override the
contents of ~/.darcs/environment, since one might want to occasionally
modify one's settings for a single command.

Perhaps we'd even want to use unsafePerformIO to make

darcsGetEnvironment :: String -> Maybe String

which ought to be safe, since environment variables aren't likely to change
while we're running, and users have to good reason to expect predictable
behavior if they modify the contents of ~/.darcs/ while darcs is running.
-- 
David Roundy
http://www.darcs.net





More information about the darcs-devel mailing list