{"thread":{"id":"44998","subject":"[PATCH] use oid_to_hex_r() for converting struct object_id hashes to hex strings","startedAt":"2017-01-28T22:37:02Z","lastAt":"2017-01-28T22:37:02Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"310501","messageId":"ea6aa07a-3fdc-fcca-706f-4a64a0b354b6@web.de","threadId":"44998","inReplyTo":null,"subject":"[PATCH] use oid_to_hex_r() for converting struct object_id hashes to hex strings","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2017-01-28T22:03:03Z","receivedAt":"2017-01-28T22:37:02Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Patch generated by Coccinelle and contrib/coccinelle/object_id.cocci.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n builtin/blame.c       | 4 ++--\n builtin/merge-index.c | 2 +-\n builtin/rev-list.c    | 2 +-\n diff.c                | 2 +-\n 4 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 126b8c9e5b..cffc626540 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -1901,7 +1901,7 @@ static void emit_porcelain(struct scoreboard *sb, struct blame_entry *ent,\n \tstruct origin *suspect = ent->suspect;\n \tchar hex[GIT_SHA1_HEXSZ + 1];\n \n-\tsha1_to_hex_r(hex, suspect->commit->object.oid.hash);\n+\toid_to_hex_r(hex, &suspect->commit->object.oid);\n \tprintf(\"%s %d %d %d\\n\",\n \t       hex,\n \t       ent->s_lno + 1,\n@@ -1941,7 +1941,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)\n \tint show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP);\n \n \tget_commit_info(suspect->commit, &ci, 1);\n-\tsha1_to_hex_r(hex, suspect->commit->object.oid.hash);\n+\toid_to_hex_r(hex, &suspect->commit->object.oid);\n \n \tcp = nth_line(sb, ent->lno);\n \tfor (cnt = 0; cnt < ent->num_lines; cnt++) {\ndiff --git a/builtin/merge-index.c b/builtin/merge-index.c\nindex ce356b1da1..2d1b6db6bd 100644\n--- a/builtin/merge-index.c\n+++ b/builtin/merge-index.c\n@@ -22,7 +22,7 @@ static int merge_entry(int pos, const char *path)\n \t\tif (strcmp(ce->name, path))\n \t\t\tbreak;\n \t\tfound++;\n-\t\tsha1_to_hex_r(hexbuf[stage], ce->oid.hash);\n+\t\toid_to_hex_r(hexbuf[stage], &ce->oid);\n \t\txsnprintf(ownbuf[stage], sizeof(ownbuf[stage]), \"%o\", ce->ce_mode);\n \t\targuments[stage] = hexbuf[stage];\n \t\targuments[stage + 4] = ownbuf[stage];\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex c43decda70..0aa93d5891 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -237,7 +237,7 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)\n \t\tcnt = reaches;\n \n \tif (revs->commits)\n-\t\tsha1_to_hex_r(hex, revs->commits->item->object.oid.hash);\n+\t\toid_to_hex_r(hex, &revs->commits->item->object.oid);\n \n \tif (flags & BISECT_SHOW_ALL) {\n \t\ttraverse_commit_list(revs, show_commit, show_object, info);\ndiff --git a/diff.c b/diff.c\nindex f08cd8e033..d91a344908 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -3015,7 +3015,7 @@ static struct diff_tempfile *prepare_temp_file(const char *name,\n \t\t\tif (!one->oid_valid)\n \t\t\t\tsha1_to_hex_r(temp->hex, null_sha1);\n \t\t\telse\n-\t\t\t\tsha1_to_hex_r(temp->hex, one->oid.hash);\n+\t\t\t\toid_to_hex_r(temp->hex, &one->oid);\n \t\t\t/* Even though we may sometimes borrow the\n \t\t\t * contents from the work tree, we always want\n \t\t\t * one->mode.  mode is trustworthy even when\n-- \n2.11.0\n\n"}]}