X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=combine-diff.c;h=aa9d79ea0bf011ea45ef629ef713e6c977781431;hb=2454ac7b9fbc12db5cca8cd388422360528d7d6f;hp=588c58bc55dfe78998d40a4dcce2a7b6ea6f7f5a;hpb=486d1a56443fb19770a7d1abe08f1f4e9e44534d;p=git.git diff --git a/combine-diff.c b/combine-diff.c index 588c58bc5..aa9d79ea0 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++) { @@ -590,7 +605,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent, else putchar(' '); } - printf("%s%s\n", ll->line, c_reset); + show_line_to_eol(ll->line, -1, c_reset); ll = ll->next; } if (cnt < lno) @@ -614,7 +629,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent, putchar(' '); p_mask <<= 1; } - printf("%.*s%s\n", sl->len, sl->bol, c_reset); + show_line_to_eol(sl->bol, sl->len, c_reset); } } } @@ -724,6 +739,18 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, die("early EOF '%s'", elem->path); result[len] = 0; + + /* If not a fake symlink, apply filters, e.g. autocrlf */ + if (is_file) { + struct strbuf buf; + + strbuf_init(&buf, 0); + if (convert_to_git(elem->path, result, len, &buf, safe_crlf)) { + free(result); + result = strbuf_detach(&buf, &len); + result_size = len; + } + } } else { deleted_file: