summaryrefslogtreecommitdiff
path: root/diffcore.h
diff options
context:
space:
mode:
authorKirill Smelkov <kirr@mns.spb.ru>2014-01-20 16:20:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-02-24 22:44:57 (GMT)
commit1df4320fa25d3784b035936b35725460d46f1ca0 (patch)
tree074a560e2d628a43fe6b41d4228e6031cdafef66 /diffcore.h
parent7146e66f0861c720f9b32dc9d80ab80495a33e43 (diff)
downloadgit-1df4320fa25d3784b035936b35725460d46f1ca0.zip
git-1df4320fa25d3784b035936b35725460d46f1ca0.tar.gz
git-1df4320fa25d3784b035936b35725460d46f1ca0.tar.bz2
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.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/diffcore.h b/diffcore.h
index 79de8cf..cbe9e62 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 *);