Skip to content

Commit 36acf41

Browse files
committed
Merge branch 'rs/object-id'
"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
2 parents ecc486b + 0ce11fe commit 36acf41

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

builtin/blame.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,7 +1901,7 @@ static void emit_porcelain(struct scoreboard *sb, struct blame_entry *ent,
19011901
struct origin *suspect = ent->suspect;
19021902
char hex[GIT_SHA1_HEXSZ + 1];
19031903

1904-
sha1_to_hex_r(hex, suspect->commit->object.oid.hash);
1904+
oid_to_hex_r(hex, &suspect->commit->object.oid);
19051905
printf("%s %d %d %d\n",
19061906
hex,
19071907
ent->s_lno + 1,
@@ -1941,7 +1941,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
19411941
int show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP);
19421942

19431943
get_commit_info(suspect->commit, &ci, 1);
1944-
sha1_to_hex_r(hex, suspect->commit->object.oid.hash);
1944+
oid_to_hex_r(hex, &suspect->commit->object.oid);
19451945

19461946
cp = nth_line(sb, ent->lno);
19471947
for (cnt = 0; cnt < ent->num_lines; cnt++) {

builtin/checkout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ static int post_checkout_hook(struct commit *old, struct commit *new,
5656
int changed)
5757
{
5858
return run_hook_le(NULL, "post-checkout",
59-
sha1_to_hex(old ? old->object.oid.hash : null_sha1),
60-
sha1_to_hex(new ? new->object.oid.hash : null_sha1),
59+
oid_to_hex(old ? &old->object.oid : &null_oid),
60+
oid_to_hex(new ? &new->object.oid : &null_oid),
6161
changed ? "1" : "0", NULL);
6262
/* "new" can be NULL when checking out from the index before
6363
a commit exists. */

builtin/merge-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static int merge_entry(int pos, const char *path)
2222
if (strcmp(ce->name, path))
2323
break;
2424
found++;
25-
sha1_to_hex_r(hexbuf[stage], ce->oid.hash);
25+
oid_to_hex_r(hexbuf[stage], &ce->oid);
2626
xsnprintf(ownbuf[stage], sizeof(ownbuf[stage]), "%o", ce->ce_mode);
2727
arguments[stage] = hexbuf[stage];
2828
arguments[stage + 4] = ownbuf[stage];

builtin/rev-list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
237237
cnt = reaches;
238238

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

242242
if (flags & BISECT_SHOW_ALL) {
243243
traverse_commit_list(revs, show_commit, show_object, info);

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3015,7 +3015,7 @@ static struct diff_tempfile *prepare_temp_file(const char *name,
30153015
if (!one->oid_valid)
30163016
sha1_to_hex_r(temp->hex, null_sha1);
30173017
else
3018-
sha1_to_hex_r(temp->hex, one->oid.hash);
3018+
oid_to_hex_r(temp->hex, &one->oid);
30193019
/* Even though we may sometimes borrow the
30203020
* contents from the work tree, we always want
30213021
* one->mode. mode is trustworthy even when

refs/files-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ static int cache_ref_iterator_peel(struct ref_iterator *ref_iterator,
697697

698698
if (peel_entry(entry, 0))
699699
return -1;
700-
hashcpy(peeled->hash, entry->u.value.peeled.hash);
700+
oidcpy(peeled, &entry->u.value.peeled);
701701
return 0;
702702
}
703703

wt-status.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ static void wt_status_collect_changes_initial(struct wt_status *s)
628628
d->index_status = DIFF_STATUS_ADDED;
629629
/* Leave {mode,oid}_head zero for adds. */
630630
d->mode_index = ce->ce_mode;
631-
hashcpy(d->oid_index.hash, ce->oid.hash);
631+
oidcpy(&d->oid_index, &ce->oid);
632632
}
633633
}
634634
}
@@ -2102,7 +2102,7 @@ static void wt_porcelain_v2_print_unmerged_entry(
21022102
if (strcmp(ce->name, it->string) || !stage)
21032103
break;
21042104
stages[stage - 1].mode = ce->ce_mode;
2105-
hashcpy(stages[stage - 1].oid.hash, ce->oid.hash);
2105+
oidcpy(&stages[stage - 1].oid, &ce->oid);
21062106
sum |= (1 << (stage - 1));
21072107
}
21082108
if (sum != d->stagemask)

0 commit comments

Comments
 (0)