Re: [PATCH 2/2] config: die when --blob is used outside a repository
- From
Taylor Blau <me@ttaylorr.com>
- Date
- May 18, 2018, 22:31 UTC
- Message-ID
- <20180518223134.GA56823@syl.local>
- In-Reply-To
- <20180518222704.GB9623@sigill.intra.peff.net>
On Fri, May 18, 2018 at 03:27:04PM -0700, Jeff King wrote:
> If you run "config --blob" outside of a repository, then we > eventually try to resolve the blob name and hit a BUG(). > Let's catch this earlier and provide a useful message.
I think that this approach is sensible. Let's (1) fix a SIGSEGV that should be a BUG(), and (2) make sure that we never get there in the first place.
This looks fine to me.
Show 8 quoted lines
> Note that we could also catch this much lower in the stack, > in git_config_from_blob_ref(). That might cover other > callsites, too, but it's unclear whether those ones would > actually be bugs or not. So let's leave the low-level > functions to assume the caller knows what it's doing (and > BUG() if it turns out it doesn't). > > Signed-off-by: Jeff King <peff@peff.net>
Thanks, Taylor