combine-diff.c: Fix output when changes are exactly 3 lines apart
[gitweb.git] / combine-diff.c
index bb1cc96c4e73c90ee327858aa3b36cf2bfe043a4..87a668319b37f75a4b9161ae8e88d2e63be64ced 100644 (file)
@@ -344,8 +344,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