From: Matthijs Kooijman <matthijs@stdin.nl>
To: git@vger.kernel.org
Subject: Re: Lines missing from git diff-tree -p -c output?
Date: Wed, 15 May 2013 17:46:38 +0200 [thread overview]
Message-ID: <20130515154638.GQ25742@login.drsnuggles.stderr.nl> (raw)
In-Reply-To: <20130515143508.GO25742@login.drsnuggles.stderr.nl>
Hi folks,
> $ 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
next prev parent reply other threads:[~2013-05-15 15:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 14:35 Lines missing from git diff-tree -p -c output? Matthijs Kooijman
2013-05-15 15:46 ` Matthijs Kooijman [this message]
2013-05-15 17:17 ` Junio C Hamano
2013-05-15 17:33 ` Matthijs Kooijman
2013-05-15 17:42 ` [PATCH] combine-diff.c: Fix output when changes are exactly 3 lines apart Matthijs Kooijman
2013-05-15 17:48 ` Lines missing from git diff-tree -p -c output? Junio C Hamano
2013-05-15 18:17 ` Matthijs Kooijman
2013-05-15 19:13 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130515154638.GQ25742@login.drsnuggles.stderr.nl \
--to=matthijs@stdin.nl \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).