aboutsummaryrefslogtreecommitdiffstats
path: root/diff.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-02-03 10:23:33 -0800
committerJunio C Hamano <gitster@pobox.com>2025-02-03 10:23:33 -0800
commitc43136d67b7c6a9ecfa988004eb4a87bfbe957a0 (patch)
treecc4c17eed6328f3baa142c811aec4eec7005e690 /diff.h
parentMerge branch 'tb/unsafe-hash-cleanup' (diff)
parenttree-diff: make list tail-passing more explicit (diff)
downloadgit-c43136d67b7c6a9ecfa988004eb4a87bfbe957a0.tar.gz
git-c43136d67b7c6a9ecfa988004eb4a87bfbe957a0.zip
Merge branch 'jk/combine-diff-cleanup'
Code clean-up for code paths around combined diff. * jk/combine-diff-cleanup: tree-diff: make list tail-passing more explicit tree-diff: simplify emit_path() list management tree-diff: use the name "tail" to refer to list tail tree-diff: drop list-tail argument to diff_tree_paths() combine-diff: drop public declaration of combine_diff_path_size() tree-diff: inline path_appendnew() tree-diff: pass whole path string to path_appendnew() tree-diff: drop path_appendnew() alloc optimization run_diff_files(): de-mystify the size of combine_diff_path struct diff: add a comment about combine_diff_path.parent.path combine-diff: use pointer for parent paths tree-diff: clear parent array in path_appendnew() combine-diff: add combine_diff_path_new() run_diff_files(): delay allocation of combine_diff_path
Diffstat (limited to 'diff.h')
-rw-r--r--diff.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/diff.h b/diff.h
index 6e6007c17b..7831ed1a2b 100644
--- a/diff.h
+++ b/diff.h
@@ -462,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,
@@ -480,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 *);