Skip to content

Commit 2490574

Browse files
rscharfegitster
authored andcommitted
use oid_to_hex_r() for converting struct object_id hashes to hex strings
Patch generated by Coccinelle and contrib/coccinelle/object_id.cocci. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4e59582 commit 2490574

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
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/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

0 commit comments

Comments
 (0)