Re: [PATCH 2/3] gc: exit with status 128 on failure
- From
Jeff King <peff@peff.net>
- Date
- Sep 18, 2018, 17:30 UTC
- Message-ID
- <20180918173017.GD15470@sigill.intra.peff.net>
- In-Reply-To
- <20180917184012.GD140909@aiede.svl.corp.google.com>
On Mon, Sep 17, 2018 at 11:40:12AM -0700, Jonathan Nieder wrote:
Show 9 quoted lines
> > There's discussion elsewhere[1] of applying just up to patch 2. > > > > Do we still want to convert these cases to die() as their end-state? > > IMHO yes, we do. die() is the function that you can use to exit with > a fatal error. > > If we want to get rid of die(), that would be a tree-wide effort, not > something that should hold up this patch.
But that was sort of my question. I think there are people who _do_ want to get rid of most die() calls (like Dscho), and there is a tree-wide effort that is happening slowly to lib-ify. Your patch goes in the opposite direction.
That said, I think there are actually two cases in your patch.
The calls to "return error()" or even just "return -1" in cmd_gc() seem like obvious candidates for die(). We're at the top of the stack, and anybody lib-ifying at that level is going to need to extract bits into reusable functions anyway.
I more wondered about helpers like report_last_gc_error() and gc_before_repack().
Show 5 quoted lines
> > It also makes the code more flexible and lib-ifiable (since the caller > > can decide how to handle the errors). That probably doesn't matter much > > since this is all static-local to builtin/gc.c, > > Exactly. I'm a strong believer in http://wiki.c2.com/?YouArentGonnaNeedIt.
I only half-agree that this is YAGNI. If it were "let's punt on making this code friendlier to lib-ification", I'd agree more completely. But it's actually taking an active step in the opposite direction.
I dunno. It's probably not worth spending too much more time discussing, and I'm OK either way. I mostly just wanted to raise the issue since dropping patch 3 changes the balance to me.
-Peff