[PATCH 0/2] diff-lib relative-path cleanups

Jeff King <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
On Wed, Jul 15, 2026 at 08:17:06AM -0700, Junio C Hamano wrote:

> Jeff King <[email protected]> writes:
> 
> > A diff using --relative ignores entries outside the current directory.
> > This results in a segfault when we try to process an unmerged entry
> > that's outside of our prefix, since we end up with a NULL diff_filepair
> > and use it without checking that it's valid.
> > ...
> > +cc Junio, as you may have some wisdom on that further exploration.
> 
> Will take a look at the history myself, but I would probably not
> have much wisdom on a change from 2011.  I often do not even
> remember what I ate for breakfast yesterday ;-).

I have the same problem. ;)

Looks like you reviewed the patch in question already. Here's what I
uncovered by digging into the history. I don't think it should have any
functional difference (and even the "avoid unnecessary work" in patch 2
is probably not very much work in practice), but it might be worth
doing.

This would go on top (even though patch 2 makes the original fix here
unnecessary, I'd rather have both in place).

  [1/2]: diff-lib: drop stale comment about advancing o->pos
  [2/2]: diff-lib: skip paths outside prefix in oneway_diff()

 diff-lib.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

-Peff
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.