Re: [PATCH 06/19] Change call signature of write_tree_from_memory()
- From
Elijah Newren <newren@gmail.com>
- Date
- Jul 26, 2019, 04:58 UTC
- Message-ID
- <CABPp-BHs47CQ8S72-Wq5SHr-BsBOA5tUcbTeYQupchz6Xi8T4w@mail.gmail.com>
- In-Reply-To
- <nycvar.QRO.7.76.6.1907252153530.21907@tvgsbejvaqbjf.bet>
Hi Dscho,
On Thu, Jul 25, 2019 at 12:55 PM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 23 quoted lines
>
> Hi Elijah,
>
> On Thu, 25 Jul 2019, Elijah Newren wrote:
>
> > diff --git a/merge-recursive.c b/merge-recursive.c
> > index 7f56cb0ed1..1a3c6ab7f3 100644
> > --- a/merge-recursive.c
> > +++ b/merge-recursive.c
> > [...]
> > @@ -434,11 +434,10 @@ struct tree *write_tree_from_memory(struct merge_options *opt)
> >
> > if (!cache_tree_fully_valid(istate->cache_tree) &&
> > cache_tree_update(istate, 0) < 0) {
> > - err(opt, _("error building trees"));
> > - return NULL;
> > + BUG("error building trees");
>
> Hmm. Is it possible that something else than a bug in Git causes this to
> fail?
>
> I wonder, for example, whether a full disk can cause
> `cache_tree_update()` to return a negative value.Yeah, you're right. Based on the conversation with Junio, I think I can modify the write_index_as_tree() function slightly to do what we need, then call it instead of write_tree_from_memory(). Since write_index_as_tree() doesn't try to output any error messages but just returns various error codes, I can then have the caller handle the output. So I'll do that instead of this patch and the previous one.