Skip to content

Commit 8288929

Browse files
René Scharfegitster
René Scharfe
authored andcommitted
pass struct commit to diff_tree_combined_merge()
Instead of passing the hash of a commit and then searching that same commit in the single caller, simply pass the commit directly. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0041f09 commit 8288929

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

combine-diff.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,17 +1196,16 @@ void diff_tree_combined(const unsigned char *sha1,
11961196
}
11971197
}
11981198

1199-
void diff_tree_combined_merge(const unsigned char *sha1,
1200-
int dense, struct rev_info *rev)
1199+
void diff_tree_combined_merge(const struct commit *commit, int dense,
1200+
struct rev_info *rev)
12011201
{
1202-
struct commit *commit = lookup_commit(sha1);
12031202
struct commit_list *parent = commit->parents;
12041203
struct sha1_array parents = SHA1_ARRAY_INIT;
12051204

12061205
while (parent) {
12071206
sha1_array_append(&parents, parent->item->object.sha1);
12081207
parent = parent->next;
12091208
}
1210-
diff_tree_combined(sha1, &parents, dense, rev);
1209+
diff_tree_combined(commit->object.sha1, &parents, dense, rev);
12111210
sha1_array_clear(&parents);
12121211
}

diff.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ struct strbuf;
1313
struct diff_filespec;
1414
struct userdiff_driver;
1515
struct sha1_array;
16+
struct commit;
1617

1718
typedef void (*change_fn_t)(struct diff_options *options,
1819
unsigned old_mode, unsigned new_mode,
@@ -198,7 +199,7 @@ extern void show_combined_diff(struct combine_diff_path *elem, int num_parent,
198199

199200
extern void diff_tree_combined(const unsigned char *sha1, const struct sha1_array *parents, int dense, struct rev_info *rev);
200201

201-
extern void diff_tree_combined_merge(const unsigned char *sha1, int, struct rev_info *);
202+
extern void diff_tree_combined_merge(const struct commit *commit, int dense, struct rev_info *rev);
202203

203204
void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b);
204205

log-tree.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,7 @@ int log_tree_diff_flush(struct rev_info *opt)
599599

600600
static int do_diff_combined(struct rev_info *opt, struct commit *commit)
601601
{
602-
unsigned const char *sha1 = commit->object.sha1;
603-
604-
diff_tree_combined_merge(sha1, opt->dense_combined_merges, opt);
602+
diff_tree_combined_merge(commit, opt->dense_combined_merges, opt);
605603
return !opt->loginfo;
606604
}
607605

0 commit comments

Comments
 (0)