commit - 80f4db877f17489d336a0a87b79e2fed2bf1567f
commit + 9fe0899b90726c84f4aa0837580eccef58e48631
blob - e2326392e5c40d180f4f231973f5e38f672ac161
blob + be366266e526e26c8734719d20d29ed05d463b06
--- tog/tog.c
+++ tog/tog.c
int obj_type;
struct got_diff_line *lines = NULL;
struct got_pathlist_head changed_paths;
+ struct got_commit_object *commit2 = NULL;
TAILQ_INIT(&changed_paths);
case GOT_OBJ_TYPE_COMMIT: {
const struct got_object_id_queue *parent_ids;
struct got_object_qid *pid;
- struct got_commit_object *commit2;
struct got_reflist_head *refs;
size_t nlines = 0;
struct got_diffstat_cb_arg dsa = {
if (err)
break;
- err = got_object_open_as_commit(&commit2, s->repo, s->id2);
- if (err)
- goto done;
refs = got_reflist_object_id_map_lookup(tog_refs_idmap, s->id2);
/* Show commit info if we're diffing to a parent/root commit. */
if (s->id1 == NULL) {
if (err)
goto done;
} else {
+ err = got_object_open_as_commit(&commit2, s->repo,
+ s->id2);
+ if (err)
+ goto done;
+
parent_ids = got_object_commit_get_parent_ids(commit2);
STAILQ_FOREACH(pid, parent_ids, entry) {
if (got_object_id_cmp(s->id1, &pid->id) == 0) {
}
}
}
- got_object_commit_close(commit2);
err = cat_diff(s->f, tmp_diff_file, &s->lines, &s->nlines,
lines, nlines);
}
done:
free(lines);
+ if (commit2 != NULL)
+ got_object_commit_close(commit2);
got_pathlist_free(&changed_paths, GOT_PATHLIST_FREE_ALL);
if (s->f && fflush(s->f) != 0 && err == NULL)
err = got_error_from_errno("fflush");