summaryrefslogtreecommitdiff
path: root/xdiff/xemit.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-07-13 05:31:22 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-07-13 05:31:22 (GMT)
commit096b1732343305b7096b1085c23eba8cd83569c7 (patch)
treec50b023920773dbd284d949ee978bd0bee05df94 /xdiff/xemit.c
parente918c6abac65fb56b381f37cc139753fbe6768a3 (diff)
parent0c7993839b92f466278439a724023f8be50391c1 (diff)
downloadgit-096b1732343305b7096b1085c23eba8cd83569c7.zip
git-096b1732343305b7096b1085c23eba8cd83569c7.tar.gz
git-096b1732343305b7096b1085c23eba8cd83569c7.tar.bz2
Merge branch 'lt/merge-tree'
* lt/merge-tree: Improved three-way blob merging code Prepare "git-merge-tree" for future work xdiff: generate "anti-diffs" aka what is common to two files
Diffstat (limited to 'xdiff/xemit.c')
-rw-r--r--xdiff/xemit.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/xdiff/xemit.c b/xdiff/xemit.c
index ad5bfb1..714c563 100644
--- a/xdiff/xemit.c
+++ b/xdiff/xemit.c
@@ -100,6 +100,21 @@ static void xdl_find_func(xdfile_t *xf, long i, char *buf, long sz, long *ll) {
}
+int xdl_emit_common(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
+ xdemitconf_t const *xecfg) {
+ xdfile_t *xdf = &xe->xdf1;
+ const char *rchg = xdf->rchg;
+ long ix;
+
+ for (ix = 0; ix < xdf->nrec; ix++) {
+ if (rchg[ix])
+ continue;
+ if (xdl_emit_record(xdf, ix, "", ecb))
+ return -1;
+ }
+ return 0;
+}
+
int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
xdemitconf_t const *xecfg) {
long s1, s2, e1, e2, lctx;
@@ -107,6 +122,9 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
char funcbuf[40];
long funclen = 0;
+ if (xecfg->flags & XDL_EMIT_COMMON)
+ return xdl_emit_common(xe, xscr, ecb, xecfg);
+
for (xch = xche = xscr; xch; xch = xche->next) {
xche = xdl_get_hunk(xch, xecfg);