Re: Lines missing from git diff-tree -p -c output?
- From
Matthijs Kooijman <matthijs@stdin.nl>
- Date
- May 15, 2013, 15:46 UTC
- Message-ID
- <20130515154638.GQ25742@login.drsnuggles.stderr.nl>
- In-Reply-To
- <20130515143508.GO25742@login.drsnuggles.stderr.nl>
Hi folks,
Show 14 quoted lines
> $ git diff-tree -p -c HEAD > d945a51b6ca22e6e8e550c53980d026f11b05158 > diff --combined file > index 3404f54,0eab113..e8c8c18 > --- a/file > +++ b/file > @@@ -1,7 -1,5 +1,6 @@@ > +LEFT > BASE2 > BASE3 > BASE4 > - BASE5 > + BASE5MODIFIED > BASE6
I found the spot in the code where this is going wrong, there is an incorrectly set "no_pre_delete" flag for the context lines before each hunk. Since a patch says more than a thousand words, here's what I think will fix this problem:
diff --git a/combine-diff.c b/combine-diff.c index 77d7872..d36bfcf 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -518,8 +518,11 @@ static int give_context(struct sline *sline, unsigned long cnt, int num_parent) unsigned long k; /* Paint a few lines before the first interesting line. */ - while (j < i) - sline[j++].flag |= mark | no_pre_delete; + while (j < i) { + if (!(sline[j++].flag & mark)) + sline[j++].flag |= no_pre_delete; + sline[j++].flag |= mark; + } again: /* we know up to i is to be included. where does the I'll see if I can write up a testcase and then submit this as a proper patch, but I wanted to at least send this over now lest someone wastes time coming to the same conclusion as I did. Gr. Matthijs