From: Junio C Hamano Date: Wed, 5 Mar 2014 23:06:26 +0000 (-0800) Subject: Merge branch 'ks/combine-diff' X-Git-Tag: v2.0.0-rc0~146 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6376463c37e0371a411013b90b2e8fc0f7d27dfa?ds=inline;hp=-c Merge branch 'ks/combine-diff' Teach combine-diff to honour the path-output-order imposed by diffcore-order, and optimize how matching paths are found in the N-way diffs made with parents. * ks/combine-diff: tests: add checking that combine-diff emits only correct paths combine-diff: simplify intersect_paths() further combine-diff: combine_diff_path.len is not needed anymore combine-diff: optimize combine_diff_path sets intersection diff test: add tests for combine-diff with orderfile diffcore-order: export generic ordering interface --- 6376463c37e0371a411013b90b2e8fc0f7d27dfa diff --combined diff-lib.c index 2eddc66bbd,bf624e7716..ec5f722eff --- a/diff-lib.c +++ b/diff-lib.c @@@ -11,7 -11,6 +11,7 @@@ #include "unpack-trees.h" #include "refs.h" #include "submodule.h" +#include "dir.h" /* * diff-files @@@ -109,7 -108,7 +109,7 @@@ int run_diff_files(struct rev_info *rev if (diff_can_quit_early(&revs->diffopt)) break; - if (!ce_path_match(ce, &revs->prune_data)) + if (!ce_path_match(ce, &revs->prune_data, NULL)) continue; if (ce_stage(ce)) { @@@ -125,7 -124,6 +125,6 @@@ dpath->path = (char *) &(dpath->parent[5]); dpath->next = NULL; - dpath->len = path_len; memcpy(dpath->path, ce->name, path_len); dpath->path[path_len] = '\0'; hashclr(dpath->sha1); @@@ -327,7 -325,6 +326,6 @@@ static int show_modified(struct rev_inf p = xmalloc(combine_diff_path_size(2, pathlen)); p->path = (char *) &p->parent[2]; p->next = NULL; - p->len = pathlen; memcpy(p->path, new->name, pathlen); p->path[pathlen] = 0; p->mode = mode; @@@ -439,7 -436,7 +437,7 @@@ static int oneway_diff(const struct cac if (tree == o->df_conflict_entry) tree = NULL; - if (ce_path_match(idx ? idx : tree, &revs->prune_data)) { + if (ce_path_match(idx ? idx : tree, &revs->prune_data, NULL)) { do_oneway_diff(o, idx, tree); if (diff_can_quit_early(&revs->diffopt)) { o->exiting_early = 1; diff --combined diffcore.h index 1315cfd4ef,cbe9e62b49..92788ee4de --- a/diffcore.h +++ b/diffcore.h @@@ -68,8 -68,6 +68,8 @@@ struct diff_filepair unsigned broken_pair : 1; unsigned renamed_pair : 1; unsigned is_unmerged : 1; + unsigned done_skip_stat_unmatch : 1; + unsigned skip_stat_unmatch_result : 1; }; #define DIFF_PAIR_UNMERGED(p) ((p)->is_unmerged) @@@ -111,6 -109,20 +111,20 @@@ extern void diffcore_merge_broken(void) extern void diffcore_pickaxe(struct diff_options *); extern void diffcore_order(const char *orderfile); + /* low-level interface to diffcore_order */ + struct obj_order { + void *obj; /* setup by caller */ + + /* setup/used by order_objects() */ + int orig_order; + int order; + }; + + typedef const char *(*obj_path_fn_t)(void *obj); + + void order_objects(const char *orderfile, obj_path_fn_t obj_path, + struct obj_order *objs, int nr); + #define DIFF_DEBUG 0 #if DIFF_DEBUG void diff_debug_filespec(struct diff_filespec *, int, const char *);