diff options
author | Kirill Smelkov <kirr@mns.spb.ru> | 2014-01-20 20:20:38 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-02-24 14:44:57 -0800 |
commit | 1df4320fa25d3784b035936b35725460d46f1ca0 (patch) | |
tree | 074a560e2d628a43fe6b41d4228e6031cdafef66 /diffcore.h | |
parent | 7146e66f0861c720f9b32dc9d80ab80495a33e43 (diff) | |
download | git-1df4320fa25d3784b035936b35725460d46f1ca0.tar.gz |
diffcore-order: export generic ordering interface
diffcore_order() interface only accepts a queue of `struct
diff_filepair`.
In the next patches, we'll want to order `struct combine_diff_path`
by path, so let's first rework diffcore-order to also provide
generic low-level interface for ordering arbitrary objects, provided
they have path accessors.
The new interface is:
- `struct obj_order` for describing objects to ordering routine, and
- order_objects() for actually doing the ordering work.
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore.h')
-rw-r--r-- | diffcore.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/diffcore.h b/diffcore.h index 79de8cf28d..cbe9e62b49 100644 --- a/diffcore.h +++ b/diffcore.h @@ -109,6 +109,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 *); |