commit - be6a1b5ad07f0e2c832ce7de6f07c87fbe1935a5
commit + 736b910fe5b9621fef211a1db3e1bbff02626f10
blob - f20a7b76e08833632a4654100261093ffbb7edaa
blob + e9d830ddae7ec0081ab0ac6f89dc5db4ee284958
--- tog/tog.c
+++ tog/tog.c
struct commit_queue_entry *entry, struct got_repository *repo)
{
const struct got_error *err = NULL;
- struct got_object *obj = NULL;
struct got_commit_object *commit;
struct got_object_id *id;
struct got_object_qid *qid;
qid = SIMPLEQ_FIRST(&entry->commit->parent_ids);
if (qid == NULL)
return NULL;
- err = got_object_open(&obj, repo, qid->id);
- if (err)
- return err;
- if (got_object_get_type(obj) != GOT_OBJ_TYPE_COMMIT) {
- err = got_error(GOT_ERR_OBJ_TYPE);
- got_object_close(obj);
- return err;
- }
-
- err = got_object_commit_open(&commit, repo, obj);
- got_object_close(obj);
+
+ err = got_object_open_as_commit(&commit, repo, qid->id);
if (err)
return err;
int limit, struct got_repository *repo)
{
const struct got_error *err = NULL;
- struct got_object *first_obj = NULL, *last_obj = NULL;
+ struct got_object *last_obj = NULL;
struct got_commit_object *commit = NULL;
struct got_object_id *id = NULL;
struct commit_queue_entry *entry, *old_head_entry;
*ncommits = 0;
- err = got_object_open(&first_obj, repo, first_id);
+ err = got_object_open_as_commit(&commit, repo, first_id);
if (err)
goto done;
- if (got_object_get_type(first_obj) != GOT_OBJ_TYPE_COMMIT) {
- err = got_error(GOT_ERR_OBJ_TYPE);
- goto done;
- }
+
err = got_object_open(&last_obj, repo, last_id);
if (err)
goto done;
goto done;
}
- err = got_object_commit_open(&commit, repo, first_obj);
- if (err)
- goto done;
-
id = got_object_id_dup(first_id);
if (id == NULL) {
err = got_error_from_errno();
}
done:
- if (first_obj)
- got_object_close(first_obj);
if (last_obj)
got_object_close(last_obj);
return err;