From: Junio C Hamano Date: Thu, 19 Jun 2008 06:59:41 +0000 (-0700) Subject: diff -c/--cc: do not include uninteresting deletion before leading context X-Git-Tag: v1.5.6.1~3^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c86fbe5332abe6b951731940b9a8676ea90a434c;p=git.git diff -c/--cc: do not include uninteresting deletion before leading context When we include a few uninteresting lines before the interesting ones as context, we are only interested in seeing the surviving lines themselves and not the deleted lines that are before them. Mark the added leading context lines in give_context() and not show deleted lines form them. Signed-off-by: Junio C Hamano --- diff --git a/combine-diff.c b/combine-diff.c index 0e19cbaac..b6af32455 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<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++) {