Commit 844a9ce4 authored by Junio C Hamano's avatar Junio C Hamano

Merge branch 'bc/object-id'

More transition from "unsigned char[40]" to "struct object_id".

This needed a few merge fixups, but is mostly disentangled from other
topics.

* bc/object-id:
  remote: convert functions to struct object_id
  Remove get_object_hash.
  Convert struct object to object_id
  Add several uses of get_object_hash.
  object: introduce get_object_hash macro.
  ref_newer: convert to use struct object_id
  push_refs_with_export: convert to struct object_id
  get_remote_heads: convert to struct object_id
  parse_fetch: convert to use struct object_id
  add_sought_entry_mem: convert to struct object_id
  Convert struct ref to use object_id.
  sha1_file: introduce has_object_file helper.
parents b12a966e fcd30b13
......@@ -241,7 +241,7 @@ int write_archive_entries(struct archiver_args *args,
len--;
if (args->verbose)
fprintf(stderr, "%.*s\n", (int)len, args->base);
err = write_entry(args, args->tree->object.sha1, args->base,
err = write_entry(args, args->tree->object.oid.hash, args->base,
len, 040777);
if (err)
return err;
......@@ -374,7 +374,7 @@ static void parse_treeish_arg(const char **argv,
commit = lookup_commit_reference_gently(oid.hash, 1);
if (commit) {
commit_sha1 = commit->object.sha1;
commit_sha1 = commit->object.oid.hash;
archive_time = commit->date;
} else {
commit_sha1 = NULL;
......@@ -390,7 +390,7 @@ static void parse_treeish_arg(const char **argv,
unsigned int mode;
int err;
err = get_tree_entry(tree->object.sha1, prefix,
err = get_tree_entry(tree->object.oid.hash, prefix,
tree_oid.hash, &mode);
if (err || !S_ISDIR(mode))
die("current working directory is untracked");
......
......@@ -193,7 +193,7 @@ static int compare_commit_dist(const void *a_, const void *b_)
b = (struct commit_dist *)b_;
if (a->distance != b->distance)
return b->distance - a->distance; /* desc sort */
return hashcmp(a->commit->object.sha1, b->commit->object.sha1);
return oidcmp(&a->commit->object.oid, &b->commit->object.oid);
}
static struct commit_list *best_bisection_sorted(struct commit_list *list, int nr)
......@@ -500,7 +500,7 @@ struct commit_list *filter_skipped(struct commit_list *list,
struct commit_list *next = list->next;
list->next = NULL;
if (0 <= sha1_array_lookup(&skipped_revs,
list->item->object.sha1)) {
list->item->object.oid.hash)) {
if (skipped_first && !*skipped_first)
*skipped_first = 1;
/* Move current to tried list */
......@@ -575,7 +575,7 @@ static struct commit_list *skip_away(struct commit_list *list, int count)
for (i = 0; cur; cur = cur->next, i++) {
if (i == index) {
if (hashcmp(cur->item->object.sha1, current_bad_oid->hash))
if (oidcmp(&cur->item->object.oid, current_bad_oid))
return cur;
if (previous)
return previous;
......@@ -784,7 +784,7 @@ static void check_merge_bases(int no_checkout)
result = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1);
for (; result; result = result->next) {
const unsigned char *mb = result->item->object.sha1;
const unsigned char *mb = result->item->object.oid.hash;
if (!hashcmp(mb, current_bad_oid->hash)) {
handle_bad_merge_base();
} else if (0 <= sha1_array_lookup(&good_revs, mb)) {
......@@ -973,7 +973,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
exit(4);
}
bisect_rev = revs.commits->item->object.sha1;
bisect_rev = revs.commits->item->object.oid.hash;
if (!hashcmp(bisect_rev, current_bad_oid->hash)) {
exit_if_skipped_commits(tried, current_bad_oid);
......
......@@ -267,7 +267,7 @@ void create_branch(const char *head,
if ((commit = lookup_commit_reference(sha1)) == NULL)
die(_("Not a valid branch point: '%s'."), start_name);
hashcpy(sha1, commit->object.sha1);
hashcpy(sha1, commit->object.oid.hash);
if (forcing)
snprintf(msg, sizeof msg, "branch: Reset to %s",
......
......@@ -1441,7 +1441,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
assert(!state->msg);
msg = strstr(buffer, "\n\n");
if (!msg)
die(_("unable to parse commit %s"), sha1_to_hex(commit->object.sha1));
die(_("unable to parse commit %s"), oid_to_hex(&commit->object.oid));
state->msg = xstrdup(msg + 2);
state->msg_len = strlen(state->msg);
}
......
......@@ -506,7 +506,7 @@ static int fill_blob_sha1_and_mode(struct origin *origin)
{
if (!is_null_sha1(origin->blob_sha1))
return 0;
if (get_tree_entry(origin->commit->object.sha1,
if (get_tree_entry(origin->commit->object.oid.hash,
origin->path,
origin->blob_sha1, &origin->mode))
goto error_out;
......@@ -557,11 +557,11 @@ static struct origin *find_origin(struct scoreboard *sb,
PATHSPEC_LITERAL_PATH, "", paths);
diff_setup_done(&diff_opts);
if (is_null_sha1(origin->commit->object.sha1))
do_diff_cache(parent->tree->object.sha1, &diff_opts);
if (is_null_oid(&origin->commit->object.oid))
do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
else
diff_tree_sha1(parent->tree->object.sha1,
origin->commit->tree->object.sha1,
diff_tree_sha1(parent->tree->object.oid.hash,
origin->commit->tree->object.oid.hash,
"", &diff_opts);
diffcore_std(&diff_opts);
......@@ -627,11 +627,11 @@ static struct origin *find_rename(struct scoreboard *sb,
diff_opts.single_follow = origin->path;
diff_setup_done(&diff_opts);
if (is_null_sha1(origin->commit->object.sha1))
do_diff_cache(parent->tree->object.sha1, &diff_opts);
if (is_null_oid(&origin->commit->object.oid))
do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
else
diff_tree_sha1(parent->tree->object.sha1,
origin->commit->tree->object.sha1,
diff_tree_sha1(parent->tree->object.oid.hash,
origin->commit->tree->object.oid.hash,
"", &diff_opts);
diffcore_std(&diff_opts);
......@@ -977,8 +977,8 @@ static void pass_blame_to_parent(struct scoreboard *sb,
if (diff_hunks(&file_p, &file_o, 0, blame_chunk_cb, &d))
die("unable to generate diff (%s -> %s)",
sha1_to_hex(parent->commit->object.sha1),
sha1_to_hex(target->commit->object.sha1));
oid_to_hex(&parent->commit->object.oid),
oid_to_hex(&target->commit->object.oid));
/* The rest are the same as the parent */
blame_chunk(&d.dstq, &d.srcq, INT_MAX, d.offset, INT_MAX, parent);
*d.dstq = NULL;
......@@ -1126,7 +1126,7 @@ static void find_copy_in_blob(struct scoreboard *sb,
memset(split, 0, sizeof(struct blame_entry [3]));
if (diff_hunks(file_p, &file_o, 1, handle_split_cb, &d))
die("unable to generate diff (%s)",
sha1_to_hex(parent->commit->object.sha1));
oid_to_hex(&parent->commit->object.oid));
/* remainder, if any, all match the preimage */
handle_split(sb, ent, d.tlno, d.plno, ent->num_lines, parent, split);
}
......@@ -1275,11 +1275,11 @@ static void find_copy_in_parent(struct scoreboard *sb,
&& (!porigin || strcmp(target->path, porigin->path))))
DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
if (is_null_sha1(target->commit->object.sha1))
do_diff_cache(parent->tree->object.sha1, &diff_opts);
if (is_null_oid(&target->commit->object.oid))
do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
else
diff_tree_sha1(parent->tree->object.sha1,
target->commit->tree->object.sha1,
diff_tree_sha1(parent->tree->object.oid.hash,
target->commit->tree->object.oid.hash,
"", &diff_opts);
if (!DIFF_OPT_TST(&diff_opts, FIND_COPIES_HARDER))
......@@ -1690,7 +1690,7 @@ static void get_commit_info(struct commit *commit,
if (len)
strbuf_add(&ret->summary, subject, len);
else
strbuf_addf(&ret->summary, "(%s)", sha1_to_hex(commit->object.sha1));
strbuf_addf(&ret->summary, "(%s)", oid_to_hex(&commit->object.oid));
unuse_commit_buffer(commit, message);
}
......@@ -1733,7 +1733,7 @@ static int emit_one_suspect_detail(struct origin *suspect, int repeat)
printf("boundary\n");
if (suspect->previous) {
struct origin *prev = suspect->previous;
printf("previous %s ", sha1_to_hex(prev->commit->object.sha1));
printf("previous %s ", oid_to_hex(&prev->commit->object.oid));
write_name_quoted(prev->path, stdout, '\n');
}
......@@ -1752,7 +1752,7 @@ static void found_guilty_entry(struct blame_entry *ent)
struct origin *suspect = ent->suspect;
printf("%s %d %d %d\n",
sha1_to_hex(suspect->commit->object.sha1),
oid_to_hex(&suspect->commit->object.oid),
ent->s_lno + 1, ent->lno + 1, ent->num_lines);
emit_one_suspect_detail(suspect, 0);
write_filename_info(suspect->path);
......@@ -1882,7 +1882,7 @@ static void emit_porcelain(struct scoreboard *sb, struct blame_entry *ent,
struct origin *suspect = ent->suspect;
char hex[GIT_SHA1_HEXSZ + 1];
sha1_to_hex_r(hex, suspect->commit->object.sha1);
sha1_to_hex_r(hex, suspect->commit->object.oid.hash);
printf("%s %d %d %d\n",
hex,
ent->s_lno + 1,
......@@ -1922,7 +1922,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
int show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP);
get_commit_info(suspect->commit, &ci, 1);
sha1_to_hex_r(hex, suspect->commit->object.sha1);
sha1_to_hex_r(hex, suspect->commit->object.oid.hash);
cp = nth_line(sb, ent->lno);
for (cnt = 0; cnt < ent->num_lines; cnt++) {
......@@ -2077,7 +2077,7 @@ static int read_ancestry(const char *graft_file)
static int update_auto_abbrev(int auto_abbrev, struct origin *suspect)
{
const char *uniq = find_unique_abbrev(suspect->commit->object.sha1,
const char *uniq = find_unique_abbrev(suspect->commit->object.oid.hash,
auto_abbrev);
int len = strlen(uniq);
if (auto_abbrev < len)
......@@ -2153,7 +2153,7 @@ static void sanity_check_refcnt(struct scoreboard *sb)
if (ent->suspect->refcnt <= 0) {
fprintf(stderr, "%s in %s has negative refcnt %d\n",
ent->suspect->path,
sha1_to_hex(ent->suspect->commit->object.sha1),
oid_to_hex(&ent->suspect->commit->object.oid),
ent->suspect->refcnt);
baa = 1;
}
......@@ -2216,7 +2216,7 @@ static void verify_working_tree_path(struct commit *work_tree, const char *path)
struct commit_list *parents;
for (parents = work_tree->parents; parents; parents = parents->next) {
const unsigned char *commit_sha1 = parents->item->object.sha1;
const unsigned char *commit_sha1 = parents->item->object.oid.hash;
unsigned char blob_sha1[20];
unsigned mode;
......@@ -2310,7 +2310,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
strbuf_addstr(&msg, "tree 0000000000000000000000000000000000000000\n");
for (parent = commit->parents; parent; parent = parent->next)
strbuf_addf(&msg, "parent %s\n",
sha1_to_hex(parent->item->object.sha1));
oid_to_hex(&parent->item->object.oid));
strbuf_addf(&msg,
"author %s\n"
"committer %s\n\n"
......@@ -2738,7 +2738,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
sb.revs->children.name = "children";
while (c->parents &&
hashcmp(c->object.sha1, sb.final->object.sha1)) {
oidcmp(&c->object.oid, &sb.final->object.oid)) {
struct commit_list *l = xcalloc(1, sizeof(*l));
l->item = c;
......@@ -2748,11 +2748,11 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
c = c->parents->item;
}
if (hashcmp(c->object.sha1, sb.final->object.sha1))
if (oidcmp(&c->object.oid, &sb.final->object.oid))
die("--reverse --first-parent together require range along first-parent chain");
}
if (is_null_sha1(sb.final->object.sha1)) {
if (is_null_oid(&sb.final->object.oid)) {
o = sb.final->util;
sb.final_buf = xmemdupz(o->file.ptr, o->file.size);
sb.final_buf_size = o->file.size;
......
......@@ -349,7 +349,7 @@ static void add_verbose_info(struct strbuf *out, struct ref_array_item *item,
fill_tracking_info(&stat, refname, filter->verbose > 1);
strbuf_addf(out, " %s %s%s",
find_unique_abbrev(item->commit->object.sha1, filter->abbrev),
find_unique_abbrev(item->commit->object.oid.hash, filter->abbrev),
stat.buf, sub);
strbuf_release(&stat);
strbuf_release(&subject);
......
......@@ -56,8 +56,8 @@ static int post_checkout_hook(struct commit *old, struct commit *new,
int changed)
{
return run_hook_le(NULL, "post-checkout",
sha1_to_hex(old ? old->object.sha1 : null_sha1),
sha1_to_hex(new ? new->object.sha1 : null_sha1),
sha1_to_hex(old ? old->object.oid.hash : null_sha1),
sha1_to_hex(new ? new->object.oid.hash : null_sha1),
changed ? "1" : "0", NULL);
/* "new" can be NULL when checking out from the index before
a commit exists. */
......@@ -401,7 +401,7 @@ static void describe_detached_head(const char *msg, struct commit *commit)
if (!parse_commit(commit))
pp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);
fprintf(stderr, "%s %s... %s\n", msg,
find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV), sb.buf);
find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV), sb.buf);
strbuf_release(&sb);
}
......@@ -510,10 +510,10 @@ static int merge_working_tree(const struct checkout_opts *opts,
setup_standard_excludes(topts.dir);
}
tree = parse_tree_indirect(old->commit ?
old->commit->object.sha1 :
old->commit->object.oid.hash :
EMPTY_TREE_SHA1_BIN);
init_tree_desc(&trees[0], tree->buffer, tree->size);
tree = parse_tree_indirect(new->commit->object.sha1);
tree = parse_tree_indirect(new->commit->object.oid.hash);
init_tree_desc(&trees[1], tree->buffer, tree->size);
ret = unpack_trees(2, trees, &topts);
......@@ -641,7 +641,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
old_desc = old->name;
if (!old_desc && old->commit)
old_desc = sha1_to_hex(old->commit->object.sha1);
old_desc = oid_to_hex(&old->commit->object.oid);
reflog_msg = getenv("GIT_REFLOG_ACTION");
if (!reflog_msg)
......@@ -653,7 +653,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
if (!strcmp(new->name, "HEAD") && !new->path && !opts->force_detach) {
/* Nothing to do. */
} else if (opts->force_detach || !new->path) { /* No longer on any branch. */
update_ref(msg.buf, "HEAD", new->commit->object.sha1, NULL,
update_ref(msg.buf, "HEAD", new->commit->object.oid.hash, NULL,
REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
if (!opts->quiet) {
if (old->path && advice_detached_head)
......@@ -704,7 +704,7 @@ static void describe_one_orphan(struct strbuf *sb, struct commit *commit)
{
strbuf_addstr(sb, " ");
strbuf_addstr(sb,
find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));
strbuf_addch(sb, ' ');
if (!parse_commit(commit))
pp_commit_easy(CMIT_FMT_ONELINE, commit, sb);
......@@ -762,7 +762,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
" git branch <new-branch-name> %s\n\n",
/* Give ngettext() the count */
lost),
find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));
}
/*
......@@ -780,10 +780,10 @@ static void orphaned_commit_warning(struct commit *old, struct commit *new)
setup_revisions(0, NULL, &revs, NULL);
object->flags &= ~UNINTERESTING;
add_pending_object(&revs, object, sha1_to_hex(object->sha1));
add_pending_object(&revs, object, oid_to_hex(&object->oid));
for_each_ref(add_pending_uninteresting_ref, &revs);
add_pending_sha1(&revs, "HEAD", new->object.sha1, UNINTERESTING);
add_pending_sha1(&revs, "HEAD", new->object.oid.hash, UNINTERESTING);
refs = revs.pending;
revs.leak_pending = 1;
......
......@@ -559,7 +559,7 @@ static void write_remote_refs(const struct ref *local_refs)
for (r = local_refs; r; r = r->next) {
if (!r->peer_ref)
continue;
if (ref_transaction_create(t, r->peer_ref->name, r->old_sha1,
if (ref_transaction_create(t, r->peer_ref->name, r->old_oid.hash,
0, NULL, &err))
die("%s", err.buf);
}
......@@ -579,9 +579,9 @@ static void write_followtags(const struct ref *refs, const char *msg)
continue;
if (ends_with(ref->name, "^{}"))
continue;
if (!has_sha1_file(ref->old_sha1))
if (!has_object_file(&ref->old_oid))
continue;
update_ref(msg, ref->name, ref->old_sha1,
update_ref(msg, ref->name, ref->old_oid.hash,
NULL, 0, UPDATE_REFS_DIE_ON_ERR);
}
}
......@@ -601,7 +601,7 @@ static int iterate_ref_map(void *cb_data, unsigned char sha1[20])
if (!ref)
return -1;
hashcpy(sha1, ref->old_sha1);
hashcpy(sha1, ref->old_oid.hash);
*rm = ref->next;
return 0;
}
......@@ -650,14 +650,14 @@ static void update_head(const struct ref *our, const struct ref *remote,
/* Local default branch link */
create_symref("HEAD", our->name, NULL);
if (!option_bare) {
update_ref(msg, "HEAD", our->old_sha1, NULL, 0,
update_ref(msg, "HEAD", our->old_oid.hash, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);
install_branch_config(0, head, option_origin, our->name);
}
} else if (our) {
struct commit *c = lookup_commit_reference(our->old_sha1);
struct commit *c = lookup_commit_reference(our->old_oid.hash);
/* --branch specifies a non-branch (i.e. tags), detach HEAD */
update_ref(msg, "HEAD", c->object.sha1,
update_ref(msg, "HEAD", c->object.oid.hash,
NULL, REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
} else if (remote) {
/*
......@@ -665,7 +665,7 @@ static void update_head(const struct ref *our, const struct ref *remote,
* HEAD points to a branch but we don't know which one.
* Detach HEAD in all these cases.
*/
update_ref(msg, "HEAD", remote->old_sha1,
update_ref(msg, "HEAD", remote->old_oid.hash,
NULL, REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
}
}
......@@ -1016,7 +1016,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
* remote HEAD check.
*/
for (ref = refs; ref; ref = ref->next)
if (is_null_sha1(ref->old_sha1)) {
if (is_null_oid(&ref->old_oid)) {
complete_refs_before_fetch = 0;
break;
}
......
......@@ -16,11 +16,11 @@ static const char *sign_commit;
static void new_parent(struct commit *parent, struct commit_list **parents_p)
{
unsigned char *sha1 = parent->object.sha1;
struct object_id *oid = &parent->object.oid;
struct commit_list *parents;
for (parents = *parents_p; parents; parents = parents->next) {
if (parents->item == parent) {
error("duplicate parent %s ignored", sha1_to_hex(sha1));
error("duplicate parent %s ignored", oid_to_hex(oid));
return;
}
parents_p = &parents->next;
......
......@@ -300,7 +300,7 @@ static void create_base_index(const struct commit *current_head)
opts.dst_index = &the_index;
opts.fn = oneway_merge;
tree = parse_tree_indirect(current_head->object.sha1);
tree = parse_tree_indirect(current_head->object.oid.hash);
if (!tree)
die(_("failed to unpack HEAD tree object"));
parse_tree(tree);
......@@ -1769,7 +1769,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
if (!transaction ||
ref_transaction_update(transaction, "HEAD", sha1,
current_head
? current_head->object.sha1 : null_sha1,
? current_head->object.oid.hash : null_sha1,
0, sb.buf, &err) ||
ref_transaction_commit(transaction, &err)) {
rollback_index_files();
......@@ -1796,10 +1796,10 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
cfg = init_copy_notes_for_rewrite("amend");
if (cfg) {
/* we are amending, so current_head is not NULL */
copy_note_for_rewrite(cfg, current_head->object.sha1, sha1);
copy_note_for_rewrite(cfg, current_head->object.oid.hash, sha1);
finish_copy_notes_for_rewrite(cfg, "Notes added by 'git commit --amend'");
}
run_rewrite_hook(current_head->object.sha1, sha1);
run_rewrite_hook(current_head->object.oid.hash, sha1);
}
if (!quiet)
print_summary(prefix, sha1, !current_head);
......
......@@ -252,14 +252,14 @@ static void describe(const char *arg, int last_one)
if (!cmit)
die(_("%s is not a valid '%s' object"), arg, commit_type);
n = find_commit_name(cmit->object.sha1);
n = find_commit_name(cmit->object.oid.hash);
if (n && (tags || all || n->prio == 2)) {
/*
* Exact match to an existing ref.
*/
display_name(n);
if (longformat)
show_suffix(0, n->tag ? n->tag->tagged->sha1 : sha1);
show_suffix(0, n->tag ? n->tag->tagged->oid.hash : sha1);
if (dirty)
printf("%s", dirty);
printf("\n");
......@@ -267,7 +267,7 @@ static void describe(const char *arg, int last_one)
}
if (!max_candidates)
die(_("no tag exactly matches '%s'"), sha1_to_hex(cmit->object.sha1));
die(_("no tag exactly matches '%s'"), oid_to_hex(&cmit->object.oid));
if (debug)
fprintf(stderr, _("searching to describe %s\n"), arg);
......@@ -317,7 +317,7 @@ static void describe(const char *arg, int last_one)
if (annotated_cnt && !list) {
if (debug)
fprintf(stderr, _("finished search at %s\n"),
sha1_to_hex(c->object.sha1));
oid_to_hex(&c->object.oid));
break;
}
while (parents) {
......@@ -334,9 +334,9 @@ static void describe(const char *arg, int last_one)
}
if (!match_cnt) {
const unsigned char *sha1 = cmit->object.sha1;
struct object_id *oid = &cmit->object.oid;
if (always) {
printf("%s", find_unique_abbrev(sha1, abbrev));
printf("%s", find_unique_abbrev(oid->hash, abbrev));
if (dirty)
printf("%s", dirty);
printf("\n");
......@@ -345,11 +345,11 @@ static void describe(const char *arg, int last_one)
if (unannotated_cnt)
die(_("No annotated tags can describe '%s'.\n"
"However, there were unannotated tags: try --tags."),
sha1_to_hex(sha1));
oid_to_hex(oid));
else
die(_("No tags can describe '%s'.\n"
"Try --always, or create some tags."),
sha1_to_hex(sha1));
oid_to_hex(oid));
}
qsort(all_matches, match_cnt, sizeof(all_matches[0]), compare_pt);
......@@ -374,13 +374,13 @@ static void describe(const char *arg, int last_one)
_("more than %i tags found; listed %i most recent\n"
"gave up search at %s\n"),
max_candidates, max_candidates,
sha1_to_hex(gave_up_on->object.sha1));
oid_to_hex(&gave_up_on->object.oid));
}
}
display_name(all_matches[0].name);
if (abbrev)
show_suffix(all_matches[0].depth, cmit->object.sha1);
show_suffix(all_matches[0].depth, cmit->object.oid.hash);
if (dirty)
printf("%s", dirty);
printf("\n");
......
......@@ -49,9 +49,9 @@ static int stdin_diff_trees(struct tree *tree1, char *line, int len)
tree2 = lookup_tree(sha1);
if (!tree2 || parse_tree(tree2))
return -1;
printf("%s %s\n", sha1_to_hex(tree1->object.sha1),
sha1_to_hex(tree2->object.sha1));
diff_tree_sha1(tree1->object.sha1, tree2->object.sha1,
printf("%s %s\n", oid_to_hex(&tree1->object.oid),
oid_to_hex(&tree2->object.oid));
diff_tree_sha1(tree1->object.oid.hash, tree2->object.oid.hash,
"", &log_tree_opt.diffopt);
log_tree_diff_flush(&log_tree_opt);
return 0;
......@@ -139,7 +139,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
break;
case 1:
tree1 = opt->pending.objects[0].item;
diff_tree_commit_sha1(tree1->sha1);
diff_tree_commit_sha1(tree1->oid.hash);
break;
case 2:
tree1 = opt->pending.objects[0].item;
......@@ -149,8 +149,8 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
tree2 = tree1;
tree1 = tmp;
}
diff_tree_sha1(tree1->sha1,
tree2->sha1,
diff_tree_sha1(tree1->oid.hash,
tree2->oid.hash,
"", &opt->diffopt);
log_tree_diff_flush(opt);
break;
......
......@@ -175,8 +175,8 @@ static int builtin_diff_tree(struct rev_info *revs,
*/
if (ent1->item->flags & UNINTERESTING)
swap = 1;
sha1[swap] = ent0->item->sha1;
sha1[1 - swap] = ent1->item->sha1;
sha1[swap] = ent0->item->oid.hash;
sha1[1 - swap] = ent1->item->oid.hash;
diff_tree_sha1(sha1[0], sha1[1], "", &revs->diffopt);
log_tree_diff_flush(revs);
return 0;
......@@ -196,8 +196,8 @@ static int builtin_diff_combined(struct rev_info *revs,
if (!revs->dense_combined_merges && !revs->combine_merges)
revs->dense_combined_merges = revs->combine_merges = 1;
for (i = 1; i < ents; i++)
sha1_array_append(&parents, ent[i].item->sha1);
diff_tree_combined(ent[0].item->sha1, &parents,
sha1_array_append(&parents, ent[i].item->oid.hash);
diff_tree_combined(ent[0].item->oid.hash, &parents,
revs->dense_combined_merges, revs);
sha1_array_clear(&parents);
return 0;
......@@ -395,7 +395,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
const char *name = entry->name;
int flags = (obj->flags & UNINTERESTING);
if (!obj->parsed)
obj = parse_object(obj->sha1);
obj = parse_object(obj->oid.hash);
obj = deref_tag(obj, NULL, 0);
if (!obj)
die(_("invalid object '%s' given."), name);
......@@ -408,7 +408,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
} else if (obj->type == OBJ_BLOB) {
if (2 <= blobs)
die(_("more than two blobs given: '%s'"), name);
hashcpy(blob[blobs].sha1, obj->sha1);
hashcpy(blob[blobs].sha1, obj->oid.hash);
blob[blobs].name = name;
blob[blobs].mode = entry->mode;
blobs++;
......
......@@ -544,13 +544,13 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
author = strstr(commit_buffer, "\nauthor ");
if (!author)
die ("Could not find author in commit %s",
sha1_to_hex(commit->object.sha1));
oid_to_hex(&commit->object.oid));
author++;
author_end = strchrnul(author, '\n');
committer = strstr(author_end, "\ncommitter ");
if (!committer)
die ("Could not find committer in commit %s",
sha1_to_hex(commit->object.sha1));
oid_to_hex(&commit->object.oid));
committer++;
committer_end = strchrnul(committer, '\n');
message = strstr(committer_end, "\n\n");
......@@ -562,11 +562,11 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
get_object_mark(&commit->parents->item->object) != 0 &&
!full_tree) {
parse_commit_or_die(commit->parents->item);
diff_tree_sha1(commit->parents->item->tree->object.sha1,
commit->tree->object.sha1, "", &rev->diffopt);
diff_tree_sha1(commit->parents->item->tree->object.oid.hash,
commit->tree->object.oid.hash, "", &rev->diffopt);
}
else
diff_root_tree_sha1(commit->tree->object.sha1,
diff_root_tree_sha1(commit->tree->object.oid.hash,
"", &rev->diffopt);
/* Export the referenced blobs, and remember the marks. */
......@@ -661,13 +661,13 @@ static void handle_tag(const char *name, struct tag *tag)
}
if (tagged->type == OBJ_TREE) {
warning("Omitting tag %s,\nsince tags of trees (or tags of tags of trees, etc.) are not supported.",
sha1_to_hex(tag->object.sha1));
oid_to_hex(&tag->object.oid));
return;
}
buf = read_sha1_file(tag->object.sha1, &type, &size);
buf = read_sha1_file(tag->object.oid.hash, &type, &size);
if (!buf)
die ("Could not read tag %s", sha1_to_hex(tag->object.sha1));
die ("Could not read tag %s", oid_to_hex(&tag->object.oid));
message = memmem(buf, size, "\n\n", 2);
if (message) {
message += 2;
......@@ -706,16 +706,16 @@ static void handle_tag(const char *name, struct tag *tag)
case ABORT:
die ("Encountered signed tag %s; use "
"--signed-tags=<mode> to handle it.",
sha1_to_hex(tag->object.sha1));
oid_to_hex(&tag->object.oid));
case WARN: