commit - 5e54fb308c7ad735d944068c063de6ac5276b93a
commit + 1de5e06571b18a9888f0e659ef6f91b82d5c0c42
blob - e2adb32c5a3b01901892c591b614ba36ebf26127
blob + 1c51bb9a08762148d3c8c698a7b64c5e7101546c
--- lib/diff.c
+++ lib/diff.c
free(change);
}
free(changes);
-}
-
-static struct got_tree_entry *
-match_entry_by_name(struct got_tree_entry *te1, struct got_tree_object *tree2)
-{
- struct got_tree_entry *te2;
- const struct got_tree_entries *entries2;
-
- entries2 = got_object_tree_get_entries(tree2);
- SIMPLEQ_FOREACH(te2, &entries2->head, entry) {
- if (strcmp(te1->name, te2->name) == 0)
- return te2;
- }
- return NULL;
}
static const struct got_error *
}
static const struct got_error *
-diff_entry_old_new(struct got_tree_entry *te1, struct got_tree_entry *te2,
- const char *label1, const char *label2, int diff_context,
- struct got_repository *repo, FILE *outfile)
+diff_entry_old_new(const struct got_tree_entry *te1,
+ const struct got_tree_entry *te2, const char *label1, const char *label2,
+ int diff_context, struct got_repository *repo, FILE *outfile)
{
const struct got_error *err = NULL;
int id_match;
}
static const struct got_error *
-diff_entry_new_old(struct got_tree_entry *te2, struct got_tree_entry *te1,
- const char *label2, int diff_context, struct got_repository *repo,
- FILE *outfile)
+diff_entry_new_old(const struct got_tree_entry *te2,
+ const struct got_tree_entry *te1, const char *label2, int diff_context,
+ struct got_repository *repo, FILE *outfile)
{
if (te1 != NULL) /* handled by diff_entry_old_new() */
return NULL;
do {
if (te1) {
- struct got_tree_entry *te = NULL;
+ const struct got_tree_entry *te = NULL;
if (tree2)
- te = match_entry_by_name(te1, tree2);
+ te = got_object_tree_find_entry(tree2,
+ te1->name);
if (te) {
free(l2);
l2 = NULL;
}
if (te2) {
- struct got_tree_entry *te = NULL;
+ const struct got_tree_entry *te = NULL;
if (tree1)
- te = match_entry_by_name(te2, tree1);
+ te = got_object_tree_find_entry(tree1,
+ te2->name);
free(l2);
if (te) {
if (asprintf(&l2, "%s%s%s", label2,