commit 19ae6da15b9c1e2c10f4c66f2b654813419eb9cf from: Stefan Sperling date: Mon Nov 05 15:38:08 2018 UTC compare object IDs just once in diff_entry_old_new() commit - 9185b86391a5c4ff9989ab6755b815050869848c commit + 19ae6da15b9c1e2c10f4c66f2b654813419eb9cf blob - 23f25d0554bd5167a5ef0b5b6cb58e05f4c57cd1 blob + f25183814363b9d6c4c7e087e898de3d6e9d18a1 --- lib/diff.c +++ lib/diff.c @@ -393,6 +393,7 @@ diff_entry_old_new(struct got_tree_entry *te1, struct struct got_repository *repo, FILE *outfile) { const struct got_error *err = NULL; + int id_match; if (te2 == NULL) { if (S_ISDIR(te1->mode)) @@ -404,17 +405,18 @@ diff_entry_old_new(struct got_tree_entry *te1, struct return err; } + id_match = (got_object_id_cmp(te1->id, te2->id) == 0); if (S_ISDIR(te1->mode) && S_ISDIR(te2->mode)) { - if (got_object_id_cmp(te1->id, te2->id) != 0) + if (!id_match) return diff_modified_tree(te1->id, te2->id, label1, label2, diff_context, repo, outfile); } else if (S_ISREG(te1->mode) && S_ISREG(te2->mode)) { - if (got_object_id_cmp(te1->id, te2->id) != 0) + if (!id_match) return diff_modified_blob(te1->id, te2->id, label1, label2, diff_context, repo, outfile); } - if (got_object_id_cmp(te1->id, te2->id) == 0) + if (id_match) return NULL; return diff_kind_mismatch(te1->id, te2->id, label1, label2, outfile);