include the relevant object ID in NO_OBJ error messages where possible
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
diff --git a/lib/object_idset.c b/lib/object_idset.c
index 510b59e..9c29655 100644
--- a/lib/object_idset.c
+++ b/lib/object_idset.c
@@ -150,7 +150,7 @@ got_object_idset_remove(void **data, struct got_object_idset *set,
else
entry = find_element(set, id);
if (entry == NULL)
- return got_error(GOT_ERR_NO_OBJ);
+ return got_error_no_obj(id);
RB_REMOVE(got_object_idset_tree, &set->entries, entry);
if (data)
diff --git a/lib/repository.c b/lib/repository.c
index 82d26fe..7531c15 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -1432,7 +1432,7 @@ got_repo_object_match_tag(struct got_tag_object **tag, const char *name,
got_ref_list_free(&refs);
if (err == NULL && *tag == NULL)
- err = got_error(GOT_ERR_NO_OBJ);
+ err = got_error_path(name, GOT_ERR_NO_OBJ);
return err;
}
diff --git a/libexec/got-read-pack/got-read-pack.c b/libexec/got-read-pack/got-read-pack.c
index b66f606..599d059 100644
--- a/libexec/got-read-pack/got-read-pack.c
+++ b/libexec/got-read-pack/got-read-pack.c
@@ -497,13 +497,13 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_t **buf2,
struct got_object_id id1, id2;
int idx;
+ memcpy(id1.sha1, pte1->id, SHA1_DIGEST_LENGTH);
idx = got_packidx_get_object_idx_sha1(packidx,
pte1->id);
if (idx == -1) {
- err = got_error(GOT_ERR_NO_OBJ);
+ err = got_error_no_obj(&id1);
break;
}
- memcpy(id1.sha1, pte1->id, SHA1_DIGEST_LENGTH);
got_object_parsed_tree_entries_free(entries1);
*nentries1 = 0;
free(*buf1);
@@ -514,13 +514,13 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_t **buf2,
if (err)
break;
+ memcpy(id2.sha1, pte2->id, SHA1_DIGEST_LENGTH);
idx = got_packidx_get_object_idx_sha1(packidx,
pte2->id);
if (idx == -1) {
- err = got_error(GOT_ERR_NO_OBJ);
+ err = got_error_no_obj(&id2);
break;
}
- memcpy(id2.sha1, pte2->id, SHA1_DIGEST_LENGTH);
got_object_parsed_tree_entries_free(entries2);
*nentries2 = 0;
free(*buf2);