summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2015-11-10 02:22:28 +0000
committerLibravatar Jeff King <peff@peff.net>2015-11-20 08:02:05 -0500
commitf2fd0760f62e79609fef7bfd7ecebb002e8e4ced (patch)
tree1f915114b015428730e95a89697783560b672008
parentAdd several uses of get_object_hash. (diff)
downloadtgif-f2fd0760f62e79609fef7bfd7ecebb002e8e4ced.tar.xz
Convert struct object to object_id
struct object is one of the major data structures dealing with object IDs. Convert it to use struct object_id instead of an unsigned char array. Convert get_object_hash to refer to the new member as well. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
-rw-r--r--bisect.c4
-rw-r--r--builtin/am.c2
-rw-r--r--builtin/blame.c32
-rw-r--r--builtin/checkout.c12
-rw-r--r--builtin/commit-tree.c4
-rw-r--r--builtin/describe.c14
-rw-r--r--builtin/diff-tree.c4
-rw-r--r--builtin/fast-export.c22
-rw-r--r--builtin/fmt-merge-msg.c2
-rw-r--r--builtin/fsck.c32
-rw-r--r--builtin/grep.c4
-rw-r--r--builtin/index-pack.c8
-rw-r--r--builtin/log.c18
-rw-r--r--builtin/merge-base.c8
-rw-r--r--builtin/merge-tree.c2
-rw-r--r--builtin/merge.c10
-rw-r--r--builtin/name-rev.c8
-rw-r--r--builtin/pack-objects.c2
-rw-r--r--builtin/pull.c2
-rw-r--r--builtin/replace.c6
-rw-r--r--builtin/reset.c28
-rw-r--r--builtin/rev-list.c14
-rw-r--r--builtin/shortlog.c2
-rw-r--r--builtin/show-branch.c4
-rw-r--r--builtin/unpack-objects.c8
-rw-r--r--builtin/worktree.c2
-rw-r--r--bundle.c18
-rw-r--r--commit.c20
-rw-r--r--fetch-pack.c2
-rw-r--r--fsck.c8
-rw-r--r--http-backend.c2
-rw-r--r--http-push.c22
-rw-r--r--list-objects.c4
-rw-r--r--log-tree.c20
-rw-r--r--merge-recursive.c14
-rw-r--r--merge.c2
-rw-r--r--notes-merge.c4
-rw-r--r--object.c2
-rw-r--r--object.h4
-rw-r--r--pack-bitmap-write.c2
-rw-r--r--pack-bitmap.c8
-rw-r--r--pretty.c10
-rw-r--r--ref-filter.c8
-rw-r--r--remote.c4
-rw-r--r--revision.c32
-rw-r--r--sequencer.c22
-rw-r--r--server-info.c2
-rw-r--r--sha1_name.c4
-rw-r--r--shallow.c4
-rw-r--r--submodule.c6
-rw-r--r--tag.c4
-rw-r--r--tree.c6
-rw-r--r--upload-pack.c16
-rw-r--r--walker.c8
54 files changed, 256 insertions, 256 deletions
diff --git a/bisect.c b/bisect.c
index 59e8636927..54166f008a 100644
--- a/bisect.c
+++ b/bisect.c
@@ -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)
@@ -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;
diff --git a/builtin/am.c b/builtin/am.c
index f1a25ab6ad..9fb42fdd71 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -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);
}
diff --git a/builtin/blame.c b/builtin/blame.c
index c6ea9774b7..28c48bd453 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -557,7 +557,7 @@ 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))
+ if (is_null_oid(&origin->commit->object.oid))
do_diff_cache(get_object_hash(parent->tree->object), &diff_opts);
else
diff_tree_sha1(get_object_hash(parent->tree->object),
@@ -627,7 +627,7 @@ 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))
+ if (is_null_oid(&origin->commit->object.oid))
do_diff_cache(get_object_hash(parent->tree->object), &diff_opts);
else
diff_tree_sha1(get_object_hash(parent->tree->object),
@@ -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,7 +1275,7 @@ 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))
+ if (is_null_oid(&target->commit->object.oid))
do_diff_cache(get_object_hash(parent->tree->object), &diff_opts);
else
diff_tree_sha1(get_object_hash(parent->tree->object),
@@ -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++) {
@@ -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;
}
@@ -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"
@@ -2740,7 +2740,7 @@ parse_done:
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;
@@ -2750,11 +2750,11 @@ parse_done:
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;
diff --git a/builtin/checkout.c b/builtin/checkout.c
index bca3a04c07..50fd893f7a 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -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. */
@@ -513,7 +513,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
get_object_hash(old->commit->object) :
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)
@@ -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;
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 8747c0f2fb..3feeffeab1 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -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;
diff --git a/builtin/describe.c b/builtin/describe.c
index c0c373b418..11f7300aad 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -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,7 +374,7 @@ 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));
}
}
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index cf7e9604b3..6fef266ea3 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -49,8 +49,8 @@ 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));
+ printf("%s %s\n", oid_to_hex(&tree1->object.oid),
+ oid_to_hex(&tree2->object.oid));
diff_tree_sha1(get_object_hash(tree1->object), get_object_hash(tree2->object),
"", &log_tree_opt.diffopt);
log_tree_diff_flush(&log_tree_opt);
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 30faf248f7..1337a2385a 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -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");
@@ -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(get_object_hash(tag->object), &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:
warning ("Exporting signed tag %s",
- sha1_to_hex(tag->object.sha1));
+ oid_to_hex(&tag->object.oid));
/* fallthru */
case VERBATIM:
break;
case WARN_STRIP:
warning ("Stripping signature from tag %s",
- sha1_to_hex(tag->object.sha1));
+ oid_to_hex(&tag->object.oid));
/* fallthru */
case STRIP:
message_size = signature + 1 - message;
@@ -731,14 +731,14 @@ static void handle_tag(const char *name, struct tag *tag)
case ABORT:
die ("Tag %s tags unexported object; use "
"--tag-of-filtered-object=<mode> to handle it.",
- sha1_to_hex(tag->object.sha1));
+ oid_to_hex(&tag->object.oid));
case DROP:
/* Ignore this tag altogether */
return;
case REWRITE:
if (tagged->type != OBJ_COMMIT) {
die ("Tag %s tags unexported %s!",
- sha1_to_hex(tag->object.sha1),
+ oid_to_hex(&tag->object.oid),
typename(tagged->type));
}
p = (struct commit *)tagged;
@@ -751,7 +751,7 @@ static void handle_tag(const char *name, struct tag *tag)
break;
if (!p->parents)
die ("Can't find replacement commit for tag %s\n",
- sha1_to_hex(tag->object.sha1));
+ oid_to_hex(&tag->object.oid));
p = p->parents->item;
}
tagged_mark = get_object_mark(&p->object);
@@ -888,7 +888,7 @@ static void export_marks(char *file)
if (deco->base && deco->base->type == 1) {
mark = ptr_to_mark(deco->decoration);
if (fprintf(f, ":%"PRIu32" %s\n", mark,
- sha1_to_hex(deco->base->sha1)) < 0) {
+ oid_to_hex(&deco->base->oid)) < 0) {
e = 1;
break;
}
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index a1505002bd..12aba984eb 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -378,7 +378,7 @@ static void shortlog(const char *name,
if (!sb.len)
string_list_append(&subjects,
- sha1_to_hex(commit->object.sha1));
+ oid_to_hex(&commit->object.oid));
else
string_list_append(&subjects, strbuf_detach(&sb, NULL));
}
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 40206696cf..7bfb4938fb 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -67,7 +67,7 @@ static void objreport(struct object *obj, const char *msg_type,
const char *err)
{
fprintf(stderr, "%s in %s %s: %s\n",
- msg_type, typename(obj->type), sha1_to_hex(obj->sha1), err);
+ msg_type, typename(obj->type), oid_to_hex(&obj->oid), err);
}
static int objerror(struct object *obj, const char *err)
@@ -97,7 +97,7 @@ static int mark_object(struct object *obj, int type, void *data, struct fsck_opt
if (!obj) {
/* ... these references to parent->fld are safe here */
printf("broken link from %7s %s\n",
- typename(parent->type), sha1_to_hex(parent->sha1));
+ typename(parent->type), oid_to_hex(&parent->oid));
printf("broken link from %7s %s\n",
(type == OBJ_ANY ? "unknown" : typename(type)), "unknown");
errors_found |= ERROR_REACHABLE;
@@ -112,11 +112,11 @@ static int mark_object(struct object *obj, int type, void *data, struct fsck_opt
return 0;
obj->flags |= REACHABLE;
if (!(obj->flags & HAS_OBJ)) {
- if (parent && !has_sha1_file(obj->sha1)) {
+ if (parent && !has_object_file(&obj->oid)) {
printf("broken link from %7s %s\n",
- typename(parent->type), sha1_to_hex(parent->sha1));
+ typename(parent->type), oid_to_hex(&parent->oid));
printf(" to %7s %s\n",
- typename(obj->type), sha1_to_hex(obj->sha1));
+ typename(obj->type), oid_to_hex(&obj->oid));
errors_found |= ERROR_REACHABLE;
}
return 1;
@@ -188,9 +188,9 @@ static void check_reachable_object(struct object *obj)
if (!(obj->flags & HAS_OBJ)) {
if (has_sha1_pack(get_object_hash(*obj)))
return; /* it is in pack - forget about it */
- if (connectivity_only && has_sha1_file(obj->sha1))
+ if (connectivity_only && has_object_file(&obj->oid))
return;
- printf("missing %s %s\n", typename(obj->type), sha1_to_hex(obj->sha1));
+ printf("missing %s %s\n", typename(obj->type), oid_to_hex(&obj->oid));
errors_found |= ERROR_REACHABLE;
return;
}
@@ -215,7 +215,7 @@ static void check_unreachable_object(struct object *obj)
* since this is something that is prunable.
*/
if (show_unreachable) {
- printf("unreachable %s %s\n", typename(obj->type), sha1_to_hex(obj->sha1));
+ printf("unreachable %s %s\n", typename(obj->type), oid_to_hex(&obj->oid));
return;
}
@@ -234,11 +234,11 @@ static void check_unreachable_object(struct object *obj)
if (!obj->used) {
if (show_dangling)
printf("dangling %s %s\n", typename(obj->type),
- sha1_to_hex(obj->sha1));
+ oid_to_hex(&obj->oid));
if (write_lost_and_found) {
char *filename = git_pathdup("lost-found/%s/%s",
obj->type == OBJ_COMMIT ? "commit" : "other",
- sha1_to_hex(obj->sha1));
+ oid_to_hex(&obj->oid));
FILE *f;
if (safe_create_leading_directories_const(filename)) {
@@ -252,7 +252,7 @@ static void check_unreachable_object(struct object *obj)
if (stream_blob_to_fd(fileno(f), get_object_hash(*obj), NULL, 1))
die_errno("Could not write '%s'", filename);
} else
- fprintf(f, "%s\n", sha1_to_hex(obj->sha1));
+ fprintf(f, "%s\n", oid_to_hex(&obj->oid));
if (fclose(f))
die_errno("Could not finish '%s'",
filename);
@@ -271,7 +271,7 @@ static void check_unreachable_object(struct object *obj)
static void check_object(struct object *obj)
{
if (verbose)
- fprintf(stderr, "Checking %s\n", sha1_to_hex(obj->sha1));
+ fprintf(stderr, "Checking %s\n", oid_to_hex(&obj->oid));
if (obj->flags & REACHABLE)
check_reachable_object(obj);
@@ -307,7 +307,7 @@ static int fsck_obj(struct object *obj)
if (verbose)
fprintf(stderr, "Checking %s %s\n",
- typename(obj->type), sha1_to_hex(obj->sha1));
+ typename(obj->type), oid_to_hex(&obj->oid));
if (fsck_walk(obj, NULL, &fsck_obj_options))
objerror(obj, "broken links");
@@ -326,15 +326,15 @@ static int fsck_obj(struct object *obj)
free_commit_buffer(commit);
if (!commit->parents && show_root)
- printf("root %s\n", sha1_to_hex(commit->object.sha1));
+ printf("root %s\n", oid_to_hex(&commit->object.oid));
}
if (obj->type == OBJ_TAG) {
struct tag *tag = (struct tag *) obj;
if (show_tags && tag->tagged) {
- printf("tagged %s %s", typename(tag->tagged->type), sha1_to_hex(tag->tagged->sha1));
- printf(" (%s) in %s\n", tag->tag, sha1_to_hex(tag->object.sha1));
+ printf("tagged %s %s", typename(tag->tagged->type), oid_to_hex(&tag->tagged->oid));
+ printf(" (%s) in %s\n", tag->tag, oid_to_hex(&tag->object.oid));
}
}
diff --git a/builtin/grep.c b/builtin/grep.c
index 9c42fc03b9..ca3ceea42c 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -468,12 +468,12 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
int hit, len;
grep_read_lock();
- data = read_object_with_reference(obj->sha1, tree_type,
+ data = read_object_with_reference(obj->oid.hash, tree_type,
&size, NULL);
grep_read_unlock();
if (!data)
- die(_("unable to read tree (%s)"), sha1_to_hex(obj->sha1));
+ die(_("unable to read tree (%s)"), oid_to_hex(&obj->oid));
len = name ? strlen(name) : 0;
strbuf_init(&base, PATH_MAX + len + 1);
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index b01a8c0e22..48b470dd7a 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -199,7 +199,7 @@ static int mark_link(struct object *obj, int type, void *data, struct fsck_optio
return -1;
if (type != OBJ_ANY && obj->type != type)
- die(_("object type mismatch at %s"), sha1_to_hex(obj->sha1));
+ die(_("object type mismatch at %s"), oid_to_hex(&obj->oid));
obj->flags |= FLAG_LINK;
return 0;
@@ -220,10 +220,10 @@ static unsigned check_object(struct object *obj)
int type = sha1_object_info(get_object_hash(*obj), &size);
if (type <= 0)
die(_("did not receive expected object %s"),
- sha1_to_hex(obj->sha1));
+ oid_to_hex(&obj->oid));
if (type != obj->type)