Subject: Re: [PATCH v3 1/7] path-walk: introduce an object walk by path

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 27 Dec 2024 15:18:28 +0100

On Wed, Dec 18, 2024 at 09:21:25AM -0500, Derrick Stolee wrote:
> On 12/13/24 6:58 AM, Patrick Steinhardt wrote:
> > On Fri, Dec 06, 2024 at 07:45:52PM +0000, Derrick Stolee via GitGitGadget wrote:
> 
> > > +	} else if (parse_tree_gently(tree, 1)) {
> > > +		die("bad tree object %s", oid_to_hex(oid));
> > 
> > I wonder whether we maybe shouldn't die but instead return an error in
> > the spirit of libification.
> 
> This is in fact something that is being tested when 'git pack-objects' has
> the --path-walk feature. See "get an error for missing tree object" in
> t5317 as an example.
> 
> It's not enough to fail, but we need to fail with this error message.
> 
> Has there been enough progress in the libification effort to establish a
> pattern for returning an error message like "bad tree object %s" from an
> API like this to the caller?
> 
> I will try using a "error(); return -1;" and consider that as the best
> option for right now.

Yeah, I think this is best practice for now where we don't have a
superior mechanism like structured errors.

Patrick