diff options
Diffstat (limited to 'diff.h')
| -rw-r--r-- | diff.h | 32 |
1 files changed, 19 insertions, 13 deletions
@@ -4,7 +4,7 @@ #ifndef DIFF_H #define DIFF_H -#include "hash-ll.h" +#include "hash.h" #include "pathspec.h" #include "strbuf.h" @@ -94,7 +94,7 @@ typedef void (*add_remove_fn_t)(struct diff_options *options, typedef void (*diff_format_fn_t)(struct diff_queue_struct *q, struct diff_options *options, void *data); -typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data); +typedef const char *(*diff_prefix_fn_t)(struct diff_options *opt, void *data); #define DIFF_FORMAT_RAW 0x0001 #define DIFF_FORMAT_DIFFSTAT 0x0002 @@ -205,9 +205,8 @@ static inline void diff_flags_or(struct diff_flags *a, { char *tmp_a = (char *)a; const char *tmp_b = (const char *)b; - int i; - for (i = 0; i < sizeof(struct diff_flags); i++) + for (size_t i = 0; i < sizeof(struct diff_flags); i++) tmp_a[i] |= tmp_b[i]; } @@ -235,7 +234,7 @@ enum diff_submodule_format { * diffcore library with. */ struct diff_options { - const char *orderfile; + char *orderfile; /* * "--rotate-to=<file>" would start showing at <file> and when @@ -274,7 +273,6 @@ struct diff_options { const char *single_follow; const char *a_prefix, *b_prefix; const char *line_prefix; - size_t line_prefix_length; /** * collection of boolean options that affects the operation, but some do @@ -464,7 +462,7 @@ const char *diff_line_prefix(struct diff_options *); extern const char mime_boundary_leader[]; struct combine_diff_path *diff_tree_paths( - struct combine_diff_path *p, const struct object_id *oid, + const struct object_id *oid, const struct object_id **parents_oid, int nparent, struct strbuf *base, struct diff_options *opt); void diff_tree_oid(const struct object_id *old_oid, @@ -482,12 +480,20 @@ struct combine_diff_path { char status; unsigned int mode; struct object_id oid; - struct strbuf path; + /* + * This per-parent path is filled only when doing a combined + * diff with revs.combined_all_paths set, and only if the path + * differs from the post-image (e.g., a rename or copy). + * Otherwise it is left NULL. + */ + char *path; } parent[FLEX_ARRAY]; }; -#define combine_diff_path_size(n, l) \ - st_add4(sizeof(struct combine_diff_path), (l), 1, \ - st_mult(sizeof(struct combine_diff_parent), (n))) +struct combine_diff_path *combine_diff_path_new(const char *path, + size_t path_len, + unsigned int mode, + const struct object_id *oid, + size_t num_parents); void show_combined_diff(struct combine_diff_path *elem, int num_parent, struct rev_info *); @@ -646,9 +652,9 @@ void run_diff_index(struct rev_info *revs, unsigned int option); int do_diff_cache(const struct object_id *, struct diff_options *); int diff_flush_patch_id(struct diff_options *, struct object_id *, int); -void flush_one_hunk(struct object_id *result, git_hash_ctx *ctx); +void flush_one_hunk(struct object_id *result, struct git_hash_ctx *ctx); -int diff_result_code(struct diff_options *); +int diff_result_code(struct rev_info *); int diff_no_index(struct rev_info *, int implicit_no_index, int, const char **); |
