* bc/object-id: (53 commits)
object: convert parse_object* to take struct object_id
tree: convert parse_tree_indirect to struct object_id
sequencer: convert do_recursive_merge to struct object_id
diff-lib: convert do_diff_cache to struct object_id
builtin/ls-tree: convert to struct object_id
merge: convert checkout_fast_forward to struct object_id
sequencer: convert fast_forward_to to struct object_id
builtin/ls-files: convert overlay_tree_on_cache to object_id
builtin/read-tree: convert to struct object_id
sha1_name: convert internals of peel_onion to object_id
upload-pack: convert remaining parse_object callers to object_id
revision: convert remaining parse_object callers to object_id
revision: rename add_pending_sha1 to add_pending_oid
http-push: convert process_ls_object and descendants to object_id
refs/files-backend: convert many internals to struct object_id
refs: convert struct ref_update to use struct object_id
ref-filter: convert some static functions to struct object_id
Convert struct ref_array_item to struct object_id
Convert the verify_pack callback to struct object_id
Convert lookup_tag to struct object_id
...
error(_("Couldn't look up commit object for '%s'"), refname);
return -1;
@ -211,7 +211,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
@@ -211,7 +211,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
@ -84,7 +84,7 @@ static int reset_index(const struct object_id *oid, int reset_type, int quiet)
@@ -84,7 +84,7 @@ static int reset_index(const struct object_id *oid, int reset_type, int quiet)
return -1;
if (reset_type == MIXED || reset_type == HARD) {
tree = parse_tree_indirect(oid->hash);
tree = parse_tree_indirect(oid);
prime_cache_tree(&the_index, tree);
}
@ -154,7 +154,7 @@ static int read_from_tree(const struct pathspec *pathspec,
@@ -154,7 +154,7 @@ static int read_from_tree(const struct pathspec *pathspec,
add_to_ref_list(&oid, p + 1, &header->references);
}
}
@ -115,7 +116,7 @@ static int list_refs(struct ref_list *r, int argc, const char **argv)
@@ -115,7 +116,7 @@ static int list_refs(struct ref_list *r, int argc, const char **argv)
if (j == argc)
continue;
}
printf("%s %s\n", sha1_to_hex(r->list[i].sha1),
printf("%s %s\n", oid_to_hex(&r->list[i].oid),
r->list[i].name);
}
return 0;
@ -141,7 +142,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
@@ -141,7 +142,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
init_revisions(&revs, NULL);
for (i = 0; i < p->nr; i++) {
struct ref_list_entry *e = p->list + i;
struct object *o = parse_object(e->sha1);
struct object *o = parse_object(&e->oid);
if (o) {
o->flags |= PREREQ_MARK;
add_pending_object(&revs, o, e->name);
@ -149,7 +150,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
@@ -149,7 +150,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
}
if (++ret == 1)
error("%s", message);
error("%s %s", sha1_to_hex(e->sha1), e->name);
error("%s %s", oid_to_hex(&e->oid), e->name);
}
if (revs.pending.nr != p->nr)
return ret;
@ -285,16 +286,18 @@ static int compute_and_write_prerequisites(int bundle_fd,
@@ -285,16 +286,18 @@ static int compute_and_write_prerequisites(int bundle_fd,
return -1;
rls_fout = xfdopen(rls.out, "r");
while (strbuf_getwholeline(&buf, rls_fout, '\n') != EOF) {
@ -216,9 +216,9 @@ int for_each_commit_graft(each_commit_graft_fn fn, void *cb_data)
@@ -216,9 +216,9 @@ int for_each_commit_graft(each_commit_graft_fn fn, void *cb_data)
return ret;
}
int unregister_shallow(const unsigned char *sha1)
int unregister_shallow(const struct object_id *oid)
{
int pos = commit_graft_pos(sha1);
int pos = commit_graft_pos(oid->hash);
if (pos < 0)
return -1;
if (pos + 1 < commit_graft_nr)
@ -331,7 +331,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
@@ -331,7 +331,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
@ -350,7 +350,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
@@ -350,7 +350,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
*/
if (graft && (graft->nr_parent < 0 || grafts_replace_parents))
@ -358,7 +358,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
@@ -358,7 +358,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
@ -1579,7 +1580,7 @@ static int delete_remote_branch(const char *pattern, int force)
@@ -1579,7 +1580,7 @@ static int delete_remote_branch(const char *pattern, int force)
{
struct ref *refs = remote_refs;
struct ref *remote_ref = NULL;
unsigned char head_sha1[20];
struct object_id head_oid;
char *symref = NULL;
int match;
int patlen = strlen(pattern);
@ -1610,7 +1611,7 @@ static int delete_remote_branch(const char *pattern, int force)
@@ -1610,7 +1611,7 @@ static int delete_remote_branch(const char *pattern, int force)
* Remote HEAD must be a symref (not exactly foolproof; a remote
* symlink to a symref will look like a symref)
*/
fetch_symref("HEAD", &symref, head_sha1);
fetch_symref("HEAD", &symref, &head_oid);
if (!symref)
return error("Remote HEAD is not a symref");
@ -1619,7 +1620,7 @@ static int delete_remote_branch(const char *pattern, int force)
@@ -1619,7 +1620,7 @@ static int delete_remote_branch(const char *pattern, int force)
if (!strcmp(remote_ref->name, symref))
return error("Remote branch %s is the current HEAD",
remote_ref->name);
fetch_symref(symref, &symref, head_sha1);
fetch_symref(symref, &symref, &head_oid);
}
/* Run extra sanity checks if delete is not forced */
@ -1627,10 +1628,10 @@ static int delete_remote_branch(const char *pattern, int force)
@@ -1627,10 +1628,10 @@ static int delete_remote_branch(const char *pattern, int force)
/* Remote HEAD must resolve to a known object */
if (symref)
return error("Remote HEAD symrefs too deep");
if (is_null_sha1(head_sha1))
if (is_null_oid(&head_oid))
return error("Unable to resolve remote HEAD");
if (!has_sha1_file(head_sha1))
return error("Remote HEAD resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", sha1_to_hex(head_sha1));
if (!has_object_file(&head_oid))
return error("Remote HEAD resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", oid_to_hex(&head_oid));
/* Remote branch must resolve to a known object */
if (is_null_oid(&remote_ref->old_oid))
@ -1640,7 +1641,7 @@ static int delete_remote_branch(const char *pattern, int force)
@@ -1640,7 +1641,7 @@ static int delete_remote_branch(const char *pattern, int force)
return error("Remote branch %s resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", remote_ref->name, oid_to_hex(&remote_ref->old_oid));
/* Remote branch must be an ancestor of remote HEAD */
if (!verify_merge_base(head_sha1, remote_ref)) {
if (!verify_merge_base(&head_oid, remote_ref)) {
return error("The branch '%s' is not an ancestor "
@ -67,7 +67,7 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two,
@@ -67,7 +67,7 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two,
}
if (!oidcmp(&two->object.oid, &shifted))
return two;
return lookup_tree(shifted.hash);
return lookup_tree(&shifted);
}
static struct commit *make_virtual_commit(struct tree *tree, const char *comment)
@ -304,7 +304,7 @@ struct tree *write_tree_from_memory(struct merge_options *o)
@@ -304,7 +304,7 @@ struct tree *write_tree_from_memory(struct merge_options *o)
return NULL;
}
result = lookup_tree(active_cache_tree->sha1);
result = lookup_tree(&active_cache_tree->oid);
return result;
}
@ -994,11 +994,11 @@ static int merge_file_1(struct merge_options *o,
@@ -994,11 +994,11 @@ static int merge_file_1(struct merge_options *o,
return ret;
result->clean = (merge_status == 0);
} else if (S_ISGITLINK(a->mode)) {
result->clean = merge_submodule(result->oid.hash,
result->clean = merge_submodule(&result->oid,
one->path,
one->oid.hash,
a->oid.hash,
b->oid.hash,
&one->oid,
&a->oid,
&b->oid,
!o->call_depth);
} else if (S_ISLNK(a->mode)) {
oidcpy(&result->oid, &a->oid);
@ -2042,7 +2042,7 @@ int merge_recursive(struct merge_options *o,
@@ -2042,7 +2042,7 @@ int merge_recursive(struct merge_options *o,
/* if there is no common ancestor, use an empty tree */
* Both new and old must be commit-ish and new is descendant of
* old. Otherwise we require --force.
*/
o = deref_tag(parse_object(old_oid->hash), NULL, 0);
o = deref_tag(parse_object(old_oid), NULL, 0);
if (!o || o->type != OBJ_COMMIT)
return 0;
old = (struct commit *) o;
o = deref_tag(parse_object(new_oid->hash), NULL, 0);
o = deref_tag(parse_object(new_oid), NULL, 0);
if (!o || o->type != OBJ_COMMIT)
return 0;
new = (struct commit *) o;
@ -2009,13 +2010,13 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs,
@@ -2009,13 +2010,13 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs,
/* Cannot stat if what we used to build on no longer exists */
int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
{
unsigned char sha1[20];
struct object_id oid;
char type[20];
const char *bufptr = data;
const char *tail = bufptr + size;
@ -126,11 +126,10 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
@@ -126,11 +126,10 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
@ -143,13 +142,13 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
@@ -143,13 +142,13 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)