{"thread":{"id":"46307","subject":"[PATCH 01/12] builtin/fsck: convert remaining caller of get_sha1 to object_id","startedAt":"2017-07-03T18:55:57Z","lastAt":"2017-07-07T21:22:13Z","messageCount":20,"participants":["brian m. carlson","Ævar Arnfjörð Bjarmason","Junio C Hamano","Stefan Beller"],"isPatch":true,"patchVersion":1,"patchTotal":12},"messages":[{"id":"323759","messageId":"20170703185533.51530-2-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 01/12] builtin/fsck: convert remaining caller of get_sha1 to object_id","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:22Z","receivedAt":"2017-07-03T18:55:57Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/fsck.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex 87c675689..d601d07fd 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -738,12 +738,12 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)\n \theads = 0;\n \tfor (i = 0; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n-\t\tunsigned char sha1[20];\n-\t\tif (!get_sha1(arg, sha1)) {\n-\t\t\tstruct object *obj = lookup_object(sha1);\n+\t\tstruct object_id oid;\n+\t\tif (!get_oid(arg, &oid)) {\n+\t\t\tstruct object *obj = lookup_object(oid.hash);\n \n \t\t\tif (!obj || !(obj->flags & HAS_OBJ)) {\n-\t\t\t\terror(\"%s: object missing\", sha1_to_hex(sha1));\n+\t\t\t\terror(\"%s: object missing\", oid_to_hex(&oid));\n \t\t\t\terrors_found |= ERROR_OBJECT;\n \t\t\t\tcontinue;\n \t\t\t}\n"},{"id":"323760","messageId":"20170703185533.51530-1-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":null,"subject":"[PATCH 00/12] object_id part 9","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:21Z","receivedAt":"2017-07-03T18:55:58Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This is the ninth in a series of series to convert Git to use struct\nobject_id.  This series converts the remaining callers of get_sha1 and\nfriends to take and use struct object_id, and in doing so, renames them\nto get_oid and friends.\n\nIt is possible there will be some other conflicts with in flight topics,\nas get_sha1 is commonly used in the codebase.  This is unavoidable to\nsome extent, but should be kept in mind.  My experience is that usually\nthe required changes for conversion are minimal.\n\nThis series is much reduced in size thanks to the conversion work done\nby Brandon Williams in his earlier series touching the notes code.\n\nbrian m. carlson (12):\n  builtin/fsck: convert remaining caller of get_sha1 to object_id\n  builtin/merge-tree: convert remaining caller of get_sha1 to object_id\n  submodule: convert submodule config lookup to use object_id\n  remote: convert struct push_cas to struct object_id\n  sequencer: convert to struct object_id\n  builtin/update_ref: convert to struct object_id\n  bisect: convert bisect_checkout to struct object_id\n  builtin/unpack-file: convert to struct object_id\n  builtin/verify-tag: convert to struct object_id\n  Convert remaining callers of get_sha1 to get_oid.\n  sha1_name: convert get_sha1* to get_oid*\n  sha1_name: convert GET_SHA1* flags to GET_OID*\n\n apply.c                          |   4 +-\n archive.c                        |   2 +-\n bisect.c                         |  18 +--\n builtin/am.c                     |   6 +-\n builtin/cat-file.c               |   8 +-\n builtin/commit-tree.c            |   4 +-\n builtin/commit.c                 |   8 +-\n builtin/fsck.c                   |   8 +-\n builtin/grep.c                   |   8 +-\n builtin/log.c                    |   4 +-\n builtin/merge-tree.c             |   6 +-\n builtin/receive-pack.c           |   4 +-\n builtin/replace.c                |   4 +-\n builtin/reset.c                  |  10 +-\n builtin/rev-parse.c              |   8 +-\n builtin/show-branch.c            |   8 +-\n builtin/submodule--helper.c      |   8 +-\n builtin/unpack-file.c            |  12 +-\n builtin/update-ref.c             |  69 ++++++------\n builtin/verify-tag.c             |   8 +-\n cache.h                          |  45 ++++----\n commit.c                         |   4 +-\n config.c                         |  12 +-\n config.h                         |   4 +-\n mailmap.c                        |   6 +-\n notes.c                          |   2 +-\n refs.c                           |   2 +-\n remote.c                         |   8 +-\n remote.h                         |   2 +-\n revision.c                       |  16 +--\n sequencer.c                      |  65 +++++------\n sha1_name.c                      | 234 +++++++++++++++++++--------------------\n submodule-config.c               |  36 +++---\n submodule-config.h               |  10 +-\n submodule.c                      |  32 +++---\n submodule.h                      |   2 +-\n t/helper/test-submodule-config.c |  10 +-\n transport-helper.c               |   2 +-\n 38 files changed, 345 insertions(+), 354 deletions(-)\n\n"},{"id":"323761","messageId":"20170703185533.51530-8-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 07/12] bisect: convert bisect_checkout to struct object_id","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:28Z","receivedAt":"2017-07-03T18:56:00Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n bisect.c | 18 +++++++++---------\n 1 file changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex a9fd9fbc6..2549eaf7b 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -680,16 +680,16 @@ static int is_expected_rev(const struct object_id *oid)\n \treturn res;\n }\n \n-static int bisect_checkout(const unsigned char *bisect_rev, int no_checkout)\n+static int bisect_checkout(const struct object_id *bisect_rev, int no_checkout)\n {\n \tchar bisect_rev_hex[GIT_MAX_HEXSZ + 1];\n \n-\tmemcpy(bisect_rev_hex, sha1_to_hex(bisect_rev), GIT_SHA1_HEXSZ + 1);\n-\tupdate_ref(NULL, \"BISECT_EXPECTED_REV\", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);\n+\tmemcpy(bisect_rev_hex, oid_to_hex(bisect_rev), GIT_SHA1_HEXSZ + 1);\n+\tupdate_ref(NULL, \"BISECT_EXPECTED_REV\", bisect_rev->hash, NULL, 0, UPDATE_REFS_DIE_ON_ERR);\n \n \targv_checkout[2] = bisect_rev_hex;\n \tif (no_checkout) {\n-\t\tupdate_ref(NULL, \"BISECT_HEAD\", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);\n+\t\tupdate_ref(NULL, \"BISECT_HEAD\", bisect_rev->hash, NULL, 0, UPDATE_REFS_DIE_ON_ERR);\n \t} else {\n \t\tint res;\n \t\tres = run_command_v_opt(argv_checkout, RUN_GIT_CMD);\n@@ -796,7 +796,7 @@ static void check_merge_bases(int no_checkout)\n \t\t\thandle_skipped_merge_base(mb);\n \t\t} else {\n \t\t\tprintf(_(\"Bisecting: a merge base must be tested\\n\"));\n-\t\t\texit(bisect_checkout(mb->hash, no_checkout));\n+\t\t\texit(bisect_checkout(mb, no_checkout));\n \t\t}\n \t}\n \n@@ -939,7 +939,7 @@ int bisect_next_all(const char *prefix, int no_checkout)\n \tstruct rev_info revs;\n \tstruct commit_list *tried;\n \tint reaches = 0, all = 0, nr, steps;\n-\tconst unsigned char *bisect_rev;\n+\tstruct object_id *bisect_rev;\n \tchar *steps_msg;\n \n \tread_bisect_terms(&term_bad, &term_good);\n@@ -977,11 +977,11 @@ int bisect_next_all(const char *prefix, int no_checkout)\n \t\texit(4);\n \t}\n \n-\tbisect_rev = revs.commits->item->object.oid.hash;\n+\tbisect_rev = &revs.commits->item->object.oid;\n \n-\tif (!hashcmp(bisect_rev, current_bad_oid->hash)) {\n+\tif (!oidcmp(bisect_rev, current_bad_oid)) {\n \t\texit_if_skipped_commits(tried, current_bad_oid);\n-\t\tprintf(\"%s is the first %s commit\\n\", sha1_to_hex(bisect_rev),\n+\t\tprintf(\"%s is the first %s commit\\n\", oid_to_hex(bisect_rev),\n \t\t\tterm_bad);\n \t\tshow_diff_tree(prefix, revs.commits->item);\n \t\t/* This means the bisection process succeeded. */\n"},{"id":"323762","messageId":"20170703185533.51530-6-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 05/12] sequencer: convert to struct object_id","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:26Z","receivedAt":"2017-07-03T18:56:01Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Convert the remaining instances of unsigned char * to struct object_id.\nThis removes several calls to get_sha1.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n sequencer.c | 59 ++++++++++++++++++++++++++++++-----------------------------\n 1 file changed, 30 insertions(+), 29 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 3010faf86..16d48a4fb 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -691,7 +691,7 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,\n \n static int is_original_commit_empty(struct commit *commit)\n {\n-\tconst unsigned char *ptree_sha1;\n+\tconst struct object_id *ptree_oid;\n \n \tif (parse_commit(commit))\n \t\treturn error(_(\"could not parse commit %s\\n\"),\n@@ -701,12 +701,12 @@ static int is_original_commit_empty(struct commit *commit)\n \t\tif (parse_commit(parent))\n \t\t\treturn error(_(\"could not parse parent commit %s\\n\"),\n \t\t\t\toid_to_hex(&parent->object.oid));\n-\t\tptree_sha1 = parent->tree->object.oid.hash;\n+\t\tptree_oid = &parent->tree->object.oid;\n \t} else {\n-\t\tptree_sha1 = EMPTY_TREE_SHA1_BIN; /* commit is root */\n+\t\tptree_oid = &empty_tree_oid; /* commit is root */\n \t}\n \n-\treturn !hashcmp(ptree_sha1, commit->tree->object.oid.hash);\n+\treturn !oidcmp(ptree_oid, &commit->tree->object.oid);\n }\n \n /*\n@@ -896,18 +896,18 @@ static int update_squash_messages(enum todo_command command,\n \n static void flush_rewritten_pending(void) {\n \tstruct strbuf buf = STRBUF_INIT;\n-\tunsigned char newsha1[20];\n+\tstruct object_id newoid;\n \tFILE *out;\n \n-\tif (strbuf_read_file(&buf, rebase_path_rewritten_pending(), 82) > 0 &&\n-\t    !get_sha1(\"HEAD\", newsha1) &&\n+\tif (strbuf_read_file(&buf, rebase_path_rewritten_pending(), (GIT_MAX_HEXSZ + 1) * 2) > 0 &&\n+\t    !get_oid(\"HEAD\", &newoid) &&\n \t    (out = fopen_or_warn(rebase_path_rewritten_list(), \"a\"))) {\n \t\tchar *bol = buf.buf, *eol;\n \n \t\twhile (*bol) {\n \t\t\teol = strchrnul(bol, '\\n');\n \t\t\tfprintf(out, \"%.*s %s\\n\", (int)(eol - bol),\n-\t\t\t\t\tbol, sha1_to_hex(newsha1));\n+\t\t\t\t\tbol, oid_to_hex(&newoid));\n \t\t\tif (!*eol)\n \t\t\t\tbreak;\n \t\t\tbol = eol + 1;\n@@ -1594,36 +1594,37 @@ static int rollback_is_safe(void)\n \treturn !oidcmp(&actual_head, &expected_head);\n }\n \n-static int reset_for_rollback(const unsigned char *sha1)\n+static int reset_for_rollback(const struct object_id *oid)\n {\n \tconst char *argv[4];\t/* reset --merge <arg> + NULL */\n \n \targv[0] = \"reset\";\n \targv[1] = \"--merge\";\n-\targv[2] = sha1_to_hex(sha1);\n+\targv[2] = oid_to_hex(oid);\n \targv[3] = NULL;\n \treturn run_command_v_opt(argv, RUN_GIT_CMD);\n }\n \n static int rollback_single_pick(void)\n {\n-\tunsigned char head_sha1[20];\n+\tstruct object_id head_oid;\n \n \tif (!file_exists(git_path_cherry_pick_head()) &&\n \t    !file_exists(git_path_revert_head()))\n \t\treturn error(_(\"no cherry-pick or revert in progress\"));\n-\tif (read_ref_full(\"HEAD\", 0, head_sha1, NULL))\n+\tif (read_ref_full(\"HEAD\", 0, head_oid.hash, NULL))\n \t\treturn error(_(\"cannot resolve HEAD\"));\n-\tif (is_null_sha1(head_sha1))\n+\tif (is_null_oid(&head_oid))\n \t\treturn error(_(\"cannot abort from a branch yet to be born\"));\n-\treturn reset_for_rollback(head_sha1);\n+\treturn reset_for_rollback(&head_oid);\n }\n \n int sequencer_rollback(struct replay_opts *opts)\n {\n \tFILE *f;\n-\tunsigned char sha1[20];\n+\tstruct object_id oid;\n \tstruct strbuf buf = STRBUF_INIT;\n+\tconst char *p;\n \n \tf = fopen(git_path_head_file(), \"r\");\n \tif (!f && errno == ENOENT) {\n@@ -1643,12 +1644,12 @@ int sequencer_rollback(struct replay_opts *opts)\n \t\tgoto fail;\n \t}\n \tfclose(f);\n-\tif (get_sha1_hex(buf.buf, sha1) || buf.buf[40] != '\\0') {\n+\tif (parse_oid_hex(buf.buf, &oid, &p) || *p != '\\0') {\n \t\terror(_(\"stored pre-cherry-pick HEAD file '%s' is corrupt\"),\n \t\t\tgit_path_head_file());\n \t\tgoto fail;\n \t}\n-\tif (is_null_sha1(sha1)) {\n+\tif (is_null_oid(&oid)) {\n \t\terror(_(\"cannot abort from a branch yet to be born\"));\n \t\tgoto fail;\n \t}\n@@ -1658,7 +1659,7 @@ int sequencer_rollback(struct replay_opts *opts)\n \t\twarning(_(\"You seem to have moved HEAD. \"\n \t\t\t  \"Not rewinding, check your HEAD!\"));\n \t} else\n-\tif (reset_for_rollback(sha1))\n+\tif (reset_for_rollback(&oid))\n \t\tgoto fail;\n \tstrbuf_release(&buf);\n \treturn sequencer_remove_state(opts);\n@@ -1788,13 +1789,13 @@ static int make_patch(struct commit *commit, struct replay_opts *opts)\n \n static int intend_to_amend(void)\n {\n-\tunsigned char head[20];\n+\tstruct object_id head;\n \tchar *p;\n \n-\tif (get_sha1(\"HEAD\", head))\n+\tif (get_oid(\"HEAD\", &head))\n \t\treturn error(_(\"cannot read HEAD\"));\n \n-\tp = sha1_to_hex(head);\n+\tp = oid_to_hex(&head);\n \treturn write_message(p, strlen(p), rebase_path_amend(), 1);\n }\n \n@@ -2079,10 +2080,10 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\tif (read_oneliner(&head_ref, rebase_path_head_name(), 0) &&\n \t\t\t\tstarts_with(head_ref.buf, \"refs/\")) {\n \t\t\tconst char *msg;\n-\t\t\tunsigned char head[20], orig[20];\n+\t\t\tstruct object_id head, orig;\n \t\t\tint res;\n \n-\t\t\tif (get_sha1(\"HEAD\", head)) {\n+\t\t\tif (get_oid(\"HEAD\", &head)) {\n \t\t\t\tres = error(_(\"cannot read HEAD\"));\n cleanup_head_ref:\n \t\t\t\tstrbuf_release(&head_ref);\n@@ -2090,7 +2091,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t\t\treturn res;\n \t\t\t}\n \t\t\tif (!read_oneliner(&buf, rebase_path_orig_head(), 0) ||\n-\t\t\t\t\tget_sha1_hex(buf.buf, orig)) {\n+\t\t\t\t\tget_oid_hex(buf.buf, &orig)) {\n \t\t\t\tres = error(_(\"could not read orig-head\"));\n \t\t\t\tgoto cleanup_head_ref;\n \t\t\t}\n@@ -2101,7 +2102,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t\t}\n \t\t\tmsg = reflog_message(opts, \"finish\", \"%s onto %s\",\n \t\t\t\thead_ref.buf, buf.buf);\n-\t\t\tif (update_ref(msg, head_ref.buf, head, orig,\n+\t\t\tif (update_ref(msg, head_ref.buf, head.hash, orig.hash,\n \t\t\t\t\tREF_NODEREF, UPDATE_REFS_MSG_ON_ERR)) {\n \t\t\t\tres = error(_(\"could not update %s\"),\n \t\t\t\t\thead_ref.buf);\n@@ -2205,16 +2206,16 @@ static int commit_staged_changes(struct replay_opts *opts)\n \n \tif (file_exists(rebase_path_amend())) {\n \t\tstruct strbuf rev = STRBUF_INIT;\n-\t\tunsigned char head[20], to_amend[20];\n+\t\tstruct object_id head, to_amend;\n \n-\t\tif (get_sha1(\"HEAD\", head))\n+\t\tif (get_oid(\"HEAD\", &head))\n \t\t\treturn error(_(\"cannot amend non-existing commit\"));\n \t\tif (!read_oneliner(&rev, rebase_path_amend(), 0))\n \t\t\treturn error(_(\"invalid file: '%s'\"), rebase_path_amend());\n-\t\tif (get_sha1_hex(rev.buf, to_amend))\n+\t\tif (get_oid_hex(rev.buf, &to_amend))\n \t\t\treturn error(_(\"invalid contents: '%s'\"),\n \t\t\t\trebase_path_amend());\n-\t\tif (hashcmp(head, to_amend))\n+\t\tif (oidcmp(&head, &to_amend))\n \t\t\treturn error(_(\"\\nYou have uncommitted changes in your \"\n \t\t\t\t       \"working tree. Please, commit them\\n\"\n \t\t\t\t       \"first and then run 'git rebase \"\n"},{"id":"323763","messageId":"20170703185533.51530-5-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 04/12] remote: convert struct push_cas to struct object_id","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:25Z","receivedAt":"2017-07-03T18:56:03Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This gets rid of one use of get_sha1.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n remote.c | 6 +++---\n remote.h | 2 +-\n 2 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/remote.c b/remote.c\nindex d87482573..9da9040bf 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -2294,8 +2294,8 @@ static int parse_push_cas_option(struct push_cas_option *cas, const char *arg, i\n \tif (!*colon)\n \t\tentry->use_tracking = 1;\n \telse if (!colon[1])\n-\t\thashclr(entry->expect);\n-\telse if (get_sha1(colon + 1, entry->expect))\n+\t\toidclr(&entry->expect);\n+\telse if (get_oid(colon + 1, &entry->expect))\n \t\treturn error(\"cannot parse expected object name '%s'\", colon + 1);\n \treturn 0;\n }\n@@ -2342,7 +2342,7 @@ static void apply_cas(struct push_cas_option *cas,\n \t\t\tcontinue;\n \t\tref->expect_old_sha1 = 1;\n \t\tif (!entry->use_tracking)\n-\t\t\thashcpy(ref->old_oid_expect.hash, cas->entry[i].expect);\n+\t\t\toidcpy(&ref->old_oid_expect, &entry->expect);\n \t\telse if (remote_tracking(remote, ref->name, &ref->old_oid_expect))\n \t\t\toidclr(&ref->old_oid_expect);\n \t\treturn;\ndiff --git a/remote.h b/remote.h\nindex 6c28cd3e4..2ecf4c8c7 100644\n--- a/remote.h\n+++ b/remote.h\n@@ -282,7 +282,7 @@ struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fet\n struct push_cas_option {\n \tunsigned use_tracking_for_rest:1;\n \tstruct push_cas {\n-\t\tunsigned char expect[20];\n+\t\tstruct object_id expect;\n \t\tunsigned use_tracking:1;\n \t\tchar *refname;\n \t} *entry;\n"},{"id":"323764","messageId":"20170703185533.51530-3-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 02/12] builtin/merge-tree: convert remaining caller of get_sha1 to object_id","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:23Z","receivedAt":"2017-07-03T18:56:04Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/merge-tree.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex bad6735c7..f12da292c 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -347,12 +347,12 @@ static void merge_trees(struct tree_desc t[3], const char *base)\n \n static void *get_tree_descriptor(struct tree_desc *desc, const char *rev)\n {\n-\tunsigned char sha1[20];\n+\tstruct object_id oid;\n \tvoid *buf;\n \n-\tif (get_sha1(rev, sha1))\n+\tif (get_oid(rev, &oid))\n \t\tdie(\"unknown rev %s\", rev);\n-\tbuf = fill_tree_descriptor(desc, sha1);\n+\tbuf = fill_tree_descriptor(desc, oid.hash);\n \tif (!buf)\n \t\tdie(\"%s is not a tree\", rev);\n \treturn buf;\n"},{"id":"323765","messageId":"20170703185533.51530-9-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 08/12] builtin/unpack-file: convert to struct object_id","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:29Z","receivedAt":"2017-07-03T18:56:10Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/unpack-file.c | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex 73f133419..281ca1db6 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -1,7 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n \n-static char *create_temp_file(unsigned char *sha1)\n+static char *create_temp_file(struct object_id *oid)\n {\n \tstatic char path[50];\n \tvoid *buf;\n@@ -9,9 +9,9 @@ static char *create_temp_file(unsigned char *sha1)\n \tunsigned long size;\n \tint fd;\n \n-\tbuf = read_sha1_file(sha1, &type, &size);\n+\tbuf = read_sha1_file(oid->hash, &type, &size);\n \tif (!buf || type != OBJ_BLOB)\n-\t\tdie(\"unable to read blob object %s\", sha1_to_hex(sha1));\n+\t\tdie(\"unable to read blob object %s\", oid_to_hex(oid));\n \n \txsnprintf(path, sizeof(path), \".merge_file_XXXXXX\");\n \tfd = xmkstemp(path);\n@@ -23,15 +23,15 @@ static char *create_temp_file(unsigned char *sha1)\n \n int cmd_unpack_file(int argc, const char **argv, const char *prefix)\n {\n-\tunsigned char sha1[20];\n+\tstruct object_id oid;\n \n \tif (argc != 2 || !strcmp(argv[1], \"-h\"))\n \t\tusage(\"git unpack-file <sha1>\");\n-\tif (get_sha1(argv[1], sha1))\n+\tif (get_oid(argv[1], &oid))\n \t\tdie(\"Not a valid object name %s\", argv[1]);\n \n \tgit_config(git_default_config, NULL);\n \n-\tputs(create_temp_file(sha1));\n+\tputs(create_temp_file(&oid));\n \treturn 0;\n }\n"},{"id":"323766","messageId":"20170703185533.51530-11-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 10/12] Convert remaining callers of get_sha1 to get_oid.","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:31Z","receivedAt":"2017-07-03T18:56:20Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/receive-pack.c | 4 ++--\n mailmap.c              | 6 +++---\n 2 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 71c0c768d..1efa48fec 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -919,9 +919,9 @@ static int update_shallow_ref(struct command *cmd, struct shallow_info *si)\n  */\n static int head_has_history(void)\n {\n-\tunsigned char sha1[20];\n+\tstruct object_id oid;\n \n-\treturn !get_sha1(\"HEAD\", sha1);\n+\treturn !get_oid(\"HEAD\", &oid);\n }\n \n static const char *push_to_deploy(unsigned char *sha1,\ndiff --git a/mailmap.c b/mailmap.c\nindex c1a79c100..cb921b4db 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -214,17 +214,17 @@ static int read_mailmap_blob(struct string_list *map,\n \t\t\t     const char *name,\n \t\t\t     char **repo_abbrev)\n {\n-\tunsigned char sha1[20];\n+\tstruct object_id oid;\n \tchar *buf;\n \tunsigned long size;\n \tenum object_type type;\n \n \tif (!name)\n \t\treturn 0;\n-\tif (get_sha1(name, sha1) < 0)\n+\tif (get_oid(name, &oid) < 0)\n \t\treturn 0;\n \n-\tbuf = read_sha1_file(sha1, &type, &size);\n+\tbuf = read_sha1_file(oid.hash, &type, &size);\n \tif (!buf)\n \t\treturn error(\"unable to read mailmap object at %s\", name);\n \tif (type != OBJ_BLOB)\n"},{"id":"323767","messageId":"20170703185533.51530-7-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 06/12] builtin/update_ref: convert to struct object_id","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:27Z","receivedAt":"2017-07-03T18:56:21Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Convert the uses of unsigned char * to struct object_id.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/update-ref.c | 69 ++++++++++++++++++++++++++--------------------------\n 1 file changed, 34 insertions(+), 35 deletions(-)\n\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex 40ccfc193..6b90c5dea 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -94,10 +94,10 @@ static char *parse_refname(struct strbuf *input, const char **next)\n  * provided but cannot be converted to a SHA-1, die.  flags can\n  * include PARSE_SHA1_OLD and/or PARSE_SHA1_ALLOW_EMPTY.\n  */\n-static int parse_next_sha1(struct strbuf *input, const char **next,\n-\t\t\t   unsigned char *sha1,\n-\t\t\t   const char *command, const char *refname,\n-\t\t\t   int flags)\n+static int parse_next_oid(struct strbuf *input, const char **next,\n+\t\t\t  struct object_id *oid,\n+\t\t\t  const char *command, const char *refname,\n+\t\t\t  int flags)\n {\n \tstruct strbuf arg = STRBUF_INIT;\n \tint ret = 0;\n@@ -115,11 +115,11 @@ static int parse_next_sha1(struct strbuf *input, const char **next,\n \t\t(*next)++;\n \t\t*next = parse_arg(*next, &arg);\n \t\tif (arg.len) {\n-\t\t\tif (get_sha1(arg.buf, sha1))\n+\t\t\tif (get_oid(arg.buf, oid))\n \t\t\t\tgoto invalid;\n \t\t} else {\n \t\t\t/* Without -z, an empty value means all zeros: */\n-\t\t\thashclr(sha1);\n+\t\t\toidclr(oid);\n \t\t}\n \t} else {\n \t\t/* With -z, read the next NUL-terminated line */\n@@ -133,13 +133,13 @@ static int parse_next_sha1(struct strbuf *input, const char **next,\n \t\t*next += arg.len;\n \n \t\tif (arg.len) {\n-\t\t\tif (get_sha1(arg.buf, sha1))\n+\t\t\tif (get_oid(arg.buf, oid))\n \t\t\t\tgoto invalid;\n \t\t} else if (flags & PARSE_SHA1_ALLOW_EMPTY) {\n \t\t\t/* With -z, treat an empty value as all zeros: */\n \t\t\twarning(\"%s %s: missing <newvalue>, treating as zero\",\n \t\t\t\tcommand, refname);\n-\t\t\thashclr(sha1);\n+\t\t\toidclr(oid);\n \t\t} else {\n \t\t\t/*\n \t\t\t * With -z, an empty non-required value means\n@@ -182,26 +182,25 @@ static const char *parse_cmd_update(struct ref_transaction *transaction,\n {\n \tstruct strbuf err = STRBUF_INIT;\n \tchar *refname;\n-\tunsigned char new_sha1[20];\n-\tunsigned char old_sha1[20];\n+\tstruct object_id new_oid, old_oid;\n \tint have_old;\n \n \trefname = parse_refname(input, &next);\n \tif (!refname)\n \t\tdie(\"update: missing <ref>\");\n \n-\tif (parse_next_sha1(input, &next, new_sha1, \"update\", refname,\n-\t\t\t    PARSE_SHA1_ALLOW_EMPTY))\n+\tif (parse_next_oid(input, &next, &new_oid, \"update\", refname,\n+\t\t\t   PARSE_SHA1_ALLOW_EMPTY))\n \t\tdie(\"update %s: missing <newvalue>\", refname);\n \n-\thave_old = !parse_next_sha1(input, &next, old_sha1, \"update\", refname,\n-\t\t\t\t    PARSE_SHA1_OLD);\n+\thave_old = !parse_next_oid(input, &next, &old_oid, \"update\", refname,\n+\t\t\t\t   PARSE_SHA1_OLD);\n \n \tif (*next != line_termination)\n \t\tdie(\"update %s: extra input: %s\", refname, next);\n \n \tif (ref_transaction_update(transaction, refname,\n-\t\t\t\t   new_sha1, have_old ? old_sha1 : NULL,\n+\t\t\t\t   new_oid.hash, have_old ? old_oid.hash : NULL,\n \t\t\t\t   update_flags | create_reflog_flag,\n \t\t\t\t   msg, &err))\n \t\tdie(\"%s\", err.buf);\n@@ -218,22 +217,22 @@ static const char *parse_cmd_create(struct ref_transaction *transaction,\n {\n \tstruct strbuf err = STRBUF_INIT;\n \tchar *refname;\n-\tunsigned char new_sha1[20];\n+\tstruct object_id new_oid;\n \n \trefname = parse_refname(input, &next);\n \tif (!refname)\n \t\tdie(\"create: missing <ref>\");\n \n-\tif (parse_next_sha1(input, &next, new_sha1, \"create\", refname, 0))\n+\tif (parse_next_oid(input, &next, &new_oid, \"create\", refname, 0))\n \t\tdie(\"create %s: missing <newvalue>\", refname);\n \n-\tif (is_null_sha1(new_sha1))\n+\tif (is_null_oid(&new_oid))\n \t\tdie(\"create %s: zero <newvalue>\", refname);\n \n \tif (*next != line_termination)\n \t\tdie(\"create %s: extra input: %s\", refname, next);\n \n-\tif (ref_transaction_create(transaction, refname, new_sha1,\n+\tif (ref_transaction_create(transaction, refname, new_oid.hash,\n \t\t\t\t   update_flags | create_reflog_flag,\n \t\t\t\t   msg, &err))\n \t\tdie(\"%s\", err.buf);\n@@ -250,18 +249,18 @@ static const char *parse_cmd_delete(struct ref_transaction *transaction,\n {\n \tstruct strbuf err = STRBUF_INIT;\n \tchar *refname;\n-\tunsigned char old_sha1[20];\n+\tstruct object_id old_oid;\n \tint have_old;\n \n \trefname = parse_refname(input, &next);\n \tif (!refname)\n \t\tdie(\"delete: missing <ref>\");\n \n-\tif (parse_next_sha1(input, &next, old_sha1, \"delete\", refname,\n-\t\t\t    PARSE_SHA1_OLD)) {\n+\tif (parse_next_oid(input, &next, &old_oid, \"delete\", refname,\n+\t\t\t   PARSE_SHA1_OLD)) {\n \t\thave_old = 0;\n \t} else {\n-\t\tif (is_null_sha1(old_sha1))\n+\t\tif (is_null_oid(&old_oid))\n \t\t\tdie(\"delete %s: zero <oldvalue>\", refname);\n \t\thave_old = 1;\n \t}\n@@ -270,7 +269,7 @@ static const char *parse_cmd_delete(struct ref_transaction *transaction,\n \t\tdie(\"delete %s: extra input: %s\", refname, next);\n \n \tif (ref_transaction_delete(transaction, refname,\n-\t\t\t\t   have_old ? old_sha1 : NULL,\n+\t\t\t\t   have_old ? old_oid.hash : NULL,\n \t\t\t\t   update_flags, msg, &err))\n \t\tdie(\"%s\", err.buf);\n \n@@ -286,20 +285,20 @@ static const char *parse_cmd_verify(struct ref_transaction *transaction,\n {\n \tstruct strbuf err = STRBUF_INIT;\n \tchar *refname;\n-\tunsigned char old_sha1[20];\n+\tstruct object_id old_oid;\n \n \trefname = parse_refname(input, &next);\n \tif (!refname)\n \t\tdie(\"verify: missing <ref>\");\n \n-\tif (parse_next_sha1(input, &next, old_sha1, \"verify\", refname,\n-\t\t\t    PARSE_SHA1_OLD))\n-\t\thashclr(old_sha1);\n+\tif (parse_next_oid(input, &next, &old_oid, \"verify\", refname,\n+\t\t\t   PARSE_SHA1_OLD))\n+\t\toidclr(&old_oid);\n \n \tif (*next != line_termination)\n \t\tdie(\"verify %s: extra input: %s\", refname, next);\n \n-\tif (ref_transaction_verify(transaction, refname, old_sha1,\n+\tif (ref_transaction_verify(transaction, refname, old_oid.hash,\n \t\t\t\t   update_flags, &err))\n \t\tdie(\"%s\", err.buf);\n \n@@ -355,7 +354,7 @@ static void update_refs_stdin(struct ref_transaction *transaction)\n int cmd_update_ref(int argc, const char **argv, const char *prefix)\n {\n \tconst char *refname, *oldval;\n-\tunsigned char sha1[20], oldsha1[20];\n+\tstruct object_id oid, oldoid;\n \tint delete = 0, no_deref = 0, read_stdin = 0, end_null = 0;\n \tunsigned int flags = 0;\n \tint create_reflog = 0;\n@@ -412,7 +411,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)\n \t\trefname = argv[0];\n \t\tvalue = argv[1];\n \t\toldval = argv[2];\n-\t\tif (get_sha1(value, sha1))\n+\t\tif (get_oid(value, &oid))\n \t\t\tdie(\"%s: not a valid SHA1\", value);\n \t}\n \n@@ -422,8 +421,8 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)\n \t\t\t * The empty string implies that the reference\n \t\t\t * must not already exist:\n \t\t\t */\n-\t\t\thashclr(oldsha1);\n-\t\telse if (get_sha1(oldval, oldsha1))\n+\t\t\toidclr(&oldoid);\n+\t\telse if (get_oid(oldval, &oldoid))\n \t\t\tdie(\"%s: not a valid old SHA1\", oldval);\n \t}\n \n@@ -435,10 +434,10 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)\n \t\t * NULL_SHA1 as \"don't care\" here:\n \t\t */\n \t\treturn delete_ref(msg, refname,\n-\t\t\t\t  (oldval && !is_null_sha1(oldsha1)) ? oldsha1 : NULL,\n+\t\t\t\t  (oldval && !is_null_oid(&oldoid)) ? oldoid.hash : NULL,\n \t\t\t\t  flags);\n \telse\n-\t\treturn update_ref(msg, refname, sha1, oldval ? oldsha1 : NULL,\n+\t\treturn update_ref(msg, refname, oid.hash, oldval ? oldoid.hash : NULL,\n \t\t\t\t  flags | create_reflog_flag,\n \t\t\t\t  UPDATE_REFS_DIE_ON_ERR);\n }\n"},{"id":"323768","messageId":"20170703185533.51530-4-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 03/12] submodule: convert submodule config lookup to use object_id","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:24Z","receivedAt":"2017-07-03T18:56:39Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/grep.c                   |  4 ++--\n builtin/submodule--helper.c      |  8 ++++----\n config.c                         | 12 ++++++------\n config.h                         |  4 ++--\n submodule-config.c               | 36 ++++++++++++++++++------------------\n submodule-config.h               | 10 +++++-----\n submodule.c                      | 32 ++++++++++++++++----------------\n submodule.h                      |  2 +-\n t/helper/test-submodule-config.c | 10 +++++-----\n 9 files changed, 59 insertions(+), 59 deletions(-)\n\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex f752f642f..397b5f049 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -652,7 +652,7 @@ static int grep_submodule(struct grep_opt *opt, const struct object_id *oid,\n \t\t */\n \t\tif (oid) {\n \t\t\tconst struct submodule *sub =\n-\t\t\t\t\tsubmodule_from_path(null_sha1, path);\n+\t\t\t\t\tsubmodule_from_path(&null_oid, path);\n \t\t\tif (sub)\n \t\t\t\tpath = git_path(\"modules/%s\", sub->name);\n \n@@ -861,7 +861,7 @@ static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,\n \t\t/* load the gitmodules file for this rev */\n \t\tif (recurse_submodules) {\n \t\t\tsubmodule_free();\n-\t\t\tgitmodules_config_sha1(real_obj->oid.hash);\n+\t\t\tgitmodules_config_oid(&real_obj->oid);\n \t\t}\n \t\tif (grep_object(opt, pathspec, real_obj, list->objects[i].name, list->objects[i].path)) {\n \t\t\thit = 1;\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 8517032b3..45cb93287 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -350,7 +350,7 @@ static void init_submodule(const char *path, const char *prefix, int quiet)\n \t} else\n \t\tdisplaypath = xstrdup(path);\n \n-\tsub = submodule_from_path(null_sha1, path);\n+\tsub = submodule_from_path(&null_oid, path);\n \n \tif (!sub)\n \t\tdie(_(\"No url found for submodule path '%s' in .gitmodules\"),\n@@ -476,7 +476,7 @@ static int module_name(int argc, const char **argv, const char *prefix)\n \t\tusage(_(\"git submodule--helper name <path>\"));\n \n \tgitmodules_config();\n-\tsub = submodule_from_path(null_sha1, argv[1]);\n+\tsub = submodule_from_path(&null_oid, argv[1]);\n \n \tif (!sub)\n \t\tdie(_(\"no submodule mapping found in .gitmodules for path '%s'\"),\n@@ -795,7 +795,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,\n \t\tgoto cleanup;\n \t}\n \n-\tsub = submodule_from_path(null_sha1, ce->name);\n+\tsub = submodule_from_path(&null_oid, ce->name);\n \n \tif (suc->recursive_prefix)\n \t\tdisplaypath = relative_path(suc->recursive_prefix,\n@@ -1060,7 +1060,7 @@ static const char *remote_submodule_branch(const char *path)\n \tgitmodules_config();\n \tgit_config(submodule_config, NULL);\n \n-\tsub = submodule_from_path(null_sha1, path);\n+\tsub = submodule_from_path(&null_oid, path);\n \tif (!sub)\n \t\treturn NULL;\n \ndiff --git a/config.c b/config.c\nindex 1cd40a5fe..eb2dae5fb 100644\n--- a/config.c\n+++ b/config.c\n@@ -1466,9 +1466,9 @@ int git_config_from_mem(config_fn_t fn, const enum config_origin_type origin_typ\n \treturn do_config_from(&top, fn, data);\n }\n \n-int git_config_from_blob_sha1(config_fn_t fn,\n+int git_config_from_blob_oid(config_fn_t fn,\n \t\t\t      const char *name,\n-\t\t\t      const unsigned char *sha1,\n+\t\t\t      const struct object_id *oid,\n \t\t\t      void *data)\n {\n \tenum object_type type;\n@@ -1476,7 +1476,7 @@ int git_config_from_blob_sha1(config_fn_t fn,\n \tunsigned long size;\n \tint ret;\n \n-\tbuf = read_sha1_file(sha1, &type, &size);\n+\tbuf = read_sha1_file(oid->hash, &type, &size);\n \tif (!buf)\n \t\treturn error(\"unable to load config blob object '%s'\", name);\n \tif (type != OBJ_BLOB) {\n@@ -1494,11 +1494,11 @@ static int git_config_from_blob_ref(config_fn_t fn,\n \t\t\t\t    const char *name,\n \t\t\t\t    void *data)\n {\n-\tunsigned char sha1[20];\n+\tstruct object_id oid;\n \n-\tif (get_sha1(name, sha1) < 0)\n+\tif (get_oid(name, &oid) < 0)\n \t\treturn error(\"unable to resolve config blob '%s'\", name);\n-\treturn git_config_from_blob_sha1(fn, name, sha1, data);\n+\treturn git_config_from_blob_oid(fn, name, &oid, data);\n }\n \n const char *git_etc_gitconfig(void)\ndiff --git a/config.h b/config.h\nindex 9e038cce2..033920048 100644\n--- a/config.h\n+++ b/config.h\n@@ -39,8 +39,8 @@ extern int git_default_config(const char *, const char *, void *);\n extern int git_config_from_file(config_fn_t fn, const char *, void *);\n extern int git_config_from_mem(config_fn_t fn, const enum config_origin_type,\n \t\t\t\t\tconst char *name, const char *buf, size_t len, void *data);\n-extern int git_config_from_blob_sha1(config_fn_t fn, const char *name,\n-\t\t\t\t     const unsigned char *sha1, void *data);\n+extern int git_config_from_blob_oid(config_fn_t fn, const char *name,\n+\t\t\t\t    const struct object_id *oid, void *data);\n extern void git_config_push_parameter(const char *text);\n extern int git_config_from_parameters(config_fn_t fn, void *data);\n extern void read_early_config(config_fn_t cb, void *data);\ndiff --git a/submodule-config.c b/submodule-config.c\nindex d8f8d5ea3..ad2c447b8 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -402,19 +402,19 @@ static int parse_config(const char *var, const char *value, void *data)\n \treturn ret;\n }\n \n-int gitmodule_sha1_from_commit(const unsigned char *treeish_name,\n-\t\t\t\t      unsigned char *gitmodules_sha1,\n+int gitmodule_oid_from_commit(const struct object_id *treeish_name,\n+\t\t\t\t      struct object_id *gitmodules_oid,\n \t\t\t\t      struct strbuf *rev)\n {\n \tint ret = 0;\n \n-\tif (is_null_sha1(treeish_name)) {\n-\t\thashclr(gitmodules_sha1);\n+\tif (is_null_oid(treeish_name)) {\n+\t\toidclr(gitmodules_oid);\n \t\treturn 1;\n \t}\n \n-\tstrbuf_addf(rev, \"%s:.gitmodules\", sha1_to_hex(treeish_name));\n-\tif (get_sha1(rev->buf, gitmodules_sha1) >= 0)\n+\tstrbuf_addf(rev, \"%s:.gitmodules\", oid_to_hex(treeish_name));\n+\tif (get_oid(rev->buf, gitmodules_oid) >= 0)\n \t\tret = 1;\n \n \treturn ret;\n@@ -425,13 +425,13 @@ int gitmodule_sha1_from_commit(const unsigned char *treeish_name,\n  * revisions.\n  */\n static const struct submodule *config_from(struct submodule_cache *cache,\n-\t\tconst unsigned char *treeish_name, const char *key,\n+\t\tconst struct object_id *treeish_name, const char *key,\n \t\tenum lookup_type lookup_type)\n {\n \tstruct strbuf rev = STRBUF_INIT;\n \tunsigned long config_size;\n \tchar *config = NULL;\n-\tunsigned char sha1[20];\n+\tstruct object_id oid;\n \tenum object_type type;\n \tconst struct submodule *submodule = NULL;\n \tstruct parse_config_parameter parameter;\n@@ -451,28 +451,28 @@ static const struct submodule *config_from(struct submodule_cache *cache,\n \t\treturn entry->config;\n \t}\n \n-\tif (!gitmodule_sha1_from_commit(treeish_name, sha1, &rev))\n+\tif (!gitmodule_oid_from_commit(treeish_name, &oid, &rev))\n \t\tgoto out;\n \n \tswitch (lookup_type) {\n \tcase lookup_name:\n-\t\tsubmodule = cache_lookup_name(cache, sha1, key);\n+\t\tsubmodule = cache_lookup_name(cache, oid.hash, key);\n \t\tbreak;\n \tcase lookup_path:\n-\t\tsubmodule = cache_lookup_path(cache, sha1, key);\n+\t\tsubmodule = cache_lookup_path(cache, oid.hash, key);\n \t\tbreak;\n \t}\n \tif (submodule)\n \t\tgoto out;\n \n-\tconfig = read_sha1_file(sha1, &type, &config_size);\n+\tconfig = read_sha1_file(oid.hash, &type, &config_size);\n \tif (!config || type != OBJ_BLOB)\n \t\tgoto out;\n \n \t/* fill the submodule config into the cache */\n \tparameter.cache = cache;\n-\tparameter.treeish_name = treeish_name;\n-\tparameter.gitmodules_sha1 = sha1;\n+\tparameter.treeish_name = treeish_name->hash;\n+\tparameter.gitmodules_sha1 = oid.hash;\n \tparameter.overwrite = 0;\n \tgit_config_from_mem(parse_config, CONFIG_ORIGIN_SUBMODULE_BLOB, rev.buf,\n \t\t\tconfig, config_size, &parameter);\n@@ -481,9 +481,9 @@ static const struct submodule *config_from(struct submodule_cache *cache,\n \n \tswitch (lookup_type) {\n \tcase lookup_name:\n-\t\treturn cache_lookup_name(cache, sha1, key);\n+\t\treturn cache_lookup_name(cache, oid.hash, key);\n \tcase lookup_path:\n-\t\treturn cache_lookup_path(cache, sha1, key);\n+\t\treturn cache_lookup_path(cache, oid.hash, key);\n \tdefault:\n \t\treturn NULL;\n \t}\n@@ -515,14 +515,14 @@ int parse_submodule_config_option(const char *var, const char *value)\n \treturn parse_config(var, value, &parameter);\n }\n \n-const struct submodule *submodule_from_name(const unsigned char *treeish_name,\n+const struct submodule *submodule_from_name(const struct object_id *treeish_name,\n \t\tconst char *name)\n {\n \tensure_cache_init();\n \treturn config_from(&the_submodule_cache, treeish_name, name, lookup_name);\n }\n \n-const struct submodule *submodule_from_path(const unsigned char *treeish_name,\n+const struct submodule *submodule_from_path(const struct object_id *treeish_name,\n \t\tconst char *path)\n {\n \tensure_cache_init();\ndiff --git a/submodule-config.h b/submodule-config.h\nindex d434ecdb4..ab37558e7 100644\n--- a/submodule-config.h\n+++ b/submodule-config.h\n@@ -27,12 +27,12 @@ extern int parse_update_recurse_submodules_arg(const char *opt, const char *arg)\n extern int parse_push_recurse_submodules_arg(const char *opt, const char *arg);\n extern int parse_submodule_config_option(const char *var, const char *value);\n extern const struct submodule *submodule_from_name(\n-\t\tconst unsigned char *commit_or_tree, const char *name);\n+\t\tconst struct object_id *commit_or_tree, const char *name);\n extern const struct submodule *submodule_from_path(\n-\t\tconst unsigned char *commit_or_tree, const char *path);\n-extern int gitmodule_sha1_from_commit(const unsigned char *commit_sha1,\n-\t\t\t\t      unsigned char *gitmodules_sha1,\n-\t\t\t\t      struct strbuf *rev);\n+\t\tconst struct object_id *commit_or_tree, const char *path);\n+extern int gitmodule_oid_from_commit(const struct object_id *commit_oid,\n+\t\t\t\t     struct object_id *gitmodules_oid,\n+\t\t\t\t     struct strbuf *rev);\n extern void submodule_free(void);\n \n #endif /* SUBMODULE_CONFIG_H */\ndiff --git a/submodule.c b/submodule.c\nindex 71e0c5a85..d3fee650a 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -68,7 +68,7 @@ int update_path_in_gitmodules(const char *oldpath, const char *newpath)\n \tif (gitmodules_is_unmerged)\n \t\tdie(_(\"Cannot change unmerged .gitmodules, resolve merge conflicts first\"));\n \n-\tsubmodule = submodule_from_path(null_sha1, oldpath);\n+\tsubmodule = submodule_from_path(&null_oid, oldpath);\n \tif (!submodule || !submodule->name) {\n \t\twarning(_(\"Could not find section in .gitmodules where path=%s\"), oldpath);\n \t\treturn -1;\n@@ -102,7 +102,7 @@ int remove_path_from_gitmodules(const char *path)\n \tif (gitmodules_is_unmerged)\n \t\tdie(_(\"Cannot change unmerged .gitmodules, resolve merge conflicts first\"));\n \n-\tsubmodule = submodule_from_path(null_sha1, path);\n+\tsubmodule = submodule_from_path(&null_oid, path);\n \tif (!submodule || !submodule->name) {\n \t\twarning(_(\"Could not find section in .gitmodules where path=%s\"), path);\n \t\treturn -1;\n@@ -146,7 +146,7 @@ static int add_submodule_odb(const char *path)\n void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,\n \t\t\t\t\t     const char *path)\n {\n-\tconst struct submodule *submodule = submodule_from_path(null_sha1, path);\n+\tconst struct submodule *submodule = submodule_from_path(&null_oid, path);\n \tif (submodule) {\n \t\tif (submodule->ignore)\n \t\t\thandle_ignore_submodules_arg(diffopt, submodule->ignore);\n@@ -255,14 +255,14 @@ void gitmodules_config(void)\n \t}\n }\n \n-void gitmodules_config_sha1(const unsigned char *commit_sha1)\n+void gitmodules_config_oid(const struct object_id *commit_oid)\n {\n \tstruct strbuf rev = STRBUF_INIT;\n-\tunsigned char sha1[20];\n+\tstruct object_id oid;\n \n-\tif (gitmodule_sha1_from_commit(commit_sha1, sha1, &rev)) {\n-\t\tgit_config_from_blob_sha1(git_modules_config, rev.buf,\n-\t\t\t\t\t  sha1, NULL);\n+\tif (gitmodule_oid_from_commit(commit_oid, &oid, &rev)) {\n+\t\tgit_config_from_blob_oid(submodule_config, rev.buf,\n+\t\t\t\t\t &oid, NULL);\n \t}\n \tstrbuf_release(&rev);\n }\n@@ -282,7 +282,7 @@ int is_submodule_initialized(const char *path)\n \tchar *key = NULL;\n \tchar *value = NULL;\n \tconst struct string_list *sl;\n-\tconst struct submodule *module = submodule_from_path(null_sha1, path);\n+\tconst struct submodule *module = submodule_from_path(&null_oid, path);\n \n \t/* early return if there isn't a path->module mapping */\n \tif (!module)\n@@ -727,7 +727,7 @@ const struct submodule *submodule_from_ce(const struct cache_entry *ce)\n \tif (!should_update_submodules())\n \t\treturn NULL;\n \n-\treturn submodule_from_path(null_sha1, ce->name);\n+\treturn submodule_from_path(&null_oid, ce->name);\n }\n \n static struct oid_array *submodule_commits(struct string_list *submodules,\n@@ -1155,9 +1155,9 @@ static int get_next_submodule(struct child_process *cp,\n \t\tif (!S_ISGITLINK(ce->ce_mode))\n \t\t\tcontinue;\n \n-\t\tsubmodule = submodule_from_path(null_sha1, ce->name);\n+\t\tsubmodule = submodule_from_path(&null_oid, ce->name);\n \t\tif (!submodule)\n-\t\t\tsubmodule = submodule_from_name(null_sha1, ce->name);\n+\t\t\tsubmodule = submodule_from_name(&null_oid, ce->name);\n \n \t\tdefault_argv = \"yes\";\n \t\tif (spf->command_line_option == RECURSE_SUBMODULES_DEFAULT) {\n@@ -1533,7 +1533,7 @@ int submodule_move_head(const char *path,\n \tif (old && !is_submodule_populated_gently(path, error_code_ptr))\n \t\treturn 0;\n \n-\tsub = submodule_from_path(null_sha1, path);\n+\tsub = submodule_from_path(&null_oid, path);\n \n \tif (!sub)\n \t\tdie(\"BUG: could not get submodule information for '%s'\", path);\n@@ -1815,7 +1815,7 @@ static void relocate_single_git_dir_into_superproject(const char *prefix,\n \n \treal_old_git_dir = real_pathdup(old_git_dir, 1);\n \n-\tsub = submodule_from_path(null_sha1, path);\n+\tsub = submodule_from_path(&null_oid, path);\n \tif (!sub)\n \t\tdie(_(\"could not lookup name for submodule '%s'\"), path);\n \n@@ -1871,7 +1871,7 @@ void absorb_git_dir_into_superproject(const char *prefix,\n \t\t* superproject did not rewrite the git file links yet,\n \t\t* fix it now.\n \t\t*/\n-\t\tsub = submodule_from_path(null_sha1, path);\n+\t\tsub = submodule_from_path(&null_oid, path);\n \t\tif (!sub)\n \t\t\tdie(_(\"could not lookup name for submodule '%s'\"), path);\n \t\tconnect_work_tree_and_git_dir(path,\n@@ -2014,7 +2014,7 @@ int submodule_to_gitdir(struct strbuf *buf, const char *submodule)\n \t}\n \tif (!is_git_directory(buf->buf)) {\n \t\tgitmodules_config();\n-\t\tsub = submodule_from_path(null_sha1, submodule);\n+\t\tsub = submodule_from_path(&null_oid, submodule);\n \t\tif (!sub) {\n \t\t\tret = -1;\n \t\t\tgoto cleanup;\ndiff --git a/submodule.h b/submodule.h\nindex cbe5c1726..5110caff4 100644\n--- a/submodule.h\n+++ b/submodule.h\n@@ -46,7 +46,7 @@ int option_parse_recurse_submodules_worktree_updater(const struct option *opt,\n \t\t\t\t\t\t     const char *arg, int unset);\n void load_submodule_cache(void);\n extern void gitmodules_config(void);\n-extern void gitmodules_config_sha1(const unsigned char *commit_sha1);\n+extern void gitmodules_config_oid(const struct object_id *commit_oid);\n extern int is_submodule_initialized(const char *path);\n /*\n  * Determine if a submodule has been populated at a given 'path' by checking if\ndiff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c\nindex c6c57bba0..e13fbcc1b 100644\n--- a/t/helper/test-submodule-config.c\n+++ b/t/helper/test-submodule-config.c\n@@ -41,7 +41,7 @@ int cmd_main(int argc, const char **argv)\n \tgit_config(git_test_config, NULL);\n \n \twhile (*arg) {\n-\t\tunsigned char commit_sha1[20];\n+\t\tstruct object_id commit_oid;\n \t\tconst struct submodule *submodule;\n \t\tconst char *commit;\n \t\tconst char *path_or_name;\n@@ -50,14 +50,14 @@ int cmd_main(int argc, const char **argv)\n \t\tpath_or_name = arg[1];\n \n \t\tif (commit[0] == '\\0')\n-\t\t\thashclr(commit_sha1);\n-\t\telse if (get_sha1(commit, commit_sha1) < 0)\n+\t\t\toidclr(&commit_oid);\n+\t\telse if (get_oid(commit, &commit_oid) < 0)\n \t\t\tdie_usage(argc, argv, \"Commit not found.\");\n \n \t\tif (lookup_name) {\n-\t\t\tsubmodule = submodule_from_name(commit_sha1, path_or_name);\n+\t\t\tsubmodule = submodule_from_name(&commit_oid, path_or_name);\n \t\t} else\n-\t\t\tsubmodule = submodule_from_path(commit_sha1, path_or_name);\n+\t\t\tsubmodule = submodule_from_path(&commit_oid, path_or_name);\n \t\tif (!submodule)\n \t\t\tdie_usage(argc, argv, \"Submodule not found.\");\n \n"},{"id":"323769","messageId":"20170703185533.51530-10-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 09/12] builtin/verify-tag: convert to struct object_id","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:30Z","receivedAt":"2017-07-03T18:56:43Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/verify-tag.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex f9a5f7535..30e4c826e 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -56,20 +56,20 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n \t}\n \n \twhile (i < argc) {\n-\t\tunsigned char sha1[20];\n+\t\tstruct object_id oid;\n \t\tconst char *name = argv[i++];\n-\t\tif (get_sha1(name, sha1)) {\n+\t\tif (get_oid(name, &oid)) {\n \t\t\thad_error = !!error(\"tag '%s' not found.\", name);\n \t\t\tcontinue;\n \t\t}\n \n-\t\tif (gpg_verify_tag(sha1, name, flags)) {\n+\t\tif (gpg_verify_tag(oid.hash, name, flags)) {\n \t\t\thad_error = 1;\n \t\t\tcontinue;\n \t\t}\n \n \t\tif (fmt_pretty)\n-\t\t\tpretty_print_ref(name, sha1, fmt_pretty);\n+\t\t\tpretty_print_ref(name, oid.hash, fmt_pretty);\n \t}\n \treturn had_error;\n }\n"},{"id":"323770","messageId":"20170703185533.51530-13-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 12/12] sha1_name: convert GET_SHA1* flags to GET_OID*","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:33Z","receivedAt":"2017-07-03T18:56:45Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Convert the flags for get_oid_with_context and friends to use \"OID\"\ninstead of \"SHA1\" in their names.\n\nThis transform was made by running the following one-liner on the\naffected files:\n\n  perl -pi -e 's/GET_SHA1/GET_OID/g'\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/cat-file.c  |  4 ++--\n builtin/grep.c      |  2 +-\n builtin/log.c       |  2 +-\n builtin/rev-parse.c |  2 +-\n cache.h             | 28 +++++++++++------------\n refs.c              |  2 +-\n revision.c          |  6 ++---\n sha1_name.c         | 64 ++++++++++++++++++++++++++---------------------------\n 8 files changed, 55 insertions(+), 55 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 695168a98..823608bef 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -63,7 +63,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n \tif (unknown_type)\n \t\tflags |= LOOKUP_UNKNOWN_OBJECT;\n \n-\tif (get_oid_with_context(obj_name, GET_SHA1_RECORD_PATH,\n+\tif (get_oid_with_context(obj_name, GET_OID_RECORD_PATH,\n \t\t\t\t &oid, &obj_context))\n \t\tdie(\"Not a valid object name %s\", obj_name);\n \n@@ -360,7 +360,7 @@ static void batch_one_object(const char *obj_name, struct batch_options *opt,\n \t\t\t     struct expand_data *data)\n {\n \tstruct object_context ctx;\n-\tint flags = opt->follow_symlinks ? GET_SHA1_FOLLOW_SYMLINKS : 0;\n+\tint flags = opt->follow_symlinks ? GET_OID_FOLLOW_SYMLINKS : 0;\n \tenum follow_symlinks_result result;\n \n \tresult = get_oid_with_context(obj_name, flags, &data->oid, &ctx);\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex a309ab7c2..48aa39f99 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -1206,7 +1206,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \t\t\tbreak;\n \t\t}\n \n-\t\tif (get_oid_with_context(arg, GET_SHA1_RECORD_PATH,\n+\t\tif (get_oid_with_context(arg, GET_OID_RECORD_PATH,\n \t\t\t\t\t &oid, &oc)) {\n \t\t\tif (seen_dashdash)\n \t\t\t\tdie(_(\"unable to resolve revision: %s\"), arg);\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 60fac9d4d..3dbdf8cad 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -484,7 +484,7 @@ static int show_blob_object(const struct object_id *oid, struct rev_info *rev, c\n \t    !DIFF_OPT_TST(&rev->diffopt, ALLOW_TEXTCONV))\n \t\treturn stream_blob_to_fd(1, oid, NULL, 0);\n \n-\tif (get_oid_with_context(obj_name, GET_SHA1_RECORD_PATH,\n+\tif (get_oid_with_context(obj_name, GET_OID_RECORD_PATH,\n \t\t\t\t &oidc, &obj_context))\n \t\tdie(_(\"Not a valid object name %s\"), obj_name);\n \tif (!obj_context.path ||\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 041b7898c..2bd28d3c0 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -702,7 +702,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--quiet\") || !strcmp(arg, \"-q\")) {\n \t\t\t\tquiet = 1;\n-\t\t\t\tflags |= GET_SHA1_QUIETLY;\n+\t\t\t\tflags |= GET_OID_QUIETLY;\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (opt_with_value(arg, \"--short\", &arg)) {\ndiff --git a/cache.h b/cache.h\nindex c68f44e10..c14351cba 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1351,27 +1351,27 @@ struct object_context {\n \t */\n \tstruct strbuf symlink_path;\n \t/*\n-\t * If GET_SHA1_RECORD_PATH is set, this will record path (if any)\n+\t * If GET_OID_RECORD_PATH is set, this will record path (if any)\n \t * found when resolving the name. The caller is responsible for\n \t * releasing the memory.\n \t */\n \tchar *path;\n };\n \n-#define GET_SHA1_QUIETLY           01\n-#define GET_SHA1_COMMIT            02\n-#define GET_SHA1_COMMITTISH        04\n-#define GET_SHA1_TREE             010\n-#define GET_SHA1_TREEISH          020\n-#define GET_SHA1_BLOB             040\n-#define GET_SHA1_FOLLOW_SYMLINKS 0100\n-#define GET_SHA1_RECORD_PATH     0200\n-#define GET_SHA1_ONLY_TO_DIE    04000\n+#define GET_OID_QUIETLY           01\n+#define GET_OID_COMMIT            02\n+#define GET_OID_COMMITTISH        04\n+#define GET_OID_TREE             010\n+#define GET_OID_TREEISH          020\n+#define GET_OID_BLOB             040\n+#define GET_OID_FOLLOW_SYMLINKS 0100\n+#define GET_OID_RECORD_PATH     0200\n+#define GET_OID_ONLY_TO_DIE    04000\n \n-#define GET_SHA1_DISAMBIGUATORS \\\n-\t(GET_SHA1_COMMIT | GET_SHA1_COMMITTISH | \\\n-\tGET_SHA1_TREE | GET_SHA1_TREEISH | \\\n-\tGET_SHA1_BLOB)\n+#define GET_OID_DISAMBIGUATORS \\\n+\t(GET_OID_COMMIT | GET_OID_COMMITTISH | \\\n+\tGET_OID_TREE | GET_OID_TREEISH | \\\n+\tGET_OID_BLOB)\n \n extern int get_oid(const char *str, struct object_id *oid);\n extern int get_oid_commit(const char *str, struct object_id *oid);\ndiff --git a/refs.c b/refs.c\nindex 88658ba76..90ecb1d4a 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -818,7 +818,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, in\n \tfor_each_reflog_ent_reverse(refname, read_ref_at_ent, &cb);\n \n \tif (!cb.reccnt) {\n-\t\tif (flags & GET_SHA1_QUIETLY)\n+\t\tif (flags & GET_OID_QUIETLY)\n \t\t\texit(128);\n \t\telse\n \t\t\tdie(\"Log for %s is empty.\", refname);\ndiff --git a/revision.c b/revision.c\nindex 4813d8f0a..08caf8bb0 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1453,7 +1453,7 @@ static int handle_dotdot_1(const char *arg, char *dotdot,\n \tunsigned int a_flags, b_flags;\n \tint symmetric = 0;\n \tunsigned int flags_exclude = flags ^ (UNINTERESTING | BOTTOM);\n-\tunsigned int oc_flags = GET_SHA1_COMMITTISH | GET_SHA1_RECORD_PATH;\n+\tunsigned int oc_flags = GET_OID_COMMITTISH | GET_OID_RECORD_PATH;\n \n \ta_name = arg;\n \tif (!*a_name)\n@@ -1549,7 +1549,7 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi\n \tint local_flags;\n \tconst char *arg = arg_;\n \tint cant_be_filename = revarg_opt & REVARG_CANNOT_BE_FILENAME;\n-\tunsigned get_sha1_flags = GET_SHA1_RECORD_PATH;\n+\tunsigned get_sha1_flags = GET_OID_RECORD_PATH;\n \n \tflags = flags & UNINTERESTING ? flags | BOTTOM : flags & ~BOTTOM;\n \n@@ -1600,7 +1600,7 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi\n \t}\n \n \tif (revarg_opt & REVARG_COMMITTISH)\n-\t\tget_sha1_flags |= GET_SHA1_COMMITTISH;\n+\t\tget_sha1_flags |= GET_OID_COMMITTISH;\n \n \tif (get_oid_with_context(arg, get_sha1_flags, &oid, &oc))\n \t\treturn revs->ignore_missing ? 0 : -1;\ndiff --git a/sha1_name.c b/sha1_name.c\nindex ec8dd9a8d..f7fad38c9 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -381,23 +381,23 @@ static int get_short_oid(const char *name, int len, struct object_id *oid,\n {\n \tint status;\n \tstruct disambiguate_state ds;\n-\tint quietly = !!(flags & GET_SHA1_QUIETLY);\n+\tint quietly = !!(flags & GET_OID_QUIETLY);\n \n \tif (init_object_disambiguation(name, len, &ds) < 0)\n \t\treturn -1;\n \n-\tif (HAS_MULTI_BITS(flags & GET_SHA1_DISAMBIGUATORS))\n+\tif (HAS_MULTI_BITS(flags & GET_OID_DISAMBIGUATORS))\n \t\tdie(\"BUG: multiple get_short_oid disambiguator flags\");\n \n-\tif (flags & GET_SHA1_COMMIT)\n+\tif (flags & GET_OID_COMMIT)\n \t\tds.fn = disambiguate_commit_only;\n-\telse if (flags & GET_SHA1_COMMITTISH)\n+\telse if (flags & GET_OID_COMMITTISH)\n \t\tds.fn = disambiguate_committish_only;\n-\telse if (flags & GET_SHA1_TREE)\n+\telse if (flags & GET_OID_TREE)\n \t\tds.fn = disambiguate_tree_only;\n-\telse if (flags & GET_SHA1_TREEISH)\n+\telse if (flags & GET_OID_TREEISH)\n \t\tds.fn = disambiguate_treeish_only;\n-\telse if (flags & GET_SHA1_BLOB)\n+\telse if (flags & GET_OID_BLOB)\n \t\tds.fn = disambiguate_blob_only;\n \telse\n \t\tds.fn = default_disambiguate_hint;\n@@ -497,7 +497,7 @@ int find_unique_abbrev_r(char *hex, const unsigned char *sha1, int len)\n \texists = has_sha1_file(sha1);\n \twhile (len < 40) {\n \t\tstruct object_id oid_ret;\n-\t\tstatus = get_short_oid(hex, len, &oid_ret, GET_SHA1_QUIETLY);\n+\t\tstatus = get_short_oid(hex, len, &oid_ret, GET_OID_QUIETLY);\n \t\tif (exists\n \t\t    ? !status\n \t\t    : status == SHORT_NAME_NOT_FOUND) {\n@@ -654,9 +654,9 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,\n \tif (!refs_found)\n \t\treturn -1;\n \n-\tif (warn_ambiguous_refs && !(flags & GET_SHA1_QUIETLY) &&\n+\tif (warn_ambiguous_refs && !(flags & GET_OID_QUIETLY) &&\n \t    (refs_found > 1 ||\n-\t     !get_short_oid(str, len, &tmp_oid, GET_SHA1_QUIETLY)))\n+\t     !get_short_oid(str, len, &tmp_oid, GET_OID_QUIETLY)))\n \t\twarning(warn_msg, len, str);\n \n \tif (reflog_len) {\n@@ -701,13 +701,13 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (at_time) {\n-\t\t\t\tif (!(flags & GET_SHA1_QUIETLY)) {\n+\t\t\t\tif (!(flags & GET_OID_QUIETLY)) {\n \t\t\t\t\twarning(\"Log for '%.*s' only goes \"\n \t\t\t\t\t\t\"back to %s.\", len, str,\n \t\t\t\t\t\tshow_date(co_time, co_tz, DATE_MODE(RFC2822)));\n \t\t\t\t}\n \t\t\t} else {\n-\t\t\t\tif (flags & GET_SHA1_QUIETLY) {\n+\t\t\t\tif (flags & GET_OID_QUIETLY) {\n \t\t\t\t\texit(128);\n \t\t\t\t}\n \t\t\t\tdie(\"Log for '%.*s' only has %d entries.\",\n@@ -724,7 +724,7 @@ static int get_parent(const char *name, int len,\n \t\t      struct object_id *result, int idx)\n {\n \tstruct object_id oid;\n-\tint ret = get_oid_1(name, len, &oid, GET_SHA1_COMMITTISH);\n+\tint ret = get_oid_1(name, len, &oid, GET_OID_COMMITTISH);\n \tstruct commit *commit;\n \tstruct commit_list *p;\n \n@@ -755,7 +755,7 @@ static int get_nth_ancestor(const char *name, int len,\n \tstruct commit *commit;\n \tint ret;\n \n-\tret = get_oid_1(name, len, &oid, GET_SHA1_COMMITTISH);\n+\tret = get_oid_1(name, len, &oid, GET_OID_COMMITTISH);\n \tif (ret)\n \t\treturn ret;\n \tcommit = lookup_commit_reference(&oid);\n@@ -841,11 +841,11 @@ static int peel_onion(const char *name, int len, struct object_id *oid,\n \telse\n \t\treturn -1;\n \n-\tlookup_flags &= ~GET_SHA1_DISAMBIGUATORS;\n+\tlookup_flags &= ~GET_OID_DISAMBIGUATORS;\n \tif (expected_type == OBJ_COMMIT)\n-\t\tlookup_flags |= GET_SHA1_COMMITTISH;\n+\t\tlookup_flags |= GET_OID_COMMITTISH;\n \telse if (expected_type == OBJ_TREE)\n-\t\tlookup_flags |= GET_SHA1_TREEISH;\n+\t\tlookup_flags |= GET_OID_TREEISH;\n \n \tif (get_oid_1(name, sp - name - 2, &outer, lookup_flags))\n \t\treturn -1;\n@@ -896,7 +896,7 @@ static int peel_onion(const char *name, int len, struct object_id *oid,\n static int get_describe_name(const char *name, int len, struct object_id *oid)\n {\n \tconst char *cp;\n-\tunsigned flags = GET_SHA1_QUIETLY | GET_SHA1_COMMIT;\n+\tunsigned flags = GET_OID_QUIETLY | GET_OID_COMMIT;\n \n \tfor (cp = name + len - 1; name + 2 <= cp; cp--) {\n \t\tchar ch = *cp;\n@@ -1353,35 +1353,35 @@ int get_oid(const char *name, struct object_id *oid)\n int get_oid_committish(const char *name, struct object_id *oid)\n {\n \tstruct object_context unused;\n-\treturn get_oid_with_context(name, GET_SHA1_COMMITTISH,\n+\treturn get_oid_with_context(name, GET_OID_COMMITTISH,\n \t\t\t\t    oid, &unused);\n }\n \n int get_oid_treeish(const char *name, struct object_id *oid)\n {\n \tstruct object_context unused;\n-\treturn get_oid_with_context(name, GET_SHA1_TREEISH,\n+\treturn get_oid_with_context(name, GET_OID_TREEISH,\n \t\t\t\t    oid, &unused);\n }\n \n int get_oid_commit(const char *name, struct object_id *oid)\n {\n \tstruct object_context unused;\n-\treturn get_oid_with_context(name, GET_SHA1_COMMIT,\n+\treturn get_oid_with_context(name, GET_OID_COMMIT,\n \t\t\t\t    oid, &unused);\n }\n \n int get_oid_tree(const char *name, struct object_id *oid)\n {\n \tstruct object_context unused;\n-\treturn get_oid_with_context(name, GET_SHA1_TREE,\n+\treturn get_oid_with_context(name, GET_OID_TREE,\n \t\t\t\t    oid, &unused);\n }\n \n int get_oid_blob(const char *name, struct object_id *oid)\n {\n \tstruct object_context unused;\n-\treturn get_oid_with_context(name, GET_SHA1_BLOB,\n+\treturn get_oid_with_context(name, GET_OID_BLOB,\n \t\t\t\t    oid, &unused);\n }\n \n@@ -1497,10 +1497,10 @@ static int get_oid_with_context_1(const char *name,\n \tint ret, bracket_depth;\n \tint namelen = strlen(name);\n \tconst char *cp;\n-\tint only_to_die = flags & GET_SHA1_ONLY_TO_DIE;\n+\tint only_to_die = flags & GET_OID_ONLY_TO_DIE;\n \n \tif (only_to_die)\n-\t\tflags |= GET_SHA1_QUIETLY;\n+\t\tflags |= GET_OID_QUIETLY;\n \n \tmemset(oc, 0, sizeof(*oc));\n \toc->mode = S_IFINVALID;\n@@ -1543,7 +1543,7 @@ static int get_oid_with_context_1(const char *name,\n \t\t\tnamelen = strlen(cp);\n \t\t}\n \n-\t\tif (flags & GET_SHA1_RECORD_PATH)\n+\t\tif (flags & GET_OID_RECORD_PATH)\n \t\t\toc->path = xstrdup(cp);\n \n \t\tif (!active_cache)\n@@ -1582,8 +1582,8 @@ static int get_oid_with_context_1(const char *name,\n \t\tint len = cp - name;\n \t\tunsigned sub_flags = flags;\n \n-\t\tsub_flags &= ~GET_SHA1_DISAMBIGUATORS;\n-\t\tsub_flags |= GET_SHA1_TREEISH;\n+\t\tsub_flags &= ~GET_OID_DISAMBIGUATORS;\n+\t\tsub_flags |= GET_OID_TREEISH;\n \n \t\tif (!get_oid_1(name, len, &tree_oid, sub_flags)) {\n \t\t\tconst char *filename = cp+1;\n@@ -1592,7 +1592,7 @@ static int get_oid_with_context_1(const char *name,\n \t\t\tnew_filename = resolve_relative_path(filename);\n \t\t\tif (new_filename)\n \t\t\t\tfilename = new_filename;\n-\t\t\tif (flags & GET_SHA1_FOLLOW_SYMLINKS) {\n+\t\t\tif (flags & GET_OID_FOLLOW_SYMLINKS) {\n \t\t\t\tret = get_tree_entry_follow_symlinks(tree_oid.hash,\n \t\t\t\t\tfilename, oid->hash, &oc->symlink_path,\n \t\t\t\t\t&oc->mode);\n@@ -1607,7 +1607,7 @@ static int get_oid_with_context_1(const char *name,\n \t\t\t\t}\n \t\t\t}\n \t\t\thashcpy(oc->tree, tree_oid.hash);\n-\t\t\tif (flags & GET_SHA1_RECORD_PATH)\n+\t\t\tif (flags & GET_OID_RECORD_PATH)\n \t\t\t\toc->path = xstrdup(filename);\n \n \t\t\tfree(new_filename);\n@@ -1631,12 +1631,12 @@ void maybe_die_on_misspelt_object_name(const char *name, const char *prefix)\n {\n \tstruct object_context oc;\n \tstruct object_id oid;\n-\tget_oid_with_context_1(name, GET_SHA1_ONLY_TO_DIE, prefix, &oid, &oc);\n+\tget_oid_with_context_1(name, GET_OID_ONLY_TO_DIE, prefix, &oid, &oc);\n }\n \n int get_oid_with_context(const char *str, unsigned flags, struct object_id *oid, struct object_context *oc)\n {\n-\tif (flags & GET_SHA1_FOLLOW_SYMLINKS && flags & GET_SHA1_ONLY_TO_DIE)\n+\tif (flags & GET_OID_FOLLOW_SYMLINKS && flags & GET_OID_ONLY_TO_DIE)\n \t\tdie(\"BUG: incompatible flags for get_sha1_with_context\");\n \treturn get_oid_with_context_1(str, flags, NULL, oid, oc);\n }\n"},{"id":"323771","messageId":"20170703185533.51530-12-sandals@crustytoothpaste.net","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"[PATCH 11/12] sha1_name: convert get_sha1* to get_oid*","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-03T18:55:32Z","receivedAt":"2017-07-03T18:56:49Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Now that all the callers of get_sha1 directly or indirectly use struct\nobject_id, rename the functions starting with get_sha1 to start with\nget_oid.  Convert the internals in sha1_name.c to use struct object_id\nas well, and eliminate explicit length checks where possible.\n\nOutside of sha1_name.c and cache.h, this transition was made with the\nfollowing semantic patch:\n\n@@\nexpression E1, E2;\n@@\n- get_sha1(E1, E2.hash)\n+ get_oid(E1, &E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1(E1, E2->hash)\n+ get_oid(E1, E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1_committish(E1, E2.hash)\n+ get_oid_committish(E1, &E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1_committish(E1, E2->hash)\n+ get_oid_committish(E1, E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1_treeish(E1, E2.hash)\n+ get_oid_treeish(E1, &E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1_treeish(E1, E2->hash)\n+ get_oid_treeish(E1, E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1_commit(E1, E2.hash)\n+ get_oid_commit(E1, &E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1_commit(E1, E2->hash)\n+ get_oid_commit(E1, E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1_tree(E1, E2.hash)\n+ get_oid_tree(E1, &E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1_tree(E1, E2->hash)\n+ get_oid_tree(E1, E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1_blob(E1, E2.hash)\n+ get_oid_blob(E1, &E2)\n\n@@\nexpression E1, E2;\n@@\n- get_sha1_blob(E1, E2->hash)\n+ get_oid_blob(E1, E2)\n\n@@\nexpression E1, E2, E3, E4;\n@@\n- get_sha1_with_context(E1, E2, E3.hash, E4)\n+ get_oid_with_context(E1, E2, &E3, E4)\n\n@@\nexpression E1, E2, E3, E4;\n@@\n- get_sha1_with_context(E1, E2, E3->hash, E4)\n+ get_oid_with_context(E1, E2, E3, E4)\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n apply.c               |   4 +-\n archive.c             |   2 +-\n builtin/am.c          |   6 +-\n builtin/cat-file.c    |   6 +-\n builtin/commit-tree.c |   4 +-\n builtin/commit.c      |   8 +--\n builtin/grep.c        |   4 +-\n builtin/log.c         |   4 +-\n builtin/replace.c     |   4 +-\n builtin/reset.c       |  10 +--\n builtin/rev-parse.c   |   6 +-\n builtin/show-branch.c |   8 +--\n cache.h               |  17 +++--\n commit.c              |   4 +-\n notes.c               |   2 +-\n remote.c              |   2 +-\n revision.c            |  10 +--\n sequencer.c           |   6 +-\n sha1_name.c           | 190 ++++++++++++++++++++++++--------------------------\n transport-helper.c    |   2 +-\n 20 files changed, 145 insertions(+), 154 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex c442b8932..58d7d5dc5 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -3553,7 +3553,7 @@ static int try_threeway(struct apply_state *state,\n \t/* Preimage the patch was prepared for */\n \tif (patch->is_new)\n \t\twrite_sha1_file(\"\", 0, blob_type, pre_oid.hash);\n-\telse if (get_sha1(patch->old_sha1_prefix, pre_oid.hash) ||\n+\telse if (get_oid(patch->old_sha1_prefix, &pre_oid) ||\n \t\t read_blob_object(&buf, &pre_oid, patch->old_mode))\n \t\treturn error(_(\"repository lacks the necessary blob to fall back on 3-way merge.\"));\n \n@@ -4077,7 +4077,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)\n \t\t\telse\n \t\t\t\treturn error(_(\"sha1 information is lacking or \"\n \t\t\t\t\t       \"useless for submodule %s\"), name);\n-\t\t} else if (!get_sha1_blob(patch->old_sha1_prefix, oid.hash)) {\n+\t\t} else if (!get_oid_blob(patch->old_sha1_prefix, &oid)) {\n \t\t\t; /* ok */\n \t\t} else if (!patch->lines_added && !patch->lines_deleted) {\n \t\t\t/* mode-only change: update the current */\ndiff --git a/archive.c b/archive.c\nindex 60b3035a7..557dd2db8 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -358,7 +358,7 @@ static void parse_treeish_arg(const char **argv,\n \t\tfree(ref);\n \t}\n \n-\tif (get_sha1(name, oid.hash))\n+\tif (get_oid(name, &oid))\n \t\tdie(\"Not a valid object name\");\n \n \tcommit = lookup_commit_reference_gently(&oid, 1);\ndiff --git a/builtin/am.c b/builtin/am.c\nindex c973bd96d..40cc6d6fe 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -1131,7 +1131,7 @@ static int index_has_changes(struct strbuf *sb)\n \tstruct object_id head;\n \tint i;\n \n-\tif (!get_sha1_tree(\"HEAD\", head.hash)) {\n+\tif (!get_oid_tree(\"HEAD\", &head)) {\n \t\tstruct diff_options opt;\n \n \t\tdiff_setup(&opt);\n@@ -1432,7 +1432,7 @@ static void write_index_patch(const struct am_state *state)\n \tstruct rev_info rev_info;\n \tFILE *fp;\n \n-\tif (!get_sha1_tree(\"HEAD\", head.hash))\n+\tif (!get_oid_tree(\"HEAD\", &head))\n \t\ttree = lookup_tree(&head);\n \telse\n \t\ttree = lookup_tree(&empty_tree_oid);\n@@ -1661,7 +1661,7 @@ static void do_commit(const struct am_state *state)\n \tif (write_cache_as_tree(tree.hash, 0, NULL))\n \t\tdie(_(\"git write-tree failed to write a tree\"));\n \n-\tif (!get_sha1_commit(\"HEAD\", parent.hash)) {\n+\tif (!get_oid_commit(\"HEAD\", &parent)) {\n \t\told_oid = &parent;\n \t\tcommit_list_insert(lookup_commit(&parent), &parents);\n \t} else {\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 7efbc4019..695168a98 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -63,8 +63,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n \tif (unknown_type)\n \t\tflags |= LOOKUP_UNKNOWN_OBJECT;\n \n-\tif (get_sha1_with_context(obj_name, GET_SHA1_RECORD_PATH,\n-\t\t\t\t  oid.hash, &obj_context))\n+\tif (get_oid_with_context(obj_name, GET_SHA1_RECORD_PATH,\n+\t\t\t\t &oid, &obj_context))\n \t\tdie(\"Not a valid object name %s\", obj_name);\n \n \tif (!path)\n@@ -363,7 +363,7 @@ static void batch_one_object(const char *obj_name, struct batch_options *opt,\n \tint flags = opt->follow_symlinks ? GET_SHA1_FOLLOW_SYMLINKS : 0;\n \tenum follow_symlinks_result result;\n \n-\tresult = get_sha1_with_context(obj_name, flags, data->oid.hash, &ctx);\n+\tresult = get_oid_with_context(obj_name, flags, &data->oid, &ctx);\n \tif (result != FOUND) {\n \t\tswitch (result) {\n \t\tcase MISSING_OBJECT:\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex a4a923d7c..19e898fa4 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -56,7 +56,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)\n \t\t\tstruct object_id oid;\n \t\t\tif (argc <= ++i)\n \t\t\t\tusage(commit_tree_usage);\n-\t\t\tif (get_sha1_commit(argv[i], oid.hash))\n+\t\t\tif (get_oid_commit(argv[i], &oid))\n \t\t\t\tdie(\"Not a valid object name %s\", argv[i]);\n \t\t\tassert_sha1_type(oid.hash, OBJ_COMMIT);\n \t\t\tnew_parent(lookup_commit(&oid), &parents);\n@@ -106,7 +106,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)\n \t\t\tcontinue;\n \t\t}\n \n-\t\tif (get_sha1_tree(arg, tree_oid.hash))\n+\t\tif (get_oid_tree(arg, &tree_oid))\n \t\t\tdie(\"Not a valid object name %s\", arg);\n \t\tif (got_tree)\n \t\t\tdie(\"Cannot give more than one trees\");\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 03b97c644..3bbff350f 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -511,7 +511,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int\n \ts->index_file = index_file;\n \ts->fp = fp;\n \ts->nowarn = nowarn;\n-\ts->is_initial = get_sha1(s->reference, oid.hash) ? 1 : 0;\n+\ts->is_initial = get_oid(s->reference, &oid) ? 1 : 0;\n \tif (!s->is_initial)\n \t\thashcpy(s->sha1_commit, oid.hash);\n \ts->status_format = status_format;\n@@ -896,7 +896,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\tif (amend)\n \t\t\tparent = \"HEAD^1\";\n \n-\t\tif (get_sha1(parent, oid.hash)) {\n+\t\tif (get_oid(parent, &oid)) {\n \t\t\tint i, ita_nr = 0;\n \n \t\t\tfor (i = 0; i < active_nr; i++)\n@@ -1394,7 +1394,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n \n \tfd = hold_locked_index(&index_lock, 0);\n \n-\ts.is_initial = get_sha1(s.reference, oid.hash) ? 1 : 0;\n+\ts.is_initial = get_oid(s.reference, &oid) ? 1 : 0;\n \tif (!s.is_initial)\n \t\thashcpy(s.sha1_commit, oid.hash);\n \n@@ -1664,7 +1664,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \tstatus_format = STATUS_FORMAT_NONE; /* Ignore status.short */\n \ts.colopts = 0;\n \n-\tif (get_sha1(\"HEAD\", oid.hash))\n+\tif (get_oid(\"HEAD\", &oid))\n \t\tcurrent_head = NULL;\n \telse {\n \t\tcurrent_head = lookup_commit_or_die(&oid, \"HEAD\");\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 397b5f049..a309ab7c2 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -1206,8 +1206,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \t\t\tbreak;\n \t\t}\n \n-\t\tif (get_sha1_with_context(arg, GET_SHA1_RECORD_PATH,\n-\t\t\t\t\t  oid.hash, &oc)) {\n+\t\tif (get_oid_with_context(arg, GET_SHA1_RECORD_PATH,\n+\t\t\t\t\t &oid, &oc)) {\n \t\t\tif (seen_dashdash)\n \t\t\t\tdie(_(\"unable to resolve revision: %s\"), arg);\n \t\t\tbreak;\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 8ca1de989..60fac9d4d 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -484,8 +484,8 @@ static int show_blob_object(const struct object_id *oid, struct rev_info *rev, c\n \t    !DIFF_OPT_TST(&rev->diffopt, ALLOW_TEXTCONV))\n \t\treturn stream_blob_to_fd(1, oid, NULL, 0);\n \n-\tif (get_sha1_with_context(obj_name, GET_SHA1_RECORD_PATH,\n-\t\t\t\t  oidc.hash, &obj_context))\n+\tif (get_oid_with_context(obj_name, GET_SHA1_RECORD_PATH,\n+\t\t\t\t &oidc, &obj_context))\n \t\tdie(_(\"Not a valid object name %s\"), obj_name);\n \tif (!obj_context.path ||\n \t    !textconv_object(obj_context.path, obj_context.mode, &oidc, 1, &buf, &size)) {\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 80a15cf35..210d930c8 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -50,7 +50,7 @@ static int show_reference(const char *refname, const struct object_id *oid,\n \t\t\tstruct object_id object;\n \t\t\tenum object_type obj_type, repl_type;\n \n-\t\t\tif (get_sha1(refname, object.hash))\n+\t\t\tif (get_oid(refname, &object))\n \t\t\t\treturn error(\"Failed to resolve '%s' as a valid ref.\", refname);\n \n \t\t\tobj_type = sha1_object_info(object.hash, NULL);\n@@ -365,7 +365,7 @@ static void check_one_mergetag(struct commit *commit,\n \t/* iterate over new parents */\n \tfor (i = 1; i < mergetag_data->argc; i++) {\n \t\tstruct object_id oid;\n-\t\tif (get_sha1(mergetag_data->argv[i], oid.hash) < 0)\n+\t\tif (get_oid(mergetag_data->argv[i], &oid) < 0)\n \t\t\tdie(_(\"Not a valid object name: '%s'\"), mergetag_data->argv[i]);\n \t\tif (!oidcmp(&tag->tagged->oid, &oid))\n \t\t\treturn; /* found */\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 7aeaea273..046403ed6 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -219,8 +219,8 @@ static void parse_args(struct pathspec *pathspec,\n \t\t * has to be unambiguous. If there is a single argument, it\n \t\t * can not be a tree\n \t\t */\n-\t\telse if ((!argv[1] && !get_sha1_committish(argv[0], unused.hash)) ||\n-\t\t\t (argv[1] && !get_sha1_treeish(argv[0], unused.hash))) {\n+\t\telse if ((!argv[1] && !get_oid_committish(argv[0], &unused)) ||\n+\t\t\t (argv[1] && !get_oid_treeish(argv[0], &unused))) {\n \t\t\t/*\n \t\t\t * Ok, argv[0] looks like a commit/tree; it should not\n \t\t\t * be a filename.\n@@ -310,13 +310,13 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \n \tload_submodule_cache();\n \n-\tunborn = !strcmp(rev, \"HEAD\") && get_sha1(\"HEAD\", oid.hash);\n+\tunborn = !strcmp(rev, \"HEAD\") && get_oid(\"HEAD\", &oid);\n \tif (unborn) {\n \t\t/* reset on unborn branch: treat as reset to empty tree */\n \t\thashcpy(oid.hash, EMPTY_TREE_SHA1_BIN);\n \t} else if (!pathspec.nr) {\n \t\tstruct commit *commit;\n-\t\tif (get_sha1_committish(rev, oid.hash))\n+\t\tif (get_oid_committish(rev, &oid))\n \t\t\tdie(_(\"Failed to resolve '%s' as a valid revision.\"), rev);\n \t\tcommit = lookup_commit_reference(&oid);\n \t\tif (!commit)\n@@ -324,7 +324,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\toidcpy(&oid, &commit->object.oid);\n \t} else {\n \t\tstruct tree *tree;\n-\t\tif (get_sha1_treeish(rev, oid.hash))\n+\t\tif (get_oid_treeish(rev, &oid))\n \t\t\tdie(_(\"Failed to resolve '%s' as a valid tree.\"), rev);\n \t\ttree = parse_tree_indirect(&oid);\n \t\tif (!tree)\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex c78b7b33d..041b7898c 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -274,7 +274,7 @@ static int try_difference(const char *arg)\n \t\treturn 0;\n \t}\n \n-\tif (!get_sha1_committish(this, oid.hash) && !get_sha1_committish(next, end.hash)) {\n+\tif (!get_oid_committish(this, &oid) && !get_oid_committish(next, &end)) {\n \t\tshow_rev(NORMAL, &end, next);\n \t\tshow_rev(symmetric ? NORMAL : REVERSED, &oid, this);\n \t\tif (symmetric) {\n@@ -328,7 +328,7 @@ static int try_parent_shorthands(const char *arg)\n \t\treturn 0;\n \n \t*dotdot = 0;\n-\tif (get_sha1_committish(arg, oid.hash)) {\n+\tif (get_oid_committish(arg, &oid)) {\n \t\t*dotdot = '^';\n \t\treturn 0;\n \t}\n@@ -911,7 +911,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \t\t\tname++;\n \t\t\ttype = REVERSED;\n \t\t}\n-\t\tif (!get_sha1_with_context(name, flags, oid.hash, &unused)) {\n+\t\tif (!get_oid_with_context(name, flags, &oid, &unused)) {\n \t\t\tif (verify)\n \t\t\t\trevs_count++;\n \t\t\telse\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 527f69e28..c2a399985 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -393,7 +393,7 @@ static int append_head_ref(const char *refname, const struct object_id *oid,\n \t/* If both heads/foo and tags/foo exists, get_sha1 would\n \t * get confused.\n \t */\n-\tif (get_sha1(refname + ofs, tmp.hash) || oidcmp(&tmp, oid))\n+\tif (get_oid(refname + ofs, &tmp) || oidcmp(&tmp, oid))\n \t\tofs = 5;\n \treturn append_ref(refname + ofs, oid, 0);\n }\n@@ -408,7 +408,7 @@ static int append_remote_ref(const char *refname, const struct object_id *oid,\n \t/* If both heads/foo and tags/foo exists, get_sha1 would\n \t * get confused.\n \t */\n-\tif (get_sha1(refname + ofs, tmp.hash) || oidcmp(&tmp, oid))\n+\tif (get_oid(refname + ofs, &tmp) || oidcmp(&tmp, oid))\n \t\tofs = 5;\n \treturn append_ref(refname + ofs, oid, 0);\n }\n@@ -514,7 +514,7 @@ static int show_independent(struct commit **rev,\n static void append_one_rev(const char *av)\n {\n \tstruct object_id revkey;\n-\tif (!get_sha1(av, revkey.hash)) {\n+\tif (!get_oid(av, &revkey)) {\n \t\tappend_ref(av, &revkey, 0);\n \t\treturn;\n \t}\n@@ -808,7 +808,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)\n \t\t\tdie(Q_(\"cannot handle more than %d rev.\",\n \t\t\t       \"cannot handle more than %d revs.\",\n \t\t\t       MAX_REVS), MAX_REVS);\n-\t\tif (get_sha1(ref_name[num_rev], revkey.hash))\n+\t\tif (get_oid(ref_name[num_rev], &revkey))\n \t\t\tdie(_(\"'%s' is not a valid ref.\"), ref_name[num_rev]);\n \t\tcommit = lookup_commit_reference(&revkey);\n \t\tif (!commit)\ndiff --git a/cache.h b/cache.h\nindex 96055c222..c68f44e10 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1373,16 +1373,15 @@ struct object_context {\n \tGET_SHA1_TREE | GET_SHA1_TREEISH | \\\n \tGET_SHA1_BLOB)\n \n-extern int get_sha1(const char *str, unsigned char *sha1);\n-extern int get_sha1_commit(const char *str, unsigned char *sha1);\n-extern int get_sha1_committish(const char *str, unsigned char *sha1);\n-extern int get_sha1_tree(const char *str, unsigned char *sha1);\n-extern int get_sha1_treeish(const char *str, unsigned char *sha1);\n-extern int get_sha1_blob(const char *str, unsigned char *sha1);\n-extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);\n-extern int get_sha1_with_context(const char *str, unsigned flags, unsigned char *sha1, struct object_context *oc);\n-\n extern int get_oid(const char *str, struct object_id *oid);\n+extern int get_oid_commit(const char *str, struct object_id *oid);\n+extern int get_oid_committish(const char *str, struct object_id *oid);\n+extern int get_oid_tree(const char *str, struct object_id *oid);\n+extern int get_oid_treeish(const char *str, struct object_id *oid);\n+extern int get_oid_blob(const char *str, struct object_id *oid);\n+extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);\n+extern int get_oid_with_context(const char *str, unsigned flags, struct object_id *oid, struct object_context *oc);\n+\n \n typedef int each_abbrev_fn(const struct object_id *oid, void *);\n extern int for_each_abbrev(const char *prefix, each_abbrev_fn, void *);\ndiff --git a/commit.c b/commit.c\nindex cbfd68993..d29c997e7 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -59,7 +59,7 @@ struct commit *lookup_commit_reference_by_name(const char *name)\n \tstruct object_id oid;\n \tstruct commit *commit;\n \n-\tif (get_sha1_committish(name, oid.hash))\n+\tif (get_oid_committish(name, &oid))\n \t\treturn NULL;\n \tcommit = lookup_commit_reference(&oid);\n \tif (parse_commit(commit))\n@@ -1587,7 +1587,7 @@ struct commit *get_merge_parent(const char *name)\n \tstruct object *obj;\n \tstruct commit *commit;\n \tstruct object_id oid;\n-\tif (get_sha1(name, oid.hash))\n+\tif (get_oid(name, &oid))\n \t\treturn NULL;\n \tobj = parse_object(&oid);\n \tcommit = (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);\ndiff --git a/notes.c b/notes.c\nindex 8f47c202c..503754d79 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -1026,7 +1026,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref,\n \tt->dirty = 0;\n \n \tif (flags & NOTES_INIT_EMPTY || !notes_ref ||\n-\t    get_sha1_treeish(notes_ref, object_oid.hash))\n+\t    get_oid_treeish(notes_ref, &object_oid))\n \t\treturn;\n \tif (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, object_oid.hash))\n \t\tdie(\"Cannot use notes ref %s\", notes_ref);\ndiff --git a/remote.c b/remote.c\nindex 9da9040bf..2fb0895e4 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1078,7 +1078,7 @@ static int try_explicit_object_name(const char *name,\n \t\treturn 0;\n \t}\n \n-\tif (get_sha1(name, oid.hash))\n+\tif (get_oid(name, &oid))\n \t\treturn -1;\n \n \tif (match) {\ndiff --git a/revision.c b/revision.c\nindex e181ad1b7..4813d8f0a 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1303,7 +1303,7 @@ static int add_parents_only(struct rev_info *revs, const char *arg_, int flags,\n \t\tflags ^= UNINTERESTING | BOTTOM;\n \t\targ++;\n \t}\n-\tif (get_sha1_committish(arg, oid.hash))\n+\tif (get_oid_committish(arg, &oid))\n \t\treturn 0;\n \twhile (1) {\n \t\tit = get_reference(revs, arg, &oid, 0);\n@@ -1467,8 +1467,8 @@ static int handle_dotdot_1(const char *arg, char *dotdot,\n \tif (!*b_name)\n \t\tb_name = \"HEAD\";\n \n-\tif (get_sha1_with_context(a_name, oc_flags, a_oid.hash, a_oc) ||\n-\t    get_sha1_with_context(b_name, oc_flags, b_oid.hash, b_oc))\n+\tif (get_oid_with_context(a_name, oc_flags, &a_oid, a_oc) ||\n+\t    get_oid_with_context(b_name, oc_flags, &b_oid, b_oc))\n \t\treturn -1;\n \n \tif (!cant_be_filename) {\n@@ -1602,7 +1602,7 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi\n \tif (revarg_opt & REVARG_COMMITTISH)\n \t\tget_sha1_flags |= GET_SHA1_COMMITTISH;\n \n-\tif (get_sha1_with_context(arg, get_sha1_flags, oid.hash, &oc))\n+\tif (get_oid_with_context(arg, get_sha1_flags, &oid, &oc))\n \t\treturn revs->ignore_missing ? 0 : -1;\n \tif (!cant_be_filename)\n \t\tverify_non_filename(revs->prefix, arg);\n@@ -2321,7 +2321,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s\n \t\tstruct object_id oid;\n \t\tstruct object *object;\n \t\tstruct object_context oc;\n-\t\tif (get_sha1_with_context(revs->def, 0, oid.hash, &oc))\n+\t\tif (get_oid_with_context(revs->def, 0, &oid, &oc))\n \t\t\tdiagnose_missing_default(revs->def);\n \t\tobject = get_reference(revs, revs->def, &oid, 0);\n \t\tadd_pending_object_with_mode(revs, object, revs->def, oc.mode);\ndiff --git a/sequencer.c b/sequencer.c\nindex 16d48a4fb..f5e85a398 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -2130,8 +2130,8 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t\tlog_tree_opt.disable_stdin = 1;\n \n \t\t\tif (read_oneliner(&buf, rebase_path_orig_head(), 0) &&\n-\t\t\t    !get_sha1(buf.buf, orig.hash) &&\n-\t\t\t    !get_sha1(\"HEAD\", head.hash)) {\n+\t\t\t    !get_oid(buf.buf, &orig) &&\n+\t\t\t    !get_oid(\"HEAD\", &head)) {\n \t\t\t\tdiff_tree_oid(&orig, &head, \"\",\n \t\t\t\t\t      &log_tree_opt.diffopt);\n \t\t\t\tlog_tree_diff_flush(&log_tree_opt);\n@@ -2267,7 +2267,7 @@ int sequencer_continue(struct replay_opts *opts)\n \t\tstruct object_id oid;\n \n \t\tif (read_oneliner(&buf, rebase_path_stopped_sha(), 1) &&\n-\t\t    !get_sha1_committish(buf.buf, oid.hash))\n+\t\t    !get_oid_committish(buf.buf, &oid))\n \t\t\trecord_in_rewritten(&oid, peek_command(&todo_list, 0));\n \t\tstrbuf_release(&buf);\n \t}\ndiff --git a/sha1_name.c b/sha1_name.c\nindex d2d732c19..ec8dd9a8d 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -10,7 +10,7 @@\n #include \"dir.h\"\n #include \"sha1-array.h\"\n \n-static int get_sha1_oneline(const char *, unsigned char *, struct commit_list *);\n+static int get_oid_oneline(const char *, struct object_id *, struct commit_list *);\n \n typedef int (*disambiguate_hint_fn)(const struct object_id *, void *);\n \n@@ -191,7 +191,7 @@ static void find_short_packed_object(struct disambiguate_state *ds)\n #define SHORT_NAME_AMBIGUOUS (-2)\n \n static int finish_object_disambiguation(struct disambiguate_state *ds,\n-\t\t\t\t\tunsigned char *sha1)\n+\t\t\t\t\tstruct object_id *oid)\n {\n \tif (ds->ambiguous)\n \t\treturn SHORT_NAME_AMBIGUOUS;\n@@ -220,7 +220,7 @@ static int finish_object_disambiguation(struct disambiguate_state *ds,\n \tif (!ds->candidate_ok)\n \t\treturn SHORT_NAME_AMBIGUOUS;\n \n-\thashcpy(sha1, ds->candidate.hash);\n+\toidcpy(oid, &ds->candidate);\n \treturn 0;\n }\n \n@@ -376,7 +376,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)\n \treturn 0;\n }\n \n-static int get_short_sha1(const char *name, int len, unsigned char *sha1,\n+static int get_short_oid(const char *name, int len, struct object_id *oid,\n \t\t\t  unsigned flags)\n {\n \tint status;\n@@ -387,7 +387,7 @@ static int get_short_sha1(const char *name, int len, unsigned char *sha1,\n \t\treturn -1;\n \n \tif (HAS_MULTI_BITS(flags & GET_SHA1_DISAMBIGUATORS))\n-\t\tdie(\"BUG: multiple get_short_sha1 disambiguator flags\");\n+\t\tdie(\"BUG: multiple get_short_oid disambiguator flags\");\n \n \tif (flags & GET_SHA1_COMMIT)\n \t\tds.fn = disambiguate_commit_only;\n@@ -404,7 +404,7 @@ static int get_short_sha1(const char *name, int len, unsigned char *sha1,\n \n \tfind_short_object_filename(&ds);\n \tfind_short_packed_object(&ds);\n-\tstatus = finish_object_disambiguation(&ds, sha1);\n+\tstatus = finish_object_disambiguation(&ds, oid);\n \n \tif (!quietly && (status == SHORT_NAME_AMBIGUOUS)) {\n \t\terror(_(\"short SHA1 %s is ambiguous\"), ds.hex_pfx);\n@@ -496,8 +496,8 @@ int find_unique_abbrev_r(char *hex, const unsigned char *sha1, int len)\n \t\treturn 40;\n \texists = has_sha1_file(sha1);\n \twhile (len < 40) {\n-\t\tunsigned char sha1_ret[20];\n-\t\tstatus = get_short_sha1(hex, len, sha1_ret, GET_SHA1_QUIETLY);\n+\t\tstruct object_id oid_ret;\n+\t\tstatus = get_short_oid(hex, len, &oid_ret, GET_SHA1_QUIETLY);\n \t\tif (exists\n \t\t    ? !status\n \t\t    : status == SHORT_NAME_NOT_FOUND) {\n@@ -570,10 +570,10 @@ static inline int push_mark(const char *string, int len)\n \treturn at_mark(string, len, suffix, ARRAY_SIZE(suffix));\n }\n \n-static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned lookup_flags);\n+static int get_oid_1(const char *name, int len, struct object_id *oid, unsigned lookup_flags);\n static int interpret_nth_prior_checkout(const char *name, int namelen, struct strbuf *buf);\n \n-static int get_sha1_basic(const char *str, int len, unsigned char *sha1,\n+static int get_oid_basic(const char *str, int len, struct object_id *oid,\n \t\t\t  unsigned int flags)\n {\n \tstatic const char *warn_msg = \"refname '%.*s' is ambiguous.\";\n@@ -587,14 +587,14 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1,\n \t\"where \\\"$br\\\" is somehow empty and a 40-hex ref is created. Please\\n\"\n \t\"examine these refs and maybe delete them. Turn this message off by\\n\"\n \t\"running \\\"git config advice.objectNameWarning false\\\"\");\n-\tunsigned char tmp_sha1[20];\n+\tstruct object_id tmp_oid;\n \tchar *real_ref = NULL;\n \tint refs_found = 0;\n \tint at, reflog_len, nth_prior = 0;\n \n-\tif (len == 40 && !get_sha1_hex(str, sha1)) {\n+\tif (len == GIT_SHA1_HEXSZ && !get_oid_hex(str, oid)) {\n \t\tif (warn_ambiguous_refs && warn_on_object_refname_ambiguity) {\n-\t\t\trefs_found = dwim_ref(str, len, tmp_sha1, &real_ref);\n+\t\t\trefs_found = dwim_ref(str, len, tmp_oid.hash, &real_ref);\n \t\t\tif (refs_found > 0) {\n \t\t\t\twarning(warn_msg, len, str);\n \t\t\t\tif (advice_object_name_warning)\n@@ -636,7 +636,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1,\n \t\tint detached;\n \n \t\tif (interpret_nth_prior_checkout(str, len, &buf) > 0) {\n-\t\t\tdetached = (buf.len == 40 && !get_sha1_hex(buf.buf, sha1));\n+\t\t\tdetached = (!get_oid_hex(buf.buf, oid));\n \t\t\tstrbuf_release(&buf);\n \t\t\tif (detached)\n \t\t\t\treturn 0;\n@@ -645,18 +645,18 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1,\n \n \tif (!len && reflog_len)\n \t\t/* allow \"@{...}\" to mean the current branch reflog */\n-\t\trefs_found = dwim_ref(\"HEAD\", 4, sha1, &real_ref);\n+\t\trefs_found = dwim_ref(\"HEAD\", 4, oid->hash, &real_ref);\n \telse if (reflog_len)\n-\t\trefs_found = dwim_log(str, len, sha1, &real_ref);\n+\t\trefs_found = dwim_log(str, len, oid->hash, &real_ref);\n \telse\n-\t\trefs_found = dwim_ref(str, len, sha1, &real_ref);\n+\t\trefs_found = dwim_ref(str, len, oid->hash, &real_ref);\n \n \tif (!refs_found)\n \t\treturn -1;\n \n \tif (warn_ambiguous_refs && !(flags & GET_SHA1_QUIETLY) &&\n \t    (refs_found > 1 ||\n-\t     !get_short_sha1(str, len, tmp_sha1, GET_SHA1_QUIETLY)))\n+\t     !get_short_oid(str, len, &tmp_oid, GET_SHA1_QUIETLY)))\n \t\twarning(warn_msg, len, str);\n \n \tif (reflog_len) {\n@@ -688,7 +688,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1,\n \t\t\t\treturn -1;\n \t\t\t}\n \t\t}\n-\t\tif (read_ref_at(real_ref, flags, at_time, nth, sha1, NULL,\n+\t\tif (read_ref_at(real_ref, flags, at_time, nth, oid->hash, NULL,\n \t\t\t\t&co_time, &co_tz, &co_cnt)) {\n \t\t\tif (!len) {\n \t\t\t\tif (starts_with(real_ref, \"refs/heads/\")) {\n@@ -721,10 +721,10 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1,\n }\n \n static int get_parent(const char *name, int len,\n-\t\t      unsigned char *result, int idx)\n+\t\t      struct object_id *result, int idx)\n {\n \tstruct object_id oid;\n-\tint ret = get_sha1_1(name, len, oid.hash, GET_SHA1_COMMITTISH);\n+\tint ret = get_oid_1(name, len, &oid, GET_SHA1_COMMITTISH);\n \tstruct commit *commit;\n \tstruct commit_list *p;\n \n@@ -734,13 +734,13 @@ static int get_parent(const char *name, int len,\n \tif (parse_commit(commit))\n \t\treturn -1;\n \tif (!idx) {\n-\t\thashcpy(result, commit->object.oid.hash);\n+\t\toidcpy(result, &commit->object.oid);\n \t\treturn 0;\n \t}\n \tp = commit->parents;\n \twhile (p) {\n \t\tif (!--idx) {\n-\t\t\thashcpy(result, p->item->object.oid.hash);\n+\t\t\toidcpy(result, &p->item->object.oid);\n \t\t\treturn 0;\n \t\t}\n \t\tp = p->next;\n@@ -749,13 +749,13 @@ static int get_parent(const char *name, int len,\n }\n \n static int get_nth_ancestor(const char *name, int len,\n-\t\t\t    unsigned char *result, int generation)\n+\t\t\t    struct object_id *result, int generation)\n {\n \tstruct object_id oid;\n \tstruct commit *commit;\n \tint ret;\n \n-\tret = get_sha1_1(name, len, oid.hash, GET_SHA1_COMMITTISH);\n+\tret = get_oid_1(name, len, &oid, GET_SHA1_COMMITTISH);\n \tif (ret)\n \t\treturn ret;\n \tcommit = lookup_commit_reference(&oid);\n@@ -767,7 +767,7 @@ static int get_nth_ancestor(const char *name, int len,\n \t\t\treturn -1;\n \t\tcommit = commit->parents->item;\n \t}\n-\thashcpy(result, commit->object.oid.hash);\n+\toidcpy(result, &commit->object.oid);\n \treturn 0;\n }\n \n@@ -796,7 +796,7 @@ struct object *peel_to_type(const char *name, int namelen,\n \t}\n }\n \n-static int peel_onion(const char *name, int len, unsigned char *sha1,\n+static int peel_onion(const char *name, int len, struct object_id *oid,\n \t\t      unsigned lookup_flags)\n {\n \tstruct object_id outer;\n@@ -847,7 +847,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1,\n \telse if (expected_type == OBJ_TREE)\n \t\tlookup_flags |= GET_SHA1_TREEISH;\n \n-\tif (get_sha1_1(name, sp - name - 2, outer.hash, lookup_flags))\n+\tif (get_oid_1(name, sp - name - 2, &outer, lookup_flags))\n \t\treturn -1;\n \n \to = parse_object(&outer);\n@@ -857,7 +857,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1,\n \t\to = deref_tag(o, name, sp - name - 2);\n \t\tif (!o || (!o->parsed && !parse_object(&o->oid)))\n \t\t\treturn -1;\n-\t\thashcpy(sha1, o->oid.hash);\n+\t\toidcpy(oid, &o->oid);\n \t\treturn 0;\n \t}\n \n@@ -870,7 +870,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1,\n \tif (!o)\n \t\treturn -1;\n \n-\thashcpy(sha1, o->oid.hash);\n+\toidcpy(oid, &o->oid);\n \tif (sp[0] == '/') {\n \t\t/* \"$commit^{/foo}\" */\n \t\tchar *prefix;\n@@ -886,14 +886,14 @@ static int peel_onion(const char *name, int len, unsigned char *sha1,\n \n \t\tprefix = xstrndup(sp + 1, name + len - 1 - (sp + 1));\n \t\tcommit_list_insert((struct commit *)o, &list);\n-\t\tret = get_sha1_oneline(prefix, sha1, list);\n+\t\tret = get_oid_oneline(prefix, oid, list);\n \t\tfree(prefix);\n \t\treturn ret;\n \t}\n \treturn 0;\n }\n \n-static int get_describe_name(const char *name, int len, unsigned char *sha1)\n+static int get_describe_name(const char *name, int len, struct object_id *oid)\n {\n \tconst char *cp;\n \tunsigned flags = GET_SHA1_QUIETLY | GET_SHA1_COMMIT;\n@@ -907,14 +907,14 @@ static int get_describe_name(const char *name, int len, unsigned char *sha1)\n \t\t\tif (ch == 'g' && cp[-1] == '-') {\n \t\t\t\tcp++;\n \t\t\t\tlen -= cp - name;\n-\t\t\t\treturn get_short_sha1(cp, len, sha1, flags);\n+\t\t\t\treturn get_short_oid(cp, len, oid, flags);\n \t\t\t}\n \t\t}\n \t}\n \treturn -1;\n }\n \n-static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned lookup_flags)\n+static int get_oid_1(const char *name, int len, struct object_id *oid, unsigned lookup_flags)\n {\n \tint ret, has_suffix;\n \tconst char *cp;\n@@ -941,25 +941,25 @@ static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned l\n \t\tif (!num && len1 == len - 1)\n \t\t\tnum = 1;\n \t\tif (has_suffix == '^')\n-\t\t\treturn get_parent(name, len1, sha1, num);\n+\t\t\treturn get_parent(name, len1, oid, num);\n \t\t/* else if (has_suffix == '~') -- goes without saying */\n-\t\treturn get_nth_ancestor(name, len1, sha1, num);\n+\t\treturn get_nth_ancestor(name, len1, oid, num);\n \t}\n \n-\tret = peel_onion(name, len, sha1, lookup_flags);\n+\tret = peel_onion(name, len, oid, lookup_flags);\n \tif (!ret)\n \t\treturn 0;\n \n-\tret = get_sha1_basic(name, len, sha1, lookup_flags);\n+\tret = get_oid_basic(name, len, oid, lookup_flags);\n \tif (!ret)\n \t\treturn 0;\n \n \t/* It could be describe output that is \"SOMETHING-gXXXX\" */\n-\tret = get_describe_name(name, len, sha1);\n+\tret = get_describe_name(name, len, oid);\n \tif (!ret)\n \t\treturn 0;\n \n-\treturn get_short_sha1(name, len, sha1, lookup_flags);\n+\treturn get_short_oid(name, len, oid, lookup_flags);\n }\n \n /*\n@@ -996,7 +996,7 @@ static int handle_one_ref(const char *path, const struct object_id *oid,\n \treturn 0;\n }\n \n-static int get_sha1_oneline(const char *prefix, unsigned char *sha1,\n+static int get_oid_oneline(const char *prefix, struct object_id *oid,\n \t\t\t    struct commit_list *list)\n {\n \tstruct commit_list *backup = NULL, *l;\n@@ -1036,7 +1036,7 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1,\n \t\tunuse_commit_buffer(commit, buf);\n \n \t\tif (matches) {\n-\t\t\thashcpy(sha1, commit->object.oid.hash);\n+\t\t\toidcpy(oid, &commit->object.oid);\n \t\t\tfound = 1;\n \t\t\tbreak;\n \t\t}\n@@ -1132,7 +1132,7 @@ int get_oid_mb(const char *name, struct object_id *oid)\n \t\tstruct strbuf sb;\n \t\tstrbuf_init(&sb, dots - name);\n \t\tstrbuf_add(&sb, name, dots - name);\n-\t\tst = get_sha1_committish(sb.buf, oid_tmp.hash);\n+\t\tst = get_oid_committish(sb.buf, &oid_tmp);\n \t\tstrbuf_release(&sb);\n \t}\n \tif (st)\n@@ -1141,7 +1141,7 @@ int get_oid_mb(const char *name, struct object_id *oid)\n \tif (!one)\n \t\treturn -1;\n \n-\tif (get_sha1_committish(dots[3] ? (dots + 3) : \"HEAD\", oid_tmp.hash))\n+\tif (get_oid_committish(dots[3] ? (dots + 3) : \"HEAD\", &oid_tmp))\n \t\treturn -1;\n \ttwo = lookup_commit_reference_gently(&oid_tmp, 0);\n \tif (!two)\n@@ -1330,21 +1330,13 @@ int strbuf_check_branch_ref(struct strbuf *sb, const char *name)\n }\n \n /*\n- * This is like \"get_sha1_basic()\", except it allows \"sha1 expressions\",\n+ * This is like \"get_oid_basic()\", except it allows \"object ID expressions\",\n  * notably \"xyz^\" for \"parent of xyz\"\n  */\n-int get_sha1(const char *name, unsigned char *sha1)\n-{\n-\tstruct object_context unused;\n-\treturn get_sha1_with_context(name, 0, sha1, &unused);\n-}\n-\n-/*\n- * This is like \"get_sha1()\", but for struct object_id.\n- */\n int get_oid(const char *name, struct object_id *oid)\n {\n-\treturn get_sha1(name, oid->hash);\n+\tstruct object_context unused;\n+\treturn get_oid_with_context(name, 0, oid, &unused);\n }\n \n \n@@ -1358,49 +1350,49 @@ int get_oid(const char *name, struct object_id *oid)\n  * commit-ish. It is merely to give a hint to the disambiguation\n  * machinery.\n  */\n-int get_sha1_committish(const char *name, unsigned char *sha1)\n+int get_oid_committish(const char *name, struct object_id *oid)\n {\n \tstruct object_context unused;\n-\treturn get_sha1_with_context(name, GET_SHA1_COMMITTISH,\n-\t\t\t\t     sha1, &unused);\n+\treturn get_oid_with_context(name, GET_SHA1_COMMITTISH,\n+\t\t\t\t    oid, &unused);\n }\n \n-int get_sha1_treeish(const char *name, unsigned char *sha1)\n+int get_oid_treeish(const char *name, struct object_id *oid)\n {\n \tstruct object_context unused;\n-\treturn get_sha1_with_context(name, GET_SHA1_TREEISH,\n-\t\t\t\t     sha1, &unused);\n+\treturn get_oid_with_context(name, GET_SHA1_TREEISH,\n+\t\t\t\t    oid, &unused);\n }\n \n-int get_sha1_commit(const char *name, unsigned char *sha1)\n+int get_oid_commit(const char *name, struct object_id *oid)\n {\n \tstruct object_context unused;\n-\treturn get_sha1_with_context(name, GET_SHA1_COMMIT,\n-\t\t\t\t     sha1, &unused);\n+\treturn get_oid_with_context(name, GET_SHA1_COMMIT,\n+\t\t\t\t    oid, &unused);\n }\n \n-int get_sha1_tree(const char *name, unsigned char *sha1)\n+int get_oid_tree(const char *name, struct object_id *oid)\n {\n \tstruct object_context unused;\n-\treturn get_sha1_with_context(name, GET_SHA1_TREE,\n-\t\t\t\t     sha1, &unused);\n+\treturn get_oid_with_context(name, GET_SHA1_TREE,\n+\t\t\t\t    oid, &unused);\n }\n \n-int get_sha1_blob(const char *name, unsigned char *sha1)\n+int get_oid_blob(const char *name, struct object_id *oid)\n {\n \tstruct object_context unused;\n-\treturn get_sha1_with_context(name, GET_SHA1_BLOB,\n-\t\t\t\t     sha1, &unused);\n+\treturn get_oid_with_context(name, GET_SHA1_BLOB,\n+\t\t\t\t    oid, &unused);\n }\n \n /* Must be called only when object_name:filename doesn't exist. */\n-static void diagnose_invalid_sha1_path(const char *prefix,\n-\t\t\t\t       const char *filename,\n-\t\t\t\t       const unsigned char *tree_sha1,\n-\t\t\t\t       const char *object_name,\n-\t\t\t\t       int object_name_len)\n+static void diagnose_invalid_oid_path(const char *prefix,\n+\t\t\t\t      const char *filename,\n+\t\t\t\t      const struct object_id *tree_oid,\n+\t\t\t\t      const char *object_name,\n+\t\t\t\t      int object_name_len)\n {\n-\tunsigned char sha1[20];\n+\tstruct object_id oid;\n \tunsigned mode;\n \n \tif (!prefix)\n@@ -1412,8 +1404,8 @@ static void diagnose_invalid_sha1_path(const char *prefix,\n \tif (is_missing_file_error(errno)) {\n \t\tchar *fullname = xstrfmt(\"%s%s\", prefix, filename);\n \n-\t\tif (!get_tree_entry(tree_sha1, fullname,\n-\t\t\t\t    sha1, &mode)) {\n+\t\tif (!get_tree_entry(tree_oid->hash, fullname,\n+\t\t\t\t    oid.hash, &mode)) {\n \t\t\tdie(\"Path '%s' exists, but not '%s'.\\n\"\n \t\t\t    \"Did you mean '%.*s:%s' aka '%.*s:./%s'?\",\n \t\t\t    fullname,\n@@ -1496,11 +1488,11 @@ static char *resolve_relative_path(const char *rel)\n \t\t\t   rel);\n }\n \n-static int get_sha1_with_context_1(const char *name,\n-\t\t\t\t   unsigned flags,\n-\t\t\t\t   const char *prefix,\n-\t\t\t\t   unsigned char *sha1,\n-\t\t\t\t   struct object_context *oc)\n+static int get_oid_with_context_1(const char *name,\n+\t\t\t\t  unsigned flags,\n+\t\t\t\t  const char *prefix,\n+\t\t\t\t  struct object_id *oid,\n+\t\t\t\t  struct object_context *oc)\n {\n \tint ret, bracket_depth;\n \tint namelen = strlen(name);\n@@ -1513,7 +1505,7 @@ static int get_sha1_with_context_1(const char *name,\n \tmemset(oc, 0, sizeof(*oc));\n \toc->mode = S_IFINVALID;\n \tstrbuf_init(&oc->symlink_path, 0);\n-\tret = get_sha1_1(name, namelen, sha1, flags);\n+\tret = get_oid_1(name, namelen, oid, flags);\n \tif (!ret)\n \t\treturn ret;\n \t/*\n@@ -1533,7 +1525,7 @@ static int get_sha1_with_context_1(const char *name,\n \n \t\t\tfor_each_ref(handle_one_ref, &list);\n \t\t\tcommit_list_sort_by_date(&list);\n-\t\t\treturn get_sha1_oneline(name + 2, sha1, list);\n+\t\t\treturn get_oid_oneline(name + 2, oid, list);\n \t\t}\n \t\tif (namelen < 3 ||\n \t\t    name[2] != ':' ||\n@@ -1565,7 +1557,7 @@ static int get_sha1_with_context_1(const char *name,\n \t\t\t    memcmp(ce->name, cp, namelen))\n \t\t\t\tbreak;\n \t\t\tif (ce_stage(ce) == stage) {\n-\t\t\t\thashcpy(sha1, ce->oid.hash);\n+\t\t\t\toidcpy(oid, &ce->oid);\n \t\t\t\toc->mode = ce->ce_mode;\n \t\t\t\tfree(new_path);\n \t\t\t\treturn 0;\n@@ -1586,14 +1578,14 @@ static int get_sha1_with_context_1(const char *name,\n \t\t\tbreak;\n \t}\n \tif (*cp == ':') {\n-\t\tunsigned char tree_sha1[20];\n+\t\tstruct object_id tree_oid;\n \t\tint len = cp - name;\n \t\tunsigned sub_flags = flags;\n \n \t\tsub_flags &= ~GET_SHA1_DISAMBIGUATORS;\n \t\tsub_flags |= GET_SHA1_TREEISH;\n \n-\t\tif (!get_sha1_1(name, len, tree_sha1, sub_flags)) {\n+\t\tif (!get_oid_1(name, len, &tree_oid, sub_flags)) {\n \t\t\tconst char *filename = cp+1;\n \t\t\tchar *new_filename = NULL;\n \n@@ -1601,20 +1593,20 @@ static int get_sha1_with_context_1(const char *name,\n \t\t\tif (new_filename)\n \t\t\t\tfilename = new_filename;\n \t\t\tif (flags & GET_SHA1_FOLLOW_SYMLINKS) {\n-\t\t\t\tret = get_tree_entry_follow_symlinks(tree_sha1,\n-\t\t\t\t\tfilename, sha1, &oc->symlink_path,\n+\t\t\t\tret = get_tree_entry_follow_symlinks(tree_oid.hash,\n+\t\t\t\t\tfilename, oid->hash, &oc->symlink_path,\n \t\t\t\t\t&oc->mode);\n \t\t\t} else {\n-\t\t\t\tret = get_tree_entry(tree_sha1, filename,\n-\t\t\t\t\t\t     sha1, &oc->mode);\n+\t\t\t\tret = get_tree_entry(tree_oid.hash, filename,\n+\t\t\t\t\t\t     oid->hash, &oc->mode);\n \t\t\t\tif (ret && only_to_die) {\n-\t\t\t\t\tdiagnose_invalid_sha1_path(prefix,\n+\t\t\t\t\tdiagnose_invalid_oid_path(prefix,\n \t\t\t\t\t\t\t\t   filename,\n-\t\t\t\t\t\t\t\t   tree_sha1,\n+\t\t\t\t\t\t\t\t   &tree_oid,\n \t\t\t\t\t\t\t\t   name, len);\n \t\t\t\t}\n \t\t\t}\n-\t\t\thashcpy(oc->tree, tree_sha1);\n+\t\t\thashcpy(oc->tree, tree_oid.hash);\n \t\t\tif (flags & GET_SHA1_RECORD_PATH)\n \t\t\t\toc->path = xstrdup(filename);\n \n@@ -1638,13 +1630,13 @@ static int get_sha1_with_context_1(const char *name,\n void maybe_die_on_misspelt_object_name(const char *name, const char *prefix)\n {\n \tstruct object_context oc;\n-\tunsigned char sha1[20];\n-\tget_sha1_with_context_1(name, GET_SHA1_ONLY_TO_DIE, prefix, sha1, &oc);\n+\tstruct object_id oid;\n+\tget_oid_with_context_1(name, GET_SHA1_ONLY_TO_DIE, prefix, &oid, &oc);\n }\n \n-int get_sha1_with_context(const char *str, unsigned flags, unsigned char *sha1, struct object_context *oc)\n+int get_oid_with_context(const char *str, unsigned flags, struct object_id *oid, struct object_context *oc)\n {\n \tif (flags & GET_SHA1_FOLLOW_SYMLINKS && flags & GET_SHA1_ONLY_TO_DIE)\n \t\tdie(\"BUG: incompatible flags for get_sha1_with_context\");\n-\treturn get_sha1_with_context_1(str, flags, NULL, sha1, oc);\n+\treturn get_oid_with_context_1(str, flags, NULL, oid, oc);\n }\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 33cff38cc..8f68d69a8 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -927,7 +927,7 @@ static int push_refs_with_export(struct transport *transport,\n \t\tstruct object_id oid;\n \n \t\tprivate = apply_refspecs(data->refspecs, data->refspec_nr, ref->name);\n-\t\tif (private && !get_sha1(private, oid.hash)) {\n+\t\tif (private && !get_oid(private, &oid)) {\n \t\t\tstrbuf_addf(&buf, \"^%s\", private);\n \t\t\tstring_list_append(&revlist_args, strbuf_detach(&buf, NULL));\n \t\t\toidcpy(&ref->old_oid, &oid);\n"},{"id":"323782","messageId":"8737adckkc.fsf@gmail.com","threadId":"46307","inReplyTo":"20170703185533.51530-7-sandals@crustytoothpaste.net","subject":"Re: [PATCH 06/12] builtin/update_ref: convert to struct object_id","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-07-03T20:49:39Z","receivedAt":"2017-07-03T20:49:55Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Mon, Jul 03 2017, brian m. carlson jotted:\n\n> Convert the uses of unsigned char * to struct object_id.\n\nI read all of this over (but didn't apply/test it) and it looks good to\nme, Just a small nit:\n\n> [...]\n>  1 file changed, 34 insertions(+), 35 deletions(-)\n> [...]\n>  \tstruct strbuf err = STRBUF_INIT;\n>  \tchar *refname;\n> -\tunsigned char new_sha1[20];\n> -\tunsigned char old_sha1[20];\n> +\tstruct object_id new_oid, old_oid;\n> [...]\n\nIt's easier to skim these when you leave changes in the number of lines\nto separate commits which do more than just rename boilerplate code,\ne.g. as in 05/12 where `const char *p` is introduced.\n\nThanks for working on this.\n"},{"id":"323801","messageId":"20170704144544.zo2lkf2p7jnzxyzf@genre.crustytoothpaste.net","threadId":"46307","inReplyTo":"8737adckkc.fsf@gmail.com","subject":"Re: [PATCH 06/12] builtin/update_ref: convert to struct object_id","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-04T14:45:44Z","receivedAt":"2017-07-04T14:45:57Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Mon, Jul 03, 2017 at 10:49:39PM +0200, Ævar Arnfjörð Bjarmason wrote:\n> On Mon, Jul 03 2017, brian m. carlson jotted:\n> > [...]\n> >  1 file changed, 34 insertions(+), 35 deletions(-)\n> > [...]\n> >  \tstruct strbuf err = STRBUF_INIT;\n> >  \tchar *refname;\n> > -\tunsigned char new_sha1[20];\n> > -\tunsigned char old_sha1[20];\n> > +\tstruct object_id new_oid, old_oid;\n> > [...]\n> \n> It's easier to skim these when you leave changes in the number of lines\n> to separate commits which do more than just rename boilerplate code,\n> e.g. as in 05/12 where `const char *p` is introduced.\n\nI can do that in the future.  I've received feedback in the past that I\ncould coalesce them into one line instead of needing multiple lines, but\nsince I don't have a preference either way, I'm happy to do whatever\nmakes review easier.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\nhttps://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"323818","messageId":"xmqqeftvjzgk.fsf@gitster.mtv.corp.google.com","threadId":"46307","inReplyTo":"20170703185533.51530-1-sandals@crustytoothpaste.net","subject":"Re: [PATCH 00/12] object_id part 9","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-07-05T04:10:35Z","receivedAt":"2017-07-05T04:10:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> It is possible there will be some other conflicts with in flight topics,\n> as get_sha1 is commonly used in the codebase.  This is unavoidable to\n> some extent, but should be kept in mind.  My experience is that usually\n> the required changes for conversion are minimal.\n\nThanks. \n\nIt did have a few conflicts in submodule area and sequencer, but\nthey were (hopefully) trivial to resolve.  The result is queued at\nthe tip of 'pu'.  It seems to pass the tests locally and also at\nTravis.\n\n\n"},{"id":"323853","messageId":"CAGZ79kYWKUPhfMvg2N+1h6b49d3Bqw_3Moes9XscjkmXAumz8Q@mail.gmail.com","threadId":"46307","inReplyTo":"20170703185533.51530-12-sandals@crustytoothpaste.net","subject":"Re: [PATCH 11/12] sha1_name: convert get_sha1* to get_oid*","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-07-05T18:01:07Z","receivedAt":"2017-07-05T18:01:13Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"> @@ -496,8 +496,8 @@ int find_unique_abbrev_r(char *hex, const unsigned char *sha1, int len)\n>                 return 40;\n>         exists = has_sha1_file(sha1);\n>         while (len < 40) {\n\nHere are two prime candidates for GIT_SHA1_HEXSZ, too.\n\n> @@ -636,7 +636,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1,\n>                 int detached;\n>\n>                 if (interpret_nth_prior_checkout(str, len, &buf) > 0) {\n> -                       detached = (buf.len == 40 && !get_sha1_hex(buf.buf, sha1));\n> +                       detached = (!get_oid_hex(buf.buf, oid));\n\nomitting the length check here?\n"},{"id":"323854","messageId":"CAGZ79kbb33=BtspboOTXiPJtOYqFtS3pwNgqnggJv6Kn9uyPVw@mail.gmail.com","threadId":"46307","inReplyTo":"xmqqeftvjzgk.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 00/12] object_id part 9","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-07-05T18:02:14Z","receivedAt":"2017-07-05T18:02:36Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, Jul 4, 2017 at 9:10 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n>\n>> It is possible there will be some other conflicts with in flight topics,\n>> as get_sha1 is commonly used in the codebase.  This is unavoidable to\n>> some extent, but should be kept in mind.  My experience is that usually\n>> the required changes for conversion are minimal.\n>\n> Thanks.\n>\n> It did have a few conflicts in submodule area and sequencer, but\n> they were (hopefully) trivial to resolve.  The result is queued at\n> the tip of 'pu'.  It seems to pass the tests locally and also at\n> Travis.\n\nThe series as queued (modulo 2 minor nits/questions asked in\npatch 11/12) as well as the conflict resolution look good to me.\n\nThanks,\nStefan\n"},{"id":"323859","messageId":"xmqq4luqiv9g.fsf@gitster.mtv.corp.google.com","threadId":"46307","inReplyTo":"CAGZ79kYWKUPhfMvg2N+1h6b49d3Bqw_3Moes9XscjkmXAumz8Q@mail.gmail.com","subject":"Re: [PATCH 11/12] sha1_name: convert get_sha1* to get_oid*","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-07-05T18:38:51Z","receivedAt":"2017-07-05T18:38:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n>> @@ -636,7 +636,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1,\n>>                 int detached;\n>>\n>>                 if (interpret_nth_prior_checkout(str, len, &buf) > 0) {\n>> -                       detached = (buf.len == 40 && !get_sha1_hex(buf.buf, sha1));\n>> +                       detached = (!get_oid_hex(buf.buf, oid));\n>\n> omitting the length check here?\n\nGood eyes.  It probably should check with the possible oid lengths.\n"},{"id":"323978","messageId":"20170707212201.ofdgjaips2tw3koy@genre.crustytoothpaste.net","threadId":"46307","inReplyTo":"xmqq4luqiv9g.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 11/12] sha1_name: convert get_sha1* to get_oid*","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-07-07T21:22:01Z","receivedAt":"2017-07-07T21:22:13Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Wed, Jul 05, 2017 at 11:38:51AM -0700, Junio C Hamano wrote:\n> Stefan Beller <sbeller@google.com> writes:\n> \n> >> @@ -636,7 +636,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1,\n> >>                 int detached;\n> >>\n> >>                 if (interpret_nth_prior_checkout(str, len, &buf) > 0) {\n> >> -                       detached = (buf.len == 40 && !get_sha1_hex(buf.buf, sha1));\n> >> +                       detached = (!get_oid_hex(buf.buf, oid));\n> >\n> > omitting the length check here?\n> \n> Good eyes.  It probably should check with the possible oid lengths.\n\nI'll reroll.  This may have been a bad conflict resolution on my part.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\nhttps://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: https://keybase.io/bk2204\n"}]}