Re: [PATCH] xdiff: implement a zealous diff3
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 15, 2021, 02:07 UTC
- Message-ID
- <xmqq7divzxrr.fsf@gitster.g>
- In-Reply-To
- <60c677a2c2d24_f5651208cf@natae.notmuch>
Felipe Contreras <felipe.contreras@gmail.com> writes:
> I found the problem, m->chg0 was not initialized in xdl_refine_conflicts. > > I'm not familiar with the area so I don't know if the following makes > sense, but it fixes the crash:
Unlike the remainder of the xdiff/ directory, xdiff/xmerge.c was Dscho's brainchild if I am not mistaken, so I'm CCing him for input.
Show 20 quoted lines
> --- a/xdiff/xmerge.c > +++ b/xdiff/xmerge.c > @@ -333,7 +333,7 @@ static int xdl_refine_conflicts(xdfenv_t *xe1, xdfenv_t *xe2, xdmerge_t *m, > mmfile_t t1, t2; > xdfenv_t xe; > xdchange_t *xscr, *x; > - int i1 = m->i1, i2 = m->i2; > + int i0 = m->i0, i1 = m->i1, i2 = m->i2; > > /* let's handle just the conflicts */ > if (m->mode) > @@ -384,6 +384,8 @@ static int xdl_refine_conflicts(xdfenv_t *xe1, xdfenv_t *xe2, xdmerge_t *m, > m->next = m2; > m = m2; > m->mode = 0; > + m->i0 = i0; > + m->chg0 = 0; > m->i1 = xscr->i1 + i1; > m->chg1 = xscr->chg1; > m->i2 = xscr->i2 + i2;