Skip to content

Commit

Permalink
Merge branch 'rs/object-id'
Browse files Browse the repository at this point in the history
"uchar [40]" to "struct object_id" conversion continues.

* rs/object-id:
  checkout: convert post_checkout_hook() to struct object_id
  use oidcpy() for copying hashes between instances of struct object_id
  use oid_to_hex_r() for converting struct object_id hashes to hex strings
  • Loading branch information
gitster committed Feb 3, 2017
2 parents ecc486b + 0ce11fe commit 36acf41
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions builtin/blame.c
Expand Up @@ -1901,7 +1901,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.oid.hash);
oid_to_hex_r(hex, &suspect->commit->object.oid);
printf("%s %d %d %d\n",
hex,
ent->s_lno + 1,
Expand Down Expand Up @@ -1941,7 +1941,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.oid.hash);
oid_to_hex_r(hex, &suspect->commit->object.oid);

cp = nth_line(sb, ent->lno);
for (cnt = 0; cnt < ent->num_lines; cnt++) {
Expand Down
4 changes: 2 additions & 2 deletions builtin/checkout.c
Expand Up @@ -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.oid.hash : null_sha1),
sha1_to_hex(new ? new->object.oid.hash : null_sha1),
oid_to_hex(old ? &old->object.oid : &null_oid),
oid_to_hex(new ? &new->object.oid : &null_oid),
changed ? "1" : "0", NULL);
/* "new" can be NULL when checking out from the index before
a commit exists. */
Expand Down
2 changes: 1 addition & 1 deletion builtin/merge-index.c
Expand Up @@ -22,7 +22,7 @@ static int merge_entry(int pos, const char *path)
if (strcmp(ce->name, path))
break;
found++;
sha1_to_hex_r(hexbuf[stage], ce->oid.hash);
oid_to_hex_r(hexbuf[stage], &ce->oid);
xsnprintf(ownbuf[stage], sizeof(ownbuf[stage]), "%o", ce->ce_mode);
arguments[stage] = hexbuf[stage];
arguments[stage + 4] = ownbuf[stage];
Expand Down
2 changes: 1 addition & 1 deletion builtin/rev-list.c
Expand Up @@ -237,7 +237,7 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
cnt = reaches;

if (revs->commits)
sha1_to_hex_r(hex, revs->commits->item->object.oid.hash);
oid_to_hex_r(hex, &revs->commits->item->object.oid);

if (flags & BISECT_SHOW_ALL) {
traverse_commit_list(revs, show_commit, show_object, info);
Expand Down
2 changes: 1 addition & 1 deletion diff.c
Expand Up @@ -3015,7 +3015,7 @@ static struct diff_tempfile *prepare_temp_file(const char *name,
if (!one->oid_valid)
sha1_to_hex_r(temp->hex, null_sha1);
else
sha1_to_hex_r(temp->hex, one->oid.hash);
oid_to_hex_r(temp->hex, &one->oid);
/* Even though we may sometimes borrow the
* contents from the work tree, we always want
* one->mode. mode is trustworthy even when
Expand Down
2 changes: 1 addition & 1 deletion refs/files-backend.c
Expand Up @@ -697,7 +697,7 @@ static int cache_ref_iterator_peel(struct ref_iterator *ref_iterator,

if (peel_entry(entry, 0))
return -1;
hashcpy(peeled->hash, entry->u.value.peeled.hash);
oidcpy(peeled, &entry->u.value.peeled);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions wt-status.c
Expand Up @@ -628,7 +628,7 @@ static void wt_status_collect_changes_initial(struct wt_status *s)
d->index_status = DIFF_STATUS_ADDED;
/* Leave {mode,oid}_head zero for adds. */
d->mode_index = ce->ce_mode;
hashcpy(d->oid_index.hash, ce->oid.hash);
oidcpy(&d->oid_index, &ce->oid);
}
}
}
Expand Down Expand Up @@ -2102,7 +2102,7 @@ static void wt_porcelain_v2_print_unmerged_entry(
if (strcmp(ce->name, it->string) || !stage)
break;
stages[stage - 1].mode = ce->ce_mode;
hashcpy(stages[stage - 1].oid.hash, ce->oid.hash);
oidcpy(&stages[stage - 1].oid, &ce->oid);
sum |= (1 << (stage - 1));
}
if (sum != d->stagemask)
Expand Down

0 comments on commit 36acf41

Please sign in to comment.