aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-06-25 11:20:01 -0700
committerJunio C Hamano <gitster@pobox.com>2008-06-25 11:20:01 -0700
commit4ace4fc584f48d5b8df957c4462cf5c7c58ab100 (patch)
tree4d11d3923324e1b3760e208e5947523041f18f47
parent41cb0fc100c2e00e2978c91d7d0b8b51167c1243 (diff)
parentc86fbe5332abe6b951731940b9a8676ea90a434c (diff)
downloadgit-4ace4fc584f48d5b8df957c4462cf5c7c58ab100.tar.gz
git-4ace4fc584f48d5b8df957c4462cf5c7c58ab100.tar.xz
Merge branch 'jc/maint-combine-diff-pre-context' into maint
* jc/maint-combine-diff-pre-context: diff -c/--cc: do not include uninteresting deletion before leading context
-rw-r--r--combine-diff.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/combine-diff.c b/combine-diff.c
index 588c58bc5..9f80a1c5e 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -84,6 +84,7 @@ struct sline {
/* bit 0 up to (N-1) are on if the parent has this line (i.e.
* we did not change it).
* bit N is used for "interesting" lines, including context.
+ * bit (N+1) is used for "do not show deletion before this".
*/
unsigned long flag;
unsigned long *p_lno;
@@ -308,6 +309,7 @@ static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
{
unsigned long all_mask = (1UL<<num_parent) - 1;
unsigned long mark = (1UL<<num_parent);
+ unsigned long no_pre_delete = (2UL<<num_parent);
unsigned long i;
/* Two groups of interesting lines may have a short gap of
@@ -329,7 +331,7 @@ static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
/* Paint a few lines before the first interesting line. */
while (j < i)
- sline[j++].flag |= mark;
+ sline[j++].flag |= mark | no_pre_delete;
again:
/* we know up to i is to be included. where does the
@@ -502,6 +504,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
int use_color)
{
unsigned long mark = (1UL<<num_parent);
+ unsigned long no_pre_delete = (2UL<<num_parent);
int i;
unsigned long lno = 0;
const char *c_frag = diff_get_color(use_color, DIFF_FRAGINFO);
@@ -581,7 +584,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
int j;
unsigned long p_mask;
sl = &sline[lno++];
- ll = sl->lost_head;
+ ll = (sl->flag & no_pre_delete) ? NULL : sl->lost_head;
while (ll) {
fputs(c_old, stdout);
for (j = 0; j < num_parent; j++) {