Re: Policy on global variables

2014-01-16 Thread Eric Wong
Lars Hjemli hje...@gmail.com wrote: On Thu, Jan 16, 2014 at 2:00 AM, Jason A. Donenfeld ja...@zx2c4.com wrote: On Thu, Jan 16, 2014 at 1:59 AM, Eric Wong normalper...@yhbt.net wrote: This. I prefer we keep passing around the ctx variable to keep the code more flexible for future reuse. Of

Re: Policy on global variables

2014-01-16 Thread Jason A. Donenfeld
On Thu, Jan 16, 2014 at 11:47 AM, Eric Wong normalper...@yhbt.net wrote: Lars Hjemli hje...@gmail.com wrote: Supporting something like FCGI in cgit will require a fork(2) for each request, before invoking libgit.a functions, since these functions are not generally reentrant (they tend to use

Re: Policy on global variables

2014-01-16 Thread John Keeping
On Thu, Jan 16, 2014 at 12:31:15PM +0100, Jason A. Donenfeld wrote: On Thu, Jan 16, 2014 at 11:47 AM, Eric Wong normalper...@yhbt.net wrote: Lars Hjemli hje...@gmail.com wrote: Supporting something like FCGI in cgit will require a fork(2) for each request, before invoking libgit.a

Re: Policy on global variables

2014-01-16 Thread Jason A. Donenfeld
On Thu, Jan 16, 2014 at 2:08 PM, John Keeping j...@keeping.me.uk wrote: I had a look at porting to libgit2 about a year ago and it mostly isn't too bad. IIRC the only problematic area is the graph output which we currently get from libgit.a but would have to do ourselves if we switch to

Re: Policy on global variables

2014-01-16 Thread John Keeping
On Thu, Jan 16, 2014 at 07:38:02PM +0100, Jason A. Donenfeld wrote: On Thu, Jan 16, 2014 at 2:08 PM, John Keeping j...@keeping.me.uk wrote: I had a look at porting to libgit2 about a year ago and it mostly isn't too bad. IIRC the only problematic area is the graph output which we

Re: Policy on global variables

2014-01-16 Thread John Keeping
On Thu, Jan 16, 2014 at 10:26:08PM +0100, Jason A. Donenfeld wrote: On Thu, Jan 16, 2014 at 10:21 PM, John Keeping j...@keeping.me.uk wrote: The first step in this direction may actually be useful even if we stick with embedding libgit.a. So what do you think ought to be done with the

Re: Policy on global variables

2014-01-16 Thread John Keeping
On Thu, Jan 16, 2014 at 10:36:34PM +0100, Jason A. Donenfeld wrote: On Thu, Jan 16, 2014 at 10:34 PM, John Keeping j...@keeping.me.uk wrote: I'm not sure it makes much difference either way. Even if we use libgit2, providing we're not processing more than one request at once we can still

Re: Policy on global variables

2014-01-16 Thread Jason A. Donenfeld
On Thu, Jan 16, 2014 at 11:20 PM, John Keeping j...@keeping.me.uk wrote: At once (as in in parallel), or without needing to fork for every request? I think that many requests serially in the same process is a much more likely scenario (that's what FastCGI does); in that case all we need to do

Re: Policy on global variables

2014-01-15 Thread Eric Wong
Jason A. Donenfeld ja...@zx2c4.com wrote: In theory, passing around the variable, and not relying on a global, is better. It allows us at somepoint to have multiple contexts, for, say, implementing FastCGI or an event loop single-process multi response model. This. I prefer we keep passing

Re: Policy on global variables

2014-01-15 Thread Jason A. Donenfeld
On Thu, Jan 16, 2014 at 1:59 AM, Eric Wong normalper...@yhbt.net wrote: This. I prefer we keep passing around the ctx variable to keep the code more flexible for future reuse. Of course, IIRC git itself has this limitation, too... Can anyone confirm or deny this? Is it a pointless endeavor