ref-filter: modify "%(objectname:short)" to take length
[gitweb.git] / diffcore.h
index 1315cfd4ef0fbe0aeb0cae9a14bf09fd53212124..623024135478088028cd42b8c6a744ebb04bf0a7 100644 (file)
@@ -25,7 +25,7 @@
 struct userdiff_driver;
 
 struct diff_filespec {
-       unsigned char sha1[20];
+       struct object_id oid;
        char *path;
        void *data;
        void *cnt_data;
@@ -33,7 +33,7 @@ struct diff_filespec {
        int count;               /* Reference count */
        int rename_used;         /* Count of rename users */
        unsigned short mode;     /* file mode */
-       unsigned sha1_valid : 1; /* if true, use sha1 and trust mode;
+       unsigned oid_valid : 1;  /* if true, use oid and trust mode;
                                  * if false, use the name and read from
                                  * the filesystem.
                                  */
@@ -46,7 +46,7 @@ struct diff_filespec {
        unsigned is_stdin : 1;
        unsigned has_more_entries : 1; /* only appear in combined diff */
        /* data should be considered "binary"; -1 means "don't know yet" */
-       int is_binary : 2;
+       signed int is_binary : 2;
        struct userdiff_driver *driver;
 };
 
@@ -55,7 +55,9 @@ extern void free_filespec(struct diff_filespec *);
 extern void fill_filespec(struct diff_filespec *, const unsigned char *,
                          int, unsigned short);
 
-extern int diff_populate_filespec(struct diff_filespec *, int);
+#define CHECK_SIZE_ONLY 1
+#define CHECK_BINARY    2
+extern int diff_populate_filespec(struct diff_filespec *, unsigned int);
 extern void diff_free_filespec_data(struct diff_filespec *);
 extern void diff_free_filespec_blob(struct diff_filespec *);
 extern int diff_filespec_is_binary(struct diff_filespec *);
@@ -111,6 +113,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 *);
@@ -126,7 +142,6 @@ extern int diffcore_count_changes(struct diff_filespec *src,
                                  struct diff_filespec *dst,
                                  void **src_count_p,
                                  void **dst_count_p,
-                                 unsigned long delta_limit,
                                  unsigned long *src_copied,
                                  unsigned long *literal_added);