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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0041f09de6
commit
82889295e7
@ -1196,10 +1196,9 @@ void diff_tree_combined(const unsigned char *sha1,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void diff_tree_combined_merge(const unsigned char *sha1,
|
void diff_tree_combined_merge(const struct commit *commit, int dense,
|
||||||
int dense, struct rev_info *rev)
|
struct rev_info *rev)
|
||||||
{
|
{
|
||||||
struct commit *commit = lookup_commit(sha1);
|
|
||||||
struct commit_list *parent = commit->parents;
|
struct commit_list *parent = commit->parents;
|
||||||
struct sha1_array parents = SHA1_ARRAY_INIT;
|
struct sha1_array parents = SHA1_ARRAY_INIT;
|
||||||
|
|
||||||
@ -1207,6 +1206,6 @@ void diff_tree_combined_merge(const unsigned char *sha1,
|
|||||||
sha1_array_append(&parents, parent->item->object.sha1);
|
sha1_array_append(&parents, parent->item->object.sha1);
|
||||||
parent = parent->next;
|
parent = parent->next;
|
||||||
}
|
}
|
||||||
diff_tree_combined(sha1, &parents, dense, rev);
|
diff_tree_combined(commit->object.sha1, &parents, dense, rev);
|
||||||
sha1_array_clear(&parents);
|
sha1_array_clear(&parents);
|
||||||
}
|
}
|
||||||
|
3
diff.h
3
diff.h
@ -13,6 +13,7 @@ struct strbuf;
|
|||||||
struct diff_filespec;
|
struct diff_filespec;
|
||||||
struct userdiff_driver;
|
struct userdiff_driver;
|
||||||
struct sha1_array;
|
struct sha1_array;
|
||||||
|
struct commit;
|
||||||
|
|
||||||
typedef void (*change_fn_t)(struct diff_options *options,
|
typedef void (*change_fn_t)(struct diff_options *options,
|
||||||
unsigned old_mode, unsigned new_mode,
|
unsigned old_mode, unsigned new_mode,
|
||||||
@ -198,7 +199,7 @@ extern void show_combined_diff(struct combine_diff_path *elem, int num_parent,
|
|||||||
|
|
||||||
extern void diff_tree_combined(const unsigned char *sha1, const struct sha1_array *parents, int dense, struct rev_info *rev);
|
extern void diff_tree_combined(const unsigned char *sha1, const struct sha1_array *parents, int dense, struct rev_info *rev);
|
||||||
|
|
||||||
extern void diff_tree_combined_merge(const unsigned char *sha1, int, struct rev_info *);
|
extern void diff_tree_combined_merge(const struct commit *commit, int dense, struct rev_info *rev);
|
||||||
|
|
||||||
void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b);
|
void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b);
|
||||||
|
|
||||||
|
@ -599,9 +599,7 @@ int log_tree_diff_flush(struct rev_info *opt)
|
|||||||
|
|
||||||
static int do_diff_combined(struct rev_info *opt, struct commit *commit)
|
static int do_diff_combined(struct rev_info *opt, struct commit *commit)
|
||||||
{
|
{
|
||||||
unsigned const char *sha1 = commit->object.sha1;
|
diff_tree_combined_merge(commit, opt->dense_combined_merges, opt);
|
||||||
|
|
||||||
diff_tree_combined_merge(sha1, opt->dense_combined_merges, opt);
|
|
||||||
return !opt->loginfo;
|
return !opt->loginfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user