Re: [PATCH 1/9] Allow callers of unpack_trees() to handle failure
- From
Daniel Barkalow <barkalow@iabervon.org>
- Date
- Feb 5, 2008, 20:38 UTC
- Message-ID
- <alpine.LNX.1.00.0802051428180.13593@iabervon.org>
- In-Reply-To
- <alpine.LSU.1.00.0802050107440.8543@racer.site>
On Tue, 5 Feb 2008, Johannes Schindelin wrote:
Show 9 quoted lines
> Hi, > > On Mon, 4 Feb 2008, Daniel Barkalow wrote: > > > Return an error from unpack_trees() instead of calling die(), and exit > > with an error in read-tree and builtin-commit. > > Technically, there is still a possibility that an xcalloc() fails with a > die(), but I agree that it is a good change.
Right, this is just for the case of the data causing the operation requested to be unsafe or impossible.
> BTW after the whole series (was too lazy to check the individual > patches), I count one instance in builtin-checkout.c and two in diff-lib.c > where unpack_trees()' return value is not checked. Is this intended?
I don't think any of them can fail (a diff really ought not abort due to the things you're comparing being incompatible, and the reset_clean_to_new similarly can't have any conflicts), but it's probably best to check and exit anyway, if only in the conversion commit. (If we remove the check afterward, there will be a change in the history that documents that we don't need to check)
-Daniel *This .sig left intentionally blank*