X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-rerere.c;h=29d057c98cc255e718df540a62177101d9789abe;hb=154c7d0759b6885034bffa7a34d464d703fc8bb3;hp=3196151cc4be4b6fdf6e19735ef26471fc68940f;hpb=0707a9d6f200bbafc02d13dd7f2c12bb795999f6;p=git.git diff --git a/builtin-rerere.c b/builtin-rerere.c index 3196151cc..29d057c98 100644 --- a/builtin-rerere.c +++ b/builtin-rerere.c @@ -1,3 +1,4 @@ +#include "builtin.h" #include "cache.h" #include "path-list.h" #include "xdiff/xdiff.h" @@ -168,19 +169,16 @@ static int find_conflict(struct path_list *conflict) int i; if (read_cache() < 0) return error("Could not read index"); - for (i = 0; i + 2 < active_nr; i++) { - struct cache_entry *e1 = active_cache[i]; - struct cache_entry *e2 = active_cache[i+1]; - struct cache_entry *e3 = active_cache[i+2]; - if (ce_stage(e1) == 1 && - ce_stage(e2) == 2 && + for (i = 0; i+1 < active_nr; i++) { + struct cache_entry *e2 = active_cache[i]; + struct cache_entry *e3 = active_cache[i+1]; + if (ce_stage(e2) == 2 && ce_stage(e3) == 3 && - ce_same_name(e1, e2) && ce_same_name(e1, e3) && - S_ISREG(ntohl(e1->ce_mode)) && + ce_same_name(e2, e3) && S_ISREG(ntohl(e2->ce_mode)) && S_ISREG(ntohl(e3->ce_mode))) { - path_list_insert((const char *)e1->name, conflict); - i += 2; + path_list_insert((const char *)e2->name, conflict); + i++; /* skip over both #2 and #3 */ } } return 0; @@ -285,8 +283,8 @@ static int diff_two(const char *file1, const char *label1, printf("--- a/%s\n+++ b/%s\n", label1, label2); fflush(stdout); xpp.flags = XDF_NEED_MINIMAL; + memset(&xecfg, 0, sizeof(xecfg)); xecfg.ctxlen = 3; - xecfg.flags = 0; ecb.outf = outf; xdl_diff(&minus, &plus, &xpp, &xecfg, &ecb);