diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-08-29 08:16:30 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-30 19:41:43 -0700 |
commit | 838338cd22c1df53c1460d9239780371a234b242 (patch) | |
tree | 09e9ce2e167f0c89cd77bd6ba86533fd5f18f66f /xdiff | |
parent | e0af48e49682ea3345f932f6b9e7fa7c5e5e611a (diff) | |
download | git-838338cd22c1df53c1460d9239780371a234b242.tar.gz |
xmerge.c: minimum readability fixups
This replaces hardcoded magic constants with symbolic ones for
readability, and swaps one if/else blocks to better match the
order in which 0/1/2 variables are handled to nearby codepath.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff')
-rw-r--r-- | xdiff/xmerge.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c index 29cdbea1ee..7dcd4055ae 100644 --- a/xdiff/xmerge.c +++ b/xdiff/xmerge.c @@ -427,7 +427,7 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1, xscr2 = xscr2->next; continue; } - if (level < 1 || xscr1->i1 != xscr2->i1 || + if (level == XDL_MERGE_MINIMAL || xscr1->i1 != xscr2->i1 || xscr1->chg1 != xscr2->chg1 || xscr1->chg2 != xscr2->chg2 || xdl_merge_cmp_lines(xe1, xscr1->i2, @@ -449,12 +449,11 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1, chg0 = xscr1->i1 + xscr1->chg1 - i0; chg1 = xscr1->i2 + xscr1->chg2 - i1; chg2 = xscr2->i2 + xscr2->chg2 - i2; - if (ffo > 0) - chg2 += ffo; - else { + if (ffo < 0) { chg0 -= ffo; chg1 -= ffo; - } + } else + chg2 += ffo; if (xdl_append_merge(&c, 0, i0, chg0, i1, chg1, i2, chg2)) { xdl_cleanup_merge(changes); @@ -505,9 +504,10 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1, if (!changes) changes = c; /* refine conflicts */ - if (level > 1 && + if (XDL_MERGE_ZEALOUS <= level && (xdl_refine_conflicts(xe1, xe2, changes, xpp) < 0 || - xdl_simplify_non_conflicts(xe1, changes, level > 2) < 0)) { + xdl_simplify_non_conflicts(xe1, changes, + XDL_MERGE_ZEALOUS < level) < 0)) { xdl_cleanup_merge(changes); return -1; } |