commit - 619de35f3933b60159828e7115fca7fdb9bbb5e8
commit + ec242592d329728975bf10a1196907167de7fed0
blob - e43b5b4df2fa845961755d838fde01b565897698
blob + 8c366cb8cb00814d3a45ab8496ab6309a60727d8
--- got/got.c
+++ got/got.c
#include <limits.h>
#include <locale.h>
#include <ctype.h>
+#include <sha1.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
if (qid != NULL) {
struct got_commit_object *pcommit;
err = got_object_open_as_commit(&pcommit, repo,
- qid->id);
+ &qid->id);
if (err)
return err;
qid = STAILQ_FIRST(got_object_commit_get_parent_ids(commit));
if (qid != NULL) {
err = got_object_open_as_commit(&pcommit, repo,
- qid->id);
+ &qid->id);
if (err)
return err;
}
int n = 1;
parent_ids = got_object_commit_get_parent_ids(commit);
STAILQ_FOREACH(qid, parent_ids, entry) {
- err = got_object_id_str(&id_str, qid->id);
+ err = got_object_id_str(&id_str, &qid->id);
if (err)
goto done;
printf("parent %d: %s\n", n++, id_str);
}
if (reverse_display_order) {
STAILQ_FOREACH(qid, &reversed_commits, entry) {
- err = got_object_open_as_commit(&commit, repo, qid->id);
+ err = got_object_open_as_commit(&commit, repo,
+ &qid->id);
if (err)
break;
if (show_changed_paths) {
if (err)
break;
}
- err = print_commit(commit, qid->id, repo, path,
+ err = print_commit(commit, &qid->id, repo, path,
show_changed_paths ? &changed_paths : NULL,
show_patch, diff_context, refs_idmap, NULL);
got_object_commit_close(commit);
struct got_object_qid *pid;
pids = got_object_commit_get_parent_ids(commit);
pid = STAILQ_FIRST(pids);
- ids[0] = got_object_id_dup(pid->id);
+ ids[0] = got_object_id_dup(&pid->id);
if (ids[0] == NULL) {
error = got_error_from_errno(
"got_object_id_dup");
goto done;
pid = STAILQ_FIRST(got_object_commit_get_parent_ids(commit));
memset(&upa, 0, sizeof(upa));
- error = got_worktree_merge_files(worktree, pid ? pid->id : NULL,
+ error = got_worktree_merge_files(worktree, pid ? &pid->id : NULL,
commit_id, repo, update_progress, &upa, check_cancelled,
NULL);
if (error != NULL)
}
memset(&upa, 0, sizeof(upa));
- error = got_worktree_merge_files(worktree, commit_id, pid->id,
+ error = got_worktree_merge_files(worktree, commit_id, &pid->id,
repo, update_progress, &upa, check_cancelled, NULL);
if (error != NULL)
goto done;
error = got_error(GOT_ERR_EMPTY_REBASE);
goto done;
}
- error = collect_commits(&commits, commit_id, pid->id,
+ error = collect_commits(&commits, commit_id, &pid->id,
yca_id, got_worktree_get_path_prefix(worktree),
GOT_ERR_REBASE_PATH, repo);
got_object_commit_close(commit);
pid = NULL;
STAILQ_FOREACH(qid, &commits, entry) {
- commit_id = qid->id;
- parent_id = pid ? pid->id : yca_id;
+ commit_id = &qid->id;
+ parent_id = pid ? &pid->id : yca_id;
pid = qid;
memset(&upa, 0, sizeof(upa));
if (upa.conflicts > 0 || upa.missing > 0 ||
upa.not_deleted > 0 || upa.unversioned > 0) {
if (upa.conflicts > 0) {
- error = show_rebase_merge_conflict(qid->id,
+ error = show_rebase_merge_conflict(&qid->id,
repo);
if (error)
goto done;
histedit_cmd = "edit";
else if (fold_only && STAILQ_NEXT(qid, entry) != NULL)
histedit_cmd = "fold";
- err = histedit_write_commit(qid->id, histedit_cmd, f, repo);
+ err = histedit_write_commit(&qid->id, histedit_cmd, f, repo);
if (err)
break;
if (edit_logmsg_only) {
struct got_object_qid *qid;
qid = STAILQ_FIRST(commits);
- err = got_object_id_str(&id_str, qid->id);
+ err = got_object_id_str(&id_str, &qid->id);
if (err)
return err;
STAILQ_FOREACH(qid, commits, entry) {
TAILQ_FOREACH(hle, histedit_cmds, entry) {
- if (got_object_id_cmp(qid->id, hle->commit_id) == 0)
+ if (got_object_id_cmp(&qid->id, hle->commit_id) == 0)
break;
}
if (hle == NULL) {
- err = got_object_id_str(&id_str, qid->id);
+ err = got_object_id_str(&id_str, &qid->id);
if (err)
return err;
snprintf(msg, sizeof(msg),
error = got_error(GOT_ERR_EMPTY_HISTEDIT);
goto done;
}
- error = collect_commits(&commits, head_commit_id, pid->id,
+ error = collect_commits(&commits, head_commit_id, &pid->id,
base_commit_id, got_worktree_get_path_prefix(worktree),
GOT_ERR_HISTEDIT_PATH, repo);
got_object_commit_close(commit);
error = got_error(GOT_ERR_EMPTY_HISTEDIT);
goto done;
}
- error = collect_commits(&commits, head_commit_id, pid->id,
+ error = collect_commits(&commits, head_commit_id, &pid->id,
got_worktree_get_base_commit_id(worktree),
got_worktree_get_path_prefix(worktree),
GOT_ERR_HISTEDIT_PATH, repo);
pid = STAILQ_FIRST(parent_ids);
error = got_worktree_histedit_merge_files(&merged_paths,
- worktree, fileindex, pid->id, hle->commit_id, repo,
+ worktree, fileindex, &pid->id, hle->commit_id, repo,
update_progress, &upa, check_cancelled, NULL);
if (error)
goto done;
got_object_commit_get_nparents(commit));
STAILQ_FOREACH(pid, parent_ids, entry) {
char *pid_str;
- err = got_object_id_str(&pid_str, pid->id);
+ err = got_object_id_str(&pid_str, &pid->id);
if (err)
goto done;
fprintf(outfile, "%s%s\n", GOT_COMMIT_LABEL_PARENT, pid_str);
blob - 908e4780898335cd2b600dc58fb00f25c4363115
blob + 350adc96c74c1d5ad170177cf54b95bb7da9f2cb
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
#include <err.h>
#include <errno.h>
#include <regex.h>
+#include <sha1.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
parent_id = STAILQ_FIRST(
got_object_commit_get_parent_ids(commit));
if (parent_id != NULL) {
- id2 = got_object_id_dup(parent_id->id);
+ id2 = got_object_id_dup(&parent_id->id);
free (parent_id);
error = got_object_id_str(&header->parent_id, id2);
if (error)
blob - 9d6f362ad6242f2fdff94792bc113ede1710807d
blob + 0a162cbd301d5069ad3612113a16489ad4b7fd87
--- include/got_object.h
+++ include/got_object.h
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-struct got_object_id;
+struct got_object_id {
+ u_int8_t sha1[SHA1_DIGEST_LENGTH];
+};
struct got_blob_object;
struct got_tree_object;
struct got_object_qid {
STAILQ_ENTRY(got_object_qid) entry;
- struct got_object_id *id;
+ struct got_object_id id;
void *data; /* managed by API user */
};
blob - cdadafcf0845e11bc89d10c2dd0f13a50fbb05a3
blob + f0716a472395e1397b1ded375713011c41784382
--- lib/blame.c
+++ lib/blame.c
return NULL;
}
- err = got_object_open_as_commit(&pcommit, repo, pid->id);
+ err = got_object_open_as_commit(&pcommit, repo, &pid->id);
if (err)
goto done;
blob - 54a084ad975a8926ebfd7457ee7b7c3d144c9a8e
blob + 1286c9b89a7ba9696c5d6c9a9de0a2f40bf29cd7
--- lib/commit_graph.c
+++ lib/commit_graph.c
if (err)
return err;
- err = got_object_open_as_commit(&pcommit, repo, pid->id);
+ err = got_object_open_as_commit(&pcommit, repo, &pid->id);
if (err)
goto done;
STAILQ_FOREACH(qid, &traversed_commits, entry) {
struct got_commit_graph_node *node;
- if (got_object_idset_contains(graph->open_branches, qid->id))
+ if (got_object_idset_contains(graph->open_branches, &qid->id))
continue;
- if (got_object_idset_contains(graph->node_ids, qid->id))
+ if (got_object_idset_contains(graph->node_ids, &qid->id))
continue;
(*ncommits_traversed)++;
/* ... except the last commit is the new branch tip. */
if (STAILQ_NEXT(qid, entry) == NULL) {
err = got_object_idset_add(graph->open_branches,
- qid->id, NULL);
+ &qid->id, NULL);
break;
}
- err = add_node(&node, graph, qid->id, repo);
+ err = add_node(&node, graph, &qid->id, repo);
if (err)
break;
}
if (graph->flags & GOT_COMMIT_GRAPH_FIRST_PARENT_TRAVERSAL) {
qid = STAILQ_FIRST(&commit->parent_ids);
if (qid == NULL ||
- got_object_idset_contains(graph->open_branches, qid->id))
+ got_object_idset_contains(graph->open_branches, &qid->id))
return NULL;
/*
* The root directory always changes by definition, and when
(commit->flags & GOT_COMMIT_FLAG_PACKED)) {
int ncommits = 0;
err = packed_first_parent_traversal(&ncommits,
- graph, qid->id, repo);
+ graph, &qid->id, repo);
if (err || ncommits > 0)
return err;
}
return got_object_idset_add(graph->open_branches,
- qid->id, NULL);
+ &qid->id, NULL);
}
/*
struct got_commit_object *pcommit = NULL;
if (got_object_idset_contains(graph->open_branches,
- qid->id))
+ &qid->id))
continue;
err = got_object_open_as_commit(&pcommit, repo,
- qid->id);
+ &qid->id);
if (err) {
free(merged_id);
free(prev_id);
*/
if (got_object_id_cmp(merged_id, id) == 0) {
err = got_object_idset_add(graph->open_branches,
- qid->id, NULL);
+ &qid->id, NULL);
free(merged_id);
free(id);
return err;
if (qid == NULL)
return NULL;
if (got_object_idset_contains(graph->open_branches,
- qid->id))
+ &qid->id))
return NULL;
if (got_object_idset_contains(graph->node_ids,
- qid->id))
+ &qid->id))
return NULL; /* parent already traversed */
return got_object_idset_add(graph->open_branches,
- qid->id, NULL);
+ &qid->id, NULL);
}
}
STAILQ_FOREACH(qid, &commit->parent_ids, entry) {
- if (got_object_idset_contains(graph->open_branches, qid->id))
+ if (got_object_idset_contains(graph->open_branches, &qid->id))
continue;
- if (got_object_idset_contains(graph->node_ids, qid->id))
+ if (got_object_idset_contains(graph->node_ids, &qid->id))
continue; /* parent already traversed */
- err = got_object_idset_add(graph->open_branches, qid->id, NULL);
+ err = got_object_idset_add(graph->open_branches, &qid->id,
+ NULL);
if (err)
return err;
}
blob - 27c34c9f6538e758e1f1f82e0848ed3bbf02348c
blob + 8268b2a39fccc9121ba31bf4a2e323d3bb4b199a
--- lib/diff3.c
+++ lib/diff3.c
#include <ctype.h>
#include <limits.h>
+#include <sha1.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
blob - 167f59b96d9b235b94895fb2fbeb8c5aeb81ded9
blob + 5e1ea4359f7c4ea434629b715c5a0ea896cb8fd6
--- lib/diffreg.c
+++ lib/diffreg.c
#include <sys/stat.h>
#include <errno.h>
+#include <sha1.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
blob - 7a4aaaaec7e976d89c7989136f80818dd4091850
blob + 6af8d574c7b345c52d3e0c19759bf3ae6bd62b20
--- lib/got_lib_object.h
+++ lib/got_lib_object.h
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-struct got_object_id {
- u_int8_t sha1[SHA1_DIGEST_LENGTH];
-};
-
struct got_object {
int type;
blob - ca30358a6647e506d86ee837489f03246816cf1d
blob + f668ac5f7e715861d4f32a7ae5122addde9dd770
--- lib/object.c
+++ lib/object.c
const struct got_error *
got_object_qid_alloc(struct got_object_qid **qid, struct got_object_id *id)
{
- const struct got_error *err = NULL;
-
*qid = calloc(1, sizeof(**qid));
if (*qid == NULL)
return got_error_from_errno("calloc");
- (*qid)->id = got_object_id_dup(id);
- if ((*qid)->id == NULL) {
- err = got_error_from_errno("got_object_id_dup");
- got_object_qid_free(*qid);
- *qid = NULL;
- return err;
- }
-
+ memcpy(&(*qid)->id, id, sizeof((*qid)->id));
return NULL;
}
* Deep-copy the object ID only. Let the caller deal
* with setting up the new->data pointer if needed.
*/
- err = got_object_qid_alloc(&new, qid->id);
+ err = got_object_qid_alloc(&new, &qid->id);
if (err) {
got_object_id_queue_free(dest);
return err;
blob - 92d90aa750ff050b19b92fd209da42973f7bf827
blob + 6eec96582b7d29118c2f757bdb1e828656a52cca
--- lib/object_cache.c
+++ lib/object_cache.c
size += strlen(commit->logmsg);
STAILQ_FOREACH(qid, &commit->parent_ids, entry)
- size += sizeof(*qid) + sizeof(*qid->id);
+ size += sizeof(*qid) + sizeof(qid->id);
return size;
}
blob - cfbeb2b152142e46bdd235158bfd105ea42e7345
blob + 4065f5b1391cd57bc92ee6e07e70920e57f016ef
--- lib/object_create.c
+++ lib/object_create.c
STAILQ_FOREACH(qid, parent_ids, entry) {
char *parent_str = NULL;
- err = got_object_id_str(&id_str, qid->id);
+ err = got_object_id_str(&id_str, &qid->id);
if (err)
goto done;
if (asprintf(&parent_str, "%s%s\n",
blob - 3494cba330f8f89dc343857f019e1140d21ee59f
blob + beec3097b26092113063dbcb91dc15a8bde91a16
--- lib/object_idset.c
+++ lib/object_idset.c
uint64_t idx;
qid = STAILQ_FIRST(&set->ids[i]);
STAILQ_REMOVE(&set->ids[i], qid, got_object_qid, entry);
- idx = idset_hash(set, qid->id) % nbuckets;
+ idx = idset_hash(set, &qid->id) % nbuckets;
STAILQ_INSERT_HEAD(&ids[idx], qid, entry);
}
}
err = got_object_qid_alloc_partial(&qid);
if (err)
return err;
- memcpy(qid->id, id, sizeof(*qid->id));
+ memcpy(&qid->id, id, sizeof(qid->id));
qid->data = data;
idx = idset_hash(set, id) % set->nbuckets;
struct got_object_qid *qid;
STAILQ_FOREACH(qid, head, entry) {
- if (got_object_id_cmp(qid->id, id) == 0)
+ if (got_object_id_cmp(&qid->id, id) == 0)
return qid;
}
idx = idset_hash(set, id) % set->nbuckets;
head = &set->ids[idx];
STAILQ_FOREACH(qid, head, entry) {
- if (got_object_id_cmp(qid->id, id) == 0)
+ if (got_object_id_cmp(&qid->id, id) == 0)
break;
}
if (qid == NULL)
for (i = 0; i < set->nbuckets; i++) {
head = &set->ids[i];
STAILQ_FOREACH_SAFE(qid, head, entry, tmp) {
- err = (*cb)(qid->id, qid->data, arg);
+ err = (*cb)(&qid->id, qid->data, arg);
if (err)
goto done;
}
blob - a375765892960296564474ea220a90dcde975a4f
blob + 0f405a4edb2cd9535de248c4d5ca811464a8fb51
--- lib/object_parse.c
+++ lib/object_parse.c
const struct got_error *
got_object_qid_alloc_partial(struct got_object_qid **qid)
{
- const struct got_error *err = NULL;
-
*qid = malloc(sizeof(**qid));
if (*qid == NULL)
return got_error_from_errno("malloc");
- (*qid)->id = malloc(sizeof(*((*qid)->id)));
- if ((*qid)->id == NULL) {
- err = got_error_from_errno("malloc");
- got_object_qid_free(*qid);
- *qid = NULL;
- return err;
- }
(*qid)->data = NULL;
-
return NULL;
}
void
got_object_qid_free(struct got_object_qid *qid)
{
- free(qid->id);
free(qid);
}
if (err)
return err;
- if (!got_parse_sha1_digest(qid->id->sha1, id_str)) {
+ if (!got_parse_sha1_digest(qid->id.sha1, id_str)) {
err = got_error(GOT_ERR_BAD_OBJ_DATA);
got_object_qid_free(qid);
return err;
blob - 82b347cabb0771a0d12f911aa614f5f306c23e09
blob + b7e2f83cb674abec61afb336d07774b71385fdab
--- lib/pack.c
+++ lib/pack.c
err = got_object_qid_alloc_partial(&qid);
if (err)
break;
- memcpy(qid->id->sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+ memcpy(qid->id.sha1, oid->sha1, SHA1_DIGEST_LENGTH);
STAILQ_INSERT_TAIL(matched_ids, qid, entry);
oid = &packidx->hdr.sorted_ids[++i];
blob - 9fea56df7e029b0d0b6d6901001a4de065f35397
blob + 43e90530ab95f439334dbf21ba51f8b4904ea5ff
--- lib/pack_create.c
+++ lib/pack_create.c
qid = STAILQ_FIRST(&tree_ids);
STAILQ_REMOVE_HEAD(&tree_ids, entry);
- if (got_object_idset_contains(idset, qid->id)) {
+ if (got_object_idset_contains(idset, &qid->id)) {
got_object_qid_free(qid);
continue;
}
- err = add_object(want_meta, idset, qid->id, dpath,
+ err = add_object(want_meta, idset, &qid->id, dpath,
GOT_OBJ_TYPE_TREE, mtime, loose_obj_only, repo,
ncolored, nfound, ntrees, progress_cb, progress_arg, rl);
if (err) {
break;
}
- err = load_tree_entries(&tree_ids, want_meta, idset, qid->id,
+ err = load_tree_entries(&tree_ids, want_meta, idset, &qid->id,
dpath, mtime, repo, loose_obj_only, ncolored, nfound,
ntrees, progress_cb, progress_arg, rl,
cancel_cb, cancel_arg);
if (color == COLOR_SKIP)
nskip--;
- if (got_object_idset_contains(skip, qid->id)) {
+ if (got_object_idset_contains(skip, &qid->id)) {
got_object_qid_free(qid);
continue;
}
switch (color) {
case COLOR_KEEP:
- if (got_object_idset_contains(keep, qid->id)) {
+ if (got_object_idset_contains(keep, &qid->id)) {
got_object_qid_free(qid);
continue;
}
- if (got_object_idset_contains(drop, qid->id)) {
+ if (got_object_idset_contains(drop, &qid->id)) {
err = paint_commit(qid, COLOR_SKIP);
if (err)
goto done;
nskip++;
} else
(*ncolored)++;
- err = got_object_idset_add(keep, qid->id, NULL);
+ err = got_object_idset_add(keep, &qid->id, NULL);
if (err)
goto done;
break;
case COLOR_DROP:
- if (got_object_idset_contains(drop, qid->id)) {
+ if (got_object_idset_contains(drop, &qid->id)) {
got_object_qid_free(qid);
continue;
}
- if (got_object_idset_contains(keep, qid->id)) {
+ if (got_object_idset_contains(keep, &qid->id)) {
err = paint_commit(qid, COLOR_SKIP);
if (err)
goto done;
nskip++;
} else
(*ncolored)++;
- err = got_object_idset_add(drop, qid->id, NULL);
+ err = got_object_idset_add(drop, &qid->id, NULL);
if (err)
goto done;
break;
case COLOR_SKIP:
- if (!got_object_idset_contains(skip, qid->id)) {
- err = got_object_idset_add(skip, qid->id, NULL);
+ if (!got_object_idset_contains(skip, &qid->id)) {
+ err = got_object_idset_add(skip, &qid->id,
+ NULL);
if (err)
goto done;
}
break;
- err = got_object_open_as_commit(&commit, repo, qid->id);
+ err = got_object_open_as_commit(&commit, repo, &qid->id);
if (err)
break;
struct got_object_qid *pid;
color = *((int *)qid->data);
STAILQ_FOREACH(pid, parents, entry) {
- err = queue_commit_id(ids, pid->id, color,
+ err = queue_commit_id(ids, &pid->id, color,
repo);
if (err)
break;
blob - b0eade9a44bba593a19ba24f06c226c33317198f
blob + 6b04a1c0d62f06e7f81638f58bcb0509c7292087
--- lib/privsep.c
+++ lib/privsep.c
memcpy(buf + len, commit->committer, committer_len);
len += committer_len;
STAILQ_FOREACH(qid, &commit->parent_ids, entry) {
- memcpy(buf + len, qid->id, SHA1_DIGEST_LENGTH);
+ memcpy(buf + len, &qid->id, SHA1_DIGEST_LENGTH);
len += SHA1_DIGEST_LENGTH;
}
err = got_object_qid_alloc_partial(&qid);
if (err)
break;
- memcpy(qid->id, imsg->data + len +
- i * SHA1_DIGEST_LENGTH, sizeof(*qid->id));
+ memcpy(&qid->id, imsg->data + len +
+ i * SHA1_DIGEST_LENGTH, sizeof(qid->id));
STAILQ_INSERT_TAIL(&(*commit)->parent_ids, qid, entry);
(*commit)->nparents++;
}
err = got_object_qid_alloc_partial(&qid);
if (err)
break;
- memcpy(qid->id->sha1, sha1, SHA1_DIGEST_LENGTH);
+ memcpy(qid->id.sha1, sha1, SHA1_DIGEST_LENGTH);
STAILQ_INSERT_TAIL(commit_ids, qid, entry);
/* The last commit may contain a change. */
if (i == icommits->ncommits - 1) {
*changed_commit_id =
- got_object_id_dup(qid->id);
+ got_object_id_dup(&qid->id);
if (*changed_commit_id == NULL) {
err = got_error_from_errno(
"got_object_id_dup");
blob - 2ab15e0f84226ad6b90990aed9187d0c48ecd38c
blob + 31a38d9c9f4614918f6f64bde0b2bc151f0927f9
--- lib/repository.c
+++ lib/repository.c
if (obj_type != GOT_OBJ_TYPE_ANY) {
int matched_type;
err = got_object_get_type(&matched_type, repo,
- qid->id);
+ &qid->id);
if (err)
goto done;
if (matched_type != obj_type)
continue;
}
if (*unique_id == NULL) {
- *unique_id = got_object_id_dup(qid->id);
+ *unique_id = got_object_id_dup(&qid->id);
if (*unique_id == NULL) {
err = got_error_from_errno("malloc");
goto done;
}
} else {
- if (got_object_id_cmp(*unique_id, qid->id) == 0)
+ if (got_object_id_cmp(*unique_id,
+ &qid->id) == 0)
continue; /* packed multiple times */
err = got_error(GOT_ERR_AMBIGUOUS_ID);
goto done;
blob - 0054791059b672a6e00b7f9d1da002661b53409d
blob + 0e2bccb727dfe8aab48409a7252bb34bf8879176
--- lib/repository_admin.c
+++ lib/repository_admin.c
qid = STAILQ_FIRST(&tree_ids);
STAILQ_REMOVE_HEAD(&tree_ids, entry);
- if (got_object_idset_contains(traversed_ids, qid->id)) {
+ if (got_object_idset_contains(traversed_ids, &qid->id)) {
got_object_qid_free(qid);
continue;
}
- err = got_object_idset_add(traversed_ids, qid->id, NULL);
+ err = got_object_idset_add(traversed_ids, &qid->id, NULL);
if (err) {
got_object_qid_free(qid);
break;
}
/* This tree is referenced. */
- err = preserve_loose_object(loose_ids, qid->id, repo, npacked);
+ err = preserve_loose_object(loose_ids, &qid->id, repo, npacked);
if (err)
break;
err = load_tree_entries(&tree_ids, loose_ids, traversed_ids,
- qid->id, dpath, repo, npacked, cancel_cb, cancel_arg);
+ &qid->id, dpath, repo, npacked, cancel_cb, cancel_arg);
got_object_qid_free(qid);
if (err)
break;
qid = STAILQ_FIRST(&ids);
STAILQ_REMOVE_HEAD(&ids, entry);
- if (got_object_idset_contains(traversed_ids, qid->id)) {
+ if (got_object_idset_contains(traversed_ids, &qid->id)) {
got_object_qid_free(qid);
qid = NULL;
continue;
}
- err = got_object_idset_add(traversed_ids, qid->id, NULL);
+ err = got_object_idset_add(traversed_ids, &qid->id, NULL);
if (err)
break;
/* This commit or tag is referenced. */
- err = preserve_loose_object(loose_ids, qid->id, repo, npacked);
+ err = preserve_loose_object(loose_ids, &qid->id, repo, npacked);
if (err)
break;
- err = got_object_get_type(&obj_type, repo, qid->id);
+ err = got_object_get_type(&obj_type, repo, &qid->id);
if (err)
break;
switch (obj_type) {
case GOT_OBJ_TYPE_COMMIT:
- err = got_object_open_as_commit(&commit, repo, qid->id);
+ err = got_object_open_as_commit(&commit, repo,
+ &qid->id);
if (err)
goto done;
break;
case GOT_OBJ_TYPE_TAG:
- err = got_object_open_as_tag(&tag, repo, qid->id);
+ err = got_object_open_as_tag(&tag, repo, &qid->id);
if (err)
goto done;
break;
* and the object it points to on disk.
*/
err = got_object_idset_remove(NULL, loose_ids,
- qid->id);
+ &qid->id);
if (err && err->code != GOT_ERR_NO_OBJ)
goto done;
err = got_object_idset_remove(NULL, loose_ids,
blob - 6d61529dcbf140930872d1c171b6edf9fea13692
blob + fc0e193bfca06441cd42a65339c55233c4d0ac49
--- lib/worktree_open.c
+++ lib/worktree_open.c
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
+#include <sha1.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
blob - 138a8e7c23435e08c4ed4f06e14969eadd485b4a
blob + bf79fbc1b585f4c34d13bcad9d48277a73d1b8a6
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
if (pid == NULL)
break;
- idx = got_packidx_get_object_idx(packidx, pid->id);
+ idx = got_packidx_get_object_idx(packidx, &pid->id);
if (idx == -1)
break;
- err = open_commit(&pcommit, pack, packidx, idx, pid->id,
+ err = open_commit(&pcommit, pack, packidx, idx, &pid->id,
objcache);
if (err) {
if (err->code != GOT_ERR_NO_OBJ)
}
if (!changed) {
- memcpy(id.sha1, pid->id->sha1, SHA1_DIGEST_LENGTH);
+ memcpy(id.sha1, pid->id.sha1, SHA1_DIGEST_LENGTH);
got_object_commit_close(commit);
commit = pcommit;
pcommit = NULL;
blob - b2a87544f6845b696f3c74b2ec602f4961a4b4b5
blob + 361deb26a24e7e03c55b1b63d6b9c233b43fe3c0
--- tog/tog.c
+++ tog/tog.c
#include <curses.h>
#include <panel.h>
#include <locale.h>
+#include <sha1.h>
#include <signal.h>
#include <stdlib.h>
#include <stdarg.h>
return got_error_from_errno("view_open");
parent_id = STAILQ_FIRST(got_object_commit_get_parent_ids(commit));
- err = open_diff_view(diff_view, parent_id ? parent_id->id : NULL,
+ err = open_diff_view(diff_view, parent_id ? &parent_id->id : NULL,
commit_id, NULL, NULL, 3, 0, 0, log_view, repo);
if (err == NULL)
*new_view = diff_view;
if (qid != NULL) {
struct got_commit_object *pcommit;
err = got_object_open_as_commit(&pcommit, repo,
- qid->id);
+ &qid->id);
if (err)
return err;
int pn = 1;
parent_ids = got_object_commit_get_parent_ids(commit);
STAILQ_FOREACH(qid, parent_ids, entry) {
- err = got_object_id_str(&id_str, qid->id);
+ err = got_object_id_str(&id_str, &qid->id);
if (err)
goto done;
n = fprintf(outfile, "parent %d: %s\n", pn++, id_str);
} else {
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) {
+ if (got_object_id_cmp(s->id1, &pid->id) == 0) {
err = write_commit_info(
&s->line_offsets, &s->nlines,
s->id2, refs, s->repo, s->f);
parent_ids = got_object_commit_get_parent_ids(selected_commit);
free(s->id1);
pid = STAILQ_FIRST(parent_ids);
- s->id1 = pid ? got_object_id_dup(pid->id) : NULL;
+ s->id1 = pid ? got_object_id_dup(&pid->id) : NULL;
got_object_commit_close(selected_commit);
return NULL;
}
char *id_str;
struct tog_color *tc;
- err = got_object_id_str(&id_str, s->blamed_commit->id);
+ err = got_object_id_str(&id_str, &s->blamed_commit->id);
if (err)
return err;
int obj_type;
err = got_object_open_as_commit(&commit, s->repo,
- s->blamed_commit->id);
+ &s->blamed_commit->id);
if (err)
return err;
blame->cb_args.view = view;
blame->cb_args.lines = blame->lines;
blame->cb_args.nlines = blame->nlines;
- blame->cb_args.commit_id = got_object_id_dup(s->blamed_commit->id);
+ blame->cb_args.commit_id = got_object_id_dup(&s->blamed_commit->id);
if (blame->cb_args.commit_id == NULL) {
err = got_error_from_errno("got_object_id_dup");
goto done;
}
/* Check if path history ends here. */
err = got_object_open_as_commit(&pcommit,
- s->repo, pid->id);
+ s->repo, &pid->id);
if (err)
break;
err = got_object_id_by_path(&blob_id, s->repo,
break;
}
err = got_object_qid_alloc(&s->blamed_commit,
- pid->id);
+ &pid->id);
got_object_commit_close(commit);
} else {
if (got_object_id_cmp(id,
- s->blamed_commit->id) == 0)
+ &s->blamed_commit->id) == 0)
break;
err = got_object_qid_alloc(&s->blamed_commit,
id);
case 'B': {
struct got_object_qid *first;
first = STAILQ_FIRST(&s->blamed_commits);
- if (!got_object_id_cmp(first->id, s->commit_id))
+ if (!got_object_id_cmp(&first->id, s->commit_id))
break;
s->done = 1;
thread_err = stop_blame(&s->blame);
err = got_error_from_errno("view_open");
break;
}
- err = open_diff_view(diff_view, pid ? pid->id : NULL,
+ err = open_diff_view(diff_view, pid ? &pid->id : NULL,
id, NULL, NULL, 3, 0, 0, NULL, s->repo);
got_object_commit_close(commit);
if (err) {