diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh index cdc02af51..424b034e3 100755 --- a/git-merge-one-file.sh +++ b/git-merge-one-file.sh @@ -120,8 +120,7 @@ case "${1:-.}${2:-.}${3:-.}" in case "$1" in '') echo "Added $4 in both, but differently." - orig=$(git-unpack-file $2) - create_virtual_base "$orig" "$src2" + orig=$(git-unpack-file e69de29bb2d1d6434b8b29ae775ad8c2e48c5391) ;; *) echo "Auto-merging $4" diff --git a/merge-blobs.c b/merge-blobs.c index ddca601c7..9b6eac22e 100644 --- a/merge-blobs.c +++ b/merge-blobs.c @@ -48,40 +48,6 @@ static void *three_way_filemerge(const char *path, mmfile_t *base, mmfile_t *our return res.ptr; } -static int common_outf(void *priv_, mmbuffer_t *mb, int nbuf) -{ - int i; - mmfile_t *dst = priv_; - - for (i = 0; i < nbuf; i++) { - memcpy(dst->ptr + dst->size, mb[i].ptr, mb[i].size); - dst->size += mb[i].size; - } - return 0; -} - -static int generate_common_file(mmfile_t *res, mmfile_t *f1, mmfile_t *f2) -{ - unsigned long size = f1->size < f2->size ? f1->size : f2->size; - void *ptr = xmalloc(size); - xpparam_t xpp; - xdemitconf_t xecfg; - xdemitcb_t ecb; - - memset(&xpp, 0, sizeof(xpp)); - xpp.flags = 0; - memset(&xecfg, 0, sizeof(xecfg)); - xecfg.ctxlen = 3; - xecfg.flags = XDL_EMIT_COMMON; - ecb.outf = common_outf; - - res->ptr = ptr; - res->size = 0; - - ecb.priv = res; - return xdi_diff(f1, f2, &xpp, &xecfg, &ecb); -} - void *merge_blobs(const char *path, struct blob *base, struct blob *our, struct blob *their, unsigned long *size) { void *res = NULL; @@ -112,8 +78,8 @@ void *merge_blobs(const char *path, struct blob *base, struct blob *our, struct if (fill_mmfile_blob(&common, base) < 0) goto out_free_f2_f1; } else { - if (generate_common_file(&common, &f1, &f2) < 0) - goto out_free_f2_f1; + common.ptr = xstrdup(""); + common.size = 0; } res = three_way_filemerge(path, &common, &f1, &f2, size); free_mmfile(&common); diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h index c0339919c..4fb7e7941 100644 --- a/xdiff/xdiff.h +++ b/xdiff/xdiff.h @@ -42,7 +42,6 @@ extern "C" { #define XDF_IGNORE_BLANK_LINES (1 << 7) #define XDL_EMIT_FUNCNAMES (1 << 0) -#define XDL_EMIT_COMMON (1 << 1) #define XDL_EMIT_FUNCCONTEXT (1 << 2) #define XDL_MMB_READONLY (1 << 0) diff --git a/xdiff/xemit.c b/xdiff/xemit.c index 4266ada23..993724b11 100644 --- a/xdiff/xemit.c +++ b/xdiff/xemit.c @@ -120,21 +120,6 @@ static long def_ff(const char *rec, long len, char *buf, long sz, void *priv) return -1; } -static int xdl_emit_common(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb, - xdemitconf_t const *xecfg) { - xdfile_t *xdf = &xe->xdf2; - 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; -} - struct func_line { long len; char buf[80]; @@ -170,9 +155,6 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb, long funclineprev = -1; struct func_line func_line = { 0 }; - if (xecfg->flags & XDL_EMIT_COMMON) - return xdl_emit_common(xe, xscr, ecb, xecfg); - for (xch = xscr; xch; xch = xche->next) { xche = xdl_get_hunk(&xch, xecfg); if (!xch)