Re: [PATCH 8/9] git_config_set: use do_config_from_file() directly
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 30, 2018, 19:04 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1803302102480.5026@qfpub.tvgsbejvaqbjf.bet>
- In-Reply-To
- <20180330140840.GA5869@sigill.intra.peff.net>
Hi Peff,
On Fri, 30 Mar 2018, Jeff King wrote:
Show 33 quoted lines
> On Fri, Mar 30, 2018 at 04:01:56PM +0200, Johannes Schindelin wrote:
>
> > You know what is *really* funny?
> >
> > -- snip --
> > static int git_config_from_stdin(config_fn_t fn, void *data)
> > {
> > return do_config_from_file(fn, CONFIG_ORIGIN_STDIN, "", NULL, stdin, data, 0);
> > }
> >
> > int git_config_from_file(config_fn_t fn, const char *filename, void *data)
> > {
> > int ret = -1;
> > FILE *f;
> >
> > f = fopen_or_warn(filename, "r");
> > if (f) {
> > flockfile(f);
> > ret = do_config_from_file(fn, CONFIG_ORIGIN_FILE, filename, filename, f, data, 0);
> > funlockfile(f);
> > fclose(f);
> > }
> > return ret;
> > }
> > -- snap --
> >
> > So the _stdin variant *goes out of its way not to flockfile()*...
>
> *facepalm* That's probably my fault, since git_config_from_stdin()
> existed already when I did the flockfile stuff.
>
> Probably the flockfile should go into do_config_from_file(), where we
> specify to use the unlocked variants.Ah, that makes sense now! I am glad I could also help ;-)
Show 8 quoted lines
> > But I guess all this will become moot when I start handing down the config > > options. It does mean that I have to change the signatures in header > > files, oh well ;-) > > > > But then I can drop this here patch and we can stop musing about > > flockfile() ;-) > > Yeah, I'll wait to see how your refactor turns out.
I don't think I'll touch too much in that part of the code. My changes should not cause merge conflicts with a patch moving the flockfile()/funlockfile() calls to do_config_from_file().
Ciao, Dscho