{"thread":{"id":"48886","subject":"[PATCH v2 00/16] object_id part 14","startedAt":"2018-07-16T01:28:22Z","lastAt":"2018-07-16T18:04:54Z","messageCount":20,"participants":["brian m. carlson","Derrick Stolee","Taylor Blau","Stefan Beller"],"isPatch":true,"patchVersion":2,"patchTotal":16},"messages":[{"id":"352582","messageId":"20180716012808.961328-1-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":null,"subject":"[PATCH v2 00/16] object_id part 14","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:27:52Z","receivedAt":"2018-07-16T01:28:22Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This is the fourteenth series of patches to switch to using struct\nobject_id and the_hash_algo.  This series converts several core pieces\nto use struct object_id, including the oid* and hex functions.\n\nAll of these patches have been tested with both SHA-1 and a 256-bit\nhash.\n\nMost of these patches are fixes for things that will clearly cause\nsegfaults or other very obvious breakage on a Git with a 256-bit hash.\n\nChanges from v1:\n* Drop patch that's been replaced by one from Ben Peart.\n* Update patch handling hash* and oid* functions.\n\ntbdiff output below.\n\nbrian m. carlson (16):\n  cache: update object ID functions for the_hash_algo\n  tree-walk: replace hard-coded constants with the_hash_algo\n  hex: switch to using the_hash_algo\n  commit: express tree entry constants in terms of the_hash_algo\n  strbuf: allocate space with GIT_MAX_HEXSZ\n  sha1-name: use the_hash_algo when parsing object names\n  refs/files-backend: use the_hash_algo for writing refs\n  builtin/update-index: convert to using the_hash_algo\n  builtin/update-index: simplify parsing of cacheinfo\n  builtin/fmt-merge-msg: make hash independent\n  builtin/merge: switch to use the_hash_algo\n  builtin/merge-recursive: make hash independent\n  diff: switch GIT_SHA1_HEXSZ to use the_hash_algo\n  log-tree: switch GIT_SHA1_HEXSZ to the_hash_algo->hexsz\n  sha1-file: convert constants to uses of the_hash_algo\n  pretty: switch hard-coded constants to the_hash_algo\n\n builtin/fmt-merge-msg.c   | 19 ++++++++++---------\n builtin/merge-recursive.c |  4 ++--\n builtin/merge.c           | 11 ++++++-----\n builtin/update-index.c    | 14 ++++++++------\n cache.h                   |  6 +++---\n commit.c                  |  4 ++--\n diff.c                    |  6 +++---\n hex.c                     |  6 +++---\n log-tree.c                |  2 +-\n pretty.c                  |  4 ++--\n refs/files-backend.c      |  4 ++--\n sha1-file.c               |  8 ++++----\n sha1-name.c               | 12 +++++++-----\n strbuf.c                  |  2 +-\n tree-walk.c               |  3 ++-\n 15 files changed, 56 insertions(+), 49 deletions(-)\n\ntbdiff output:\n\n 1: e8209cc180 !  1: cad74b3d9b cache: update object ID functions for the_hash_algo\n    @@ -2,10 +2,18 @@\n     \n         cache: update object ID functions for the_hash_algo\n         \n    -    Update the hashcpy and hashclr functions to use the_hash_algo, since\n    -    they are used in a variety of places to copy and manipulate buffers that\n    -    need to move data into or out of struct object_id.  Update oidcmp so\n    -    that it is implemented on its own and similarly uses the_hash_algo.\n    +    Most of our code has been converted to use struct object_id for object\n    +    IDs.  However, there are some places that still have not, and there are\n    +    a variety of places that compare equivalently sized hashes that are not\n    +    object IDs.  All of these hashes are artifacts of the internal hash\n    +    algorithm in use, and when we switch to NewHash for object storage, all\n    +    of these uses will also switch.\n    +    \n    +    Update the hashcpy, hashclr, and hashcmp functions to use the_hash_algo,\n    +    since they are used in a variety of places to copy and manipulate\n    +    buffers that need to move data into or out of struct object_id.  This\n    +    has the effect of making the corresponding oid* functions use\n    +    the_hash_algo as well.\n         \n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n    @@ -14,13 +22,13 @@\n     +++ b/cache.h\n     @@\n      \n    - static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n    + static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n      {\n    --\treturn hashcmp(oid1->hash, oid2->hash);\n    -+\treturn memcmp(oid1->hash, oid2->hash, the_hash_algo->rawsz);\n    +-\treturn memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n    ++\treturn memcmp(sha1, sha2, the_hash_algo->rawsz);\n      }\n      \n    - static inline int is_null_sha1(const unsigned char *sha1)\n    + static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n     @@\n      \n      static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n 2: d0bf993bc5 =  2: 2d2229b112 tree-walk: replace hard-coded constants with the_hash_algo\n 3: 718ff26cb3 =  3: e2ea848e69 hex: switch to using the_hash_algo\n 4: 9c387dc7b4 =  4: a2ba0e70ac commit: express tree entry constants in terms of the_hash_algo\n 5: efbae0c278 =  5: 7cd0a1600e strbuf: allocate space with GIT_MAX_HEXSZ\n 6: e37fa26cf7 =  6: b89147f48b sha1-name: use the_hash_algo when parsing object names\n 7: b7ef5b65fc < --:  ------- commit: increase commit message buffer size\n 8: 309c452bd7 =  7: 6d2efbfdb0 refs/files-backend: use the_hash_algo for writing refs\n 9: 08684a629e =  8: 745d8c1e5f builtin/update-index: convert to using the_hash_algo\n10: 36c7de8d9a =  9: a9e4fe9a49 builtin/update-index: simplify parsing of cacheinfo\n11: cfa93658a1 = 10: 3618c468cb builtin/fmt-merge-msg: make hash independent\n12: cdc2507c68 = 11: 83c8c1881a builtin/merge: switch to use the_hash_algo\n13: b728ff86d4 = 12: eac8c307e1 builtin/merge-recursive: make hash independent\n14: 04e69f589b = 13: 5da6c63e78 diff: switch GIT_SHA1_HEXSZ to use the_hash_algo\n15: a75208a598 = 14: c179e8c3db log-tree: switch GIT_SHA1_HEXSZ to the_hash_algo->hexsz\n16: d4ebee341a = 15: d6437a47d6 sha1-file: convert constants to uses of the_hash_algo\n17: 68b95089d7 = 16: 6313f07df0 pretty: switch hard-coded constants to the_hash_algo\n"},{"id":"352583","messageId":"20180716012808.961328-2-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 01/16] cache: update object ID functions for the_hash_algo","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:27:53Z","receivedAt":"2018-07-16T01:28:22Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Most of our code has been converted to use struct object_id for object\nIDs.  However, there are some places that still have not, and there are\na variety of places that compare equivalently sized hashes that are not\nobject IDs.  All of these hashes are artifacts of the internal hash\nalgorithm in use, and when we switch to NewHash for object storage, all\nof these uses will also switch.\n\nUpdate the hashcpy, hashclr, and hashcmp functions to use the_hash_algo,\nsince they are used in a variety of places to copy and manipulate\nbuffers that need to move data into or out of struct object_id.  This\nhas the effect of making the corresponding oid* functions use\nthe_hash_algo as well.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n cache.h | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex d49092d94d..f00cc810bc 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -972,7 +972,7 @@ extern const struct object_id null_oid;\n \n static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n {\n-\treturn memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n+\treturn memcmp(sha1, sha2, the_hash_algo->rawsz);\n }\n \n static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n@@ -992,7 +992,7 @@ static inline int is_null_oid(const struct object_id *oid)\n \n static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n {\n-\tmemcpy(sha_dst, sha_src, GIT_SHA1_RAWSZ);\n+\tmemcpy(sha_dst, sha_src, the_hash_algo->rawsz);\n }\n \n static inline void oidcpy(struct object_id *dst, const struct object_id *src)\n@@ -1009,7 +1009,7 @@ static inline struct object_id *oiddup(const struct object_id *src)\n \n static inline void hashclr(unsigned char *hash)\n {\n-\tmemset(hash, 0, GIT_SHA1_RAWSZ);\n+\tmemset(hash, 0, the_hash_algo->rawsz);\n }\n \n static inline void oidclr(struct object_id *oid)\n"},{"id":"352584","messageId":"20180716012808.961328-3-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 02/16] tree-walk: replace hard-coded constants with the_hash_algo","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:27:54Z","receivedAt":"2018-07-16T01:28:24Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Remove the hard-coded 20-based values and replace them with uses of\nthe_hash_algo.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n tree-walk.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/tree-walk.c b/tree-walk.c\nindex 8f5090862b..c1f27086a9 100644\n--- a/tree-walk.c\n+++ b/tree-walk.c\n@@ -26,8 +26,9 @@ static int decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned l\n {\n \tconst char *path;\n \tunsigned int mode, len;\n+\tconst unsigned hashsz = the_hash_algo->rawsz;\n \n-\tif (size < 23 || buf[size - 21]) {\n+\tif (size < hashsz + 3 || buf[size - (hashsz + 1)]) {\n \t\tstrbuf_addstr(err, _(\"too-short tree object\"));\n \t\treturn -1;\n \t}\n"},{"id":"352585","messageId":"20180716012808.961328-4-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 03/16] hex: switch to using the_hash_algo","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:27:55Z","receivedAt":"2018-07-16T01:28:24Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Instead of using the GIT_SHA1_* constants, switch to using the_hash_algo\nto convert object IDs to and from hex format.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n hex.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/hex.c b/hex.c\nindex 8df2d63728..10af1a29e8 100644\n--- a/hex.c\n+++ b/hex.c\n@@ -50,7 +50,7 @@ int hex_to_bytes(unsigned char *binary, const char *hex, size_t len)\n int get_sha1_hex(const char *hex, unsigned char *sha1)\n {\n \tint i;\n-\tfor (i = 0; i < GIT_SHA1_RAWSZ; i++) {\n+\tfor (i = 0; i < the_hash_algo->rawsz; i++) {\n \t\tint val = hex2chr(hex);\n \t\tif (val < 0)\n \t\t\treturn -1;\n@@ -69,7 +69,7 @@ int parse_oid_hex(const char *hex, struct object_id *oid, const char **end)\n {\n \tint ret = get_oid_hex(hex, oid);\n \tif (!ret)\n-\t\t*end = hex + GIT_SHA1_HEXSZ;\n+\t\t*end = hex + the_hash_algo->hexsz;\n \treturn ret;\n }\n \n@@ -79,7 +79,7 @@ char *sha1_to_hex_r(char *buffer, const unsigned char *sha1)\n \tchar *buf = buffer;\n \tint i;\n \n-\tfor (i = 0; i < GIT_SHA1_RAWSZ; i++) {\n+\tfor (i = 0; i < the_hash_algo->rawsz; i++) {\n \t\tunsigned int val = *sha1++;\n \t\t*buf++ = hex[val >> 4];\n \t\t*buf++ = hex[val & 0xf];\n"},{"id":"352586","messageId":"20180716012808.961328-6-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 05/16] strbuf: allocate space with GIT_MAX_HEXSZ","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:27:57Z","receivedAt":"2018-07-16T01:28:26Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"In order to be sure we have enough space to use with any hash algorithm,\nuse GIT_MAX_HEXSZ to allocate space.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n strbuf.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/strbuf.c b/strbuf.c\nindex b0716ac585..030556111d 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -921,7 +921,7 @@ void strbuf_add_unique_abbrev(struct strbuf *sb, const struct object_id *oid,\n \t\t\t      int abbrev_len)\n {\n \tint r;\n-\tstrbuf_grow(sb, GIT_SHA1_HEXSZ + 1);\n+\tstrbuf_grow(sb, GIT_MAX_HEXSZ + 1);\n \tr = find_unique_abbrev_r(sb->buf + sb->len, oid, abbrev_len);\n \tstrbuf_setlen(sb, sb->len + r);\n }\n"},{"id":"352587","messageId":"20180716012808.961328-5-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 04/16] commit: express tree entry constants in terms of the_hash_algo","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:27:56Z","receivedAt":"2018-07-16T01:28:26Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Specify these constants in terms of the size of the hash algorithm\ncurrently in use.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n commit.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/commit.c b/commit.c\nindex 0c3b75aeff..ff05d04570 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -364,8 +364,8 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s\n \tstruct object_id parent;\n \tstruct commit_list **pptr;\n \tstruct commit_graft *graft;\n-\tconst int tree_entry_len = GIT_SHA1_HEXSZ + 5;\n-\tconst int parent_entry_len = GIT_SHA1_HEXSZ + 7;\n+\tconst int tree_entry_len = the_hash_algo->hexsz + 5;\n+\tconst int parent_entry_len = the_hash_algo->hexsz + 7;\n \n \tif (item->object.parsed)\n \t\treturn 0;\n"},{"id":"352588","messageId":"20180716012808.961328-8-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 07/16] refs/files-backend: use the_hash_algo for writing refs","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:27:59Z","receivedAt":"2018-07-16T01:28:28Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"In order to ensure we write the correct amount, use the_hash_algo to\nfind the correct number of bytes for the current hash.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n refs/files-backend.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex a9a066dcfb..c546ffbf5d 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -1676,7 +1676,7 @@ static int write_ref_to_lockfile(struct ref_lock *lock,\n \t\treturn -1;\n \t}\n \tfd = get_lock_file_fd(&lock->lk);\n-\tif (write_in_full(fd, oid_to_hex(oid), GIT_SHA1_HEXSZ) < 0 ||\n+\tif (write_in_full(fd, oid_to_hex(oid), the_hash_algo->hexsz) < 0 ||\n \t    write_in_full(fd, &term, 1) < 0 ||\n \t    close_ref_gently(lock) < 0) {\n \t\tstrbuf_addf(err,\n@@ -3070,7 +3070,7 @@ static int files_reflog_expire(struct ref_store *ref_store,\n \t\t\trollback_lock_file(&reflog_lock);\n \t\t} else if (update &&\n \t\t\t   (write_in_full(get_lock_file_fd(&lock->lk),\n-\t\t\t\toid_to_hex(&cb.last_kept_oid), GIT_SHA1_HEXSZ) < 0 ||\n+\t\t\t\toid_to_hex(&cb.last_kept_oid), the_hash_algo->hexsz) < 0 ||\n \t\t\t    write_str_in_full(get_lock_file_fd(&lock->lk), \"\\n\") < 0 ||\n \t\t\t    close_ref_gently(lock) < 0)) {\n \t\t\tstatus |= error(\"couldn't write %s\",\n"},{"id":"352589","messageId":"20180716012808.961328-9-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 08/16] builtin/update-index: convert to using the_hash_algo","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:28:00Z","receivedAt":"2018-07-16T01:28:29Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Switch from using GIT_SHA1_HEXSZ to the_hash_algo to make the parsing of\nthe index information hash independent.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/update-index.c | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex a8709a26ec..031cef5229 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -492,6 +492,7 @@ static void update_one(const char *path)\n \n static void read_index_info(int nul_term_line)\n {\n+\tconst int hexsz = the_hash_algo->hexsz;\n \tstruct strbuf buf = STRBUF_INIT;\n \tstruct strbuf uq = STRBUF_INIT;\n \tstrbuf_getline_fn getline_fn;\n@@ -529,7 +530,7 @@ static void read_index_info(int nul_term_line)\n \t\tmode = ul;\n \n \t\ttab = strchr(ptr, '\\t');\n-\t\tif (!tab || tab - ptr < GIT_SHA1_HEXSZ + 1)\n+\t\tif (!tab || tab - ptr < hexsz + 1)\n \t\t\tgoto bad_line;\n \n \t\tif (tab[-2] == ' ' && '0' <= tab[-1] && tab[-1] <= '3') {\n@@ -542,8 +543,8 @@ static void read_index_info(int nul_term_line)\n \t\t\tptr = tab + 1; /* point at the head of path */\n \t\t}\n \n-\t\tif (get_oid_hex(tab - GIT_SHA1_HEXSZ, &oid) ||\n-\t\t\ttab[-(GIT_SHA1_HEXSZ + 1)] != ' ')\n+\t\tif (get_oid_hex(tab - hexsz, &oid) ||\n+\t\t\ttab[-(hexsz + 1)] != ' ')\n \t\t\tgoto bad_line;\n \n \t\tpath_name = ptr;\n@@ -571,7 +572,7 @@ static void read_index_info(int nul_term_line)\n \t\t\t * ptr[-1] points at tab,\n \t\t\t * ptr[-41] is at the beginning of sha1\n \t\t\t */\n-\t\t\tptr[-(GIT_SHA1_HEXSZ + 2)] = ptr[-1] = 0;\n+\t\t\tptr[-(hexsz + 2)] = ptr[-1] = 0;\n \t\t\tif (add_cacheinfo(mode, &oid, path_name, stage))\n \t\t\t\tdie(\"git update-index: unable to update %s\",\n \t\t\t\t    path_name);\n"},{"id":"352590","messageId":"20180716012808.961328-10-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 09/16] builtin/update-index: simplify parsing of cacheinfo","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:28:01Z","receivedAt":"2018-07-16T01:28:30Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Switch from using get_oid_hex to parse_oid_hex to simplify pointer\noperations and avoid the need for a hash-related constant.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/update-index.c | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 031cef5229..3206c5ad45 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -827,6 +827,7 @@ static int parse_new_style_cacheinfo(const char *arg,\n {\n \tunsigned long ul;\n \tchar *endp;\n+\tconst char *p;\n \n \tif (!arg)\n \t\treturn -1;\n@@ -837,9 +838,9 @@ static int parse_new_style_cacheinfo(const char *arg,\n \t\treturn -1; /* not a new-style cacheinfo */\n \t*mode = ul;\n \tendp++;\n-\tif (get_oid_hex(endp, oid) || endp[GIT_SHA1_HEXSZ] != ',')\n+\tif (parse_oid_hex(endp, oid, &p) || *p != ',')\n \t\treturn -1;\n-\t*path = endp + GIT_SHA1_HEXSZ + 1;\n+\t*path = p + 1;\n \treturn 0;\n }\n \n"},{"id":"352591","messageId":"20180716012808.961328-7-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 06/16] sha1-name: use the_hash_algo when parsing object names","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:27:58Z","receivedAt":"2018-07-16T01:28:32Z","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 sha1-name.c | 12 +++++++-----\n 1 file changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/sha1-name.c b/sha1-name.c\nindex 60d9ef3c7e..ba6a5a689f 100644\n--- a/sha1-name.c\n+++ b/sha1-name.c\n@@ -310,7 +310,7 @@ static int init_object_disambiguation(const char *name, int len,\n {\n \tint i;\n \n-\tif (len < MINIMUM_ABBREV || len > GIT_SHA1_HEXSZ)\n+\tif (len < MINIMUM_ABBREV || len > the_hash_algo->hexsz)\n \t\treturn -1;\n \n \tmemset(ds, 0, sizeof(*ds));\n@@ -576,6 +576,8 @@ int find_unique_abbrev_r(char *hex, const struct object_id *oid, int len)\n \tstruct disambiguate_state ds;\n \tstruct min_abbrev_data mad;\n \tstruct object_id oid_ret;\n+\tconst unsigned hexsz = the_hash_algo->hexsz;\n+\n \tif (len < 0) {\n \t\tunsigned long count = approximate_object_count();\n \t\t/*\n@@ -599,8 +601,8 @@ int find_unique_abbrev_r(char *hex, const struct object_id *oid, int len)\n \t}\n \n \toid_to_hex_r(hex, oid);\n-\tif (len == GIT_SHA1_HEXSZ || !len)\n-\t\treturn GIT_SHA1_HEXSZ;\n+\tif (len == hexsz || !len)\n+\t\treturn hexsz;\n \n \tmad.init_len = len;\n \tmad.cur_len = len;\n@@ -706,7 +708,7 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,\n \tint refs_found = 0;\n \tint at, reflog_len, nth_prior = 0;\n \n-\tif (len == GIT_SHA1_HEXSZ && !get_oid_hex(str, oid)) {\n+\tif (len == the_hash_algo->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_oid, &real_ref);\n \t\t\tif (refs_found > 0) {\n@@ -750,7 +752,7 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,\n \t\tint detached;\n \n \t\tif (interpret_nth_prior_checkout(str, len, &buf) > 0) {\n-\t\t\tdetached = (buf.len == GIT_SHA1_HEXSZ && !get_oid_hex(buf.buf, oid));\n+\t\t\tdetached = (buf.len == the_hash_algo->hexsz && !get_oid_hex(buf.buf, oid));\n \t\t\tstrbuf_release(&buf);\n \t\t\tif (detached)\n \t\t\t\treturn 0;\n"},{"id":"352592","messageId":"20180716012808.961328-11-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 10/16] builtin/fmt-merge-msg: make hash independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:28:02Z","receivedAt":"2018-07-16T01:28:33Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Convert several uses of GIT_SHA1_HEXSZ into references to the_hash_algo.\nSwitch other uses into a use of parse_oid_hex and uses of its computed\npointer.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/fmt-merge-msg.c | 19 ++++++++++---------\n 1 file changed, 10 insertions(+), 9 deletions(-)\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex bd680be687..e8c13a2c03 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -108,14 +108,15 @@ static int handle_line(char *line, struct merge_parents *merge_parents)\n \tstruct string_list_item *item;\n \tint pulling_head = 0;\n \tstruct object_id oid;\n+\tconst unsigned hexsz = the_hash_algo->hexsz;\n \n-\tif (len < GIT_SHA1_HEXSZ + 3 || line[GIT_SHA1_HEXSZ] != '\\t')\n+\tif (len < hexsz + 3 || line[hexsz] != '\\t')\n \t\treturn 1;\n \n-\tif (starts_with(line + GIT_SHA1_HEXSZ + 1, \"not-for-merge\"))\n+\tif (starts_with(line + hexsz + 1, \"not-for-merge\"))\n \t\treturn 0;\n \n-\tif (line[GIT_SHA1_HEXSZ + 1] != '\\t')\n+\tif (line[hexsz + 1] != '\\t')\n \t\treturn 2;\n \n \ti = get_oid_hex(line, &oid);\n@@ -130,7 +131,7 @@ static int handle_line(char *line, struct merge_parents *merge_parents)\n \n \tif (line[len - 1] == '\\n')\n \t\tline[len - 1] = 0;\n-\tline += GIT_SHA1_HEXSZ + 2;\n+\tline += hexsz + 2;\n \n \t/*\n \t * At this point, line points at the beginning of comment e.g.\n@@ -342,7 +343,7 @@ static void shortlog(const char *name,\n \tconst struct object_id *oid = &origin_data->oid;\n \tint limit = opts->shortlog_len;\n \n-\tbranch = deref_tag(parse_object(oid), oid_to_hex(oid), GIT_SHA1_HEXSZ);\n+\tbranch = deref_tag(parse_object(oid), oid_to_hex(oid), the_hash_algo->hexsz);\n \tif (!branch || branch->type != OBJ_COMMIT)\n \t\treturn;\n \n@@ -545,6 +546,7 @@ static void find_merge_parents(struct merge_parents *result,\n \t\tint len;\n \t\tchar *p = in->buf + pos;\n \t\tchar *newline = strchr(p, '\\n');\n+\t\tconst char *q;\n \t\tstruct object_id oid;\n \t\tstruct commit *parent;\n \t\tstruct object *obj;\n@@ -552,10 +554,9 @@ static void find_merge_parents(struct merge_parents *result,\n \t\tlen = newline ? newline - p : strlen(p);\n \t\tpos += len + !!newline;\n \n-\t\tif (len < GIT_SHA1_HEXSZ + 3 ||\n-\t\t    get_oid_hex(p, &oid) ||\n-\t\t    p[GIT_SHA1_HEXSZ] != '\\t' ||\n-\t\t    p[GIT_SHA1_HEXSZ + 1] != '\\t')\n+\t\tif (parse_oid_hex(p, &oid, &q) ||\n+\t\t    q[0] != '\\t' ||\n+\t\t    q[1] != '\\t')\n \t\t\tcontinue; /* skip not-for-merge */\n \t\t/*\n \t\t * Do not use get_merge_parent() here; we do not have\n"},{"id":"352593","messageId":"20180716012808.961328-12-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 11/16] builtin/merge: switch to use the_hash_algo","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:28:03Z","receivedAt":"2018-07-16T01:28:34Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Switch uses of GIT_SHA1_HEXSZ to use the_hash_algo instead.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/merge.c | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 4a4c09496c..916c9f0569 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1034,6 +1034,7 @@ static void handle_fetch_head(struct commit_list **remotes, struct strbuf *merge\n \tconst char *filename;\n \tint fd, pos, npos;\n \tstruct strbuf fetch_head_file = STRBUF_INIT;\n+\tconst unsigned hexsz = the_hash_algo->hexsz;\n \n \tif (!merge_names)\n \t\tmerge_names = &fetch_head_file;\n@@ -1059,16 +1060,16 @@ static void handle_fetch_head(struct commit_list **remotes, struct strbuf *merge\n \t\telse\n \t\t\tnpos = merge_names->len;\n \n-\t\tif (npos - pos < GIT_SHA1_HEXSZ + 2 ||\n+\t\tif (npos - pos < hexsz + 2 ||\n \t\t    get_oid_hex(merge_names->buf + pos, &oid))\n \t\t\tcommit = NULL; /* bad */\n-\t\telse if (memcmp(merge_names->buf + pos + GIT_SHA1_HEXSZ, \"\\t\\t\", 2))\n+\t\telse if (memcmp(merge_names->buf + pos + hexsz, \"\\t\\t\", 2))\n \t\t\tcontinue; /* not-for-merge */\n \t\telse {\n-\t\t\tchar saved = merge_names->buf[pos + GIT_SHA1_HEXSZ];\n-\t\t\tmerge_names->buf[pos + GIT_SHA1_HEXSZ] = '\\0';\n+\t\t\tchar saved = merge_names->buf[pos + hexsz];\n+\t\t\tmerge_names->buf[pos + hexsz] = '\\0';\n \t\t\tcommit = get_merge_parent(merge_names->buf + pos);\n-\t\t\tmerge_names->buf[pos + GIT_SHA1_HEXSZ] = saved;\n+\t\t\tmerge_names->buf[pos + hexsz] = saved;\n \t\t}\n \t\tif (!commit) {\n \t\t\tif (ptr)\n"},{"id":"352594","messageId":"20180716012808.961328-13-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 12/16] builtin/merge-recursive: make hash independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:28:04Z","receivedAt":"2018-07-16T01:28:34Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Use GIT_MAX_HEXSZ instead of GIT_SHA1_HEXSZ for an allocation so that it\nis sufficiently large.  Switch a comparison to use the_hash_algo to\ndetermine the length of a hex object ID.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/merge-recursive.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c\nindex 0dd9021958..9b2f707c29 100644\n--- a/builtin/merge-recursive.c\n+++ b/builtin/merge-recursive.c\n@@ -9,10 +9,10 @@ static const char builtin_merge_recursive_usage[] =\n \n static const char *better_branch_name(const char *branch)\n {\n-\tstatic char githead_env[8 + GIT_SHA1_HEXSZ + 1];\n+\tstatic char githead_env[8 + GIT_MAX_HEXSZ + 1];\n \tchar *name;\n \n-\tif (strlen(branch) != GIT_SHA1_HEXSZ)\n+\tif (strlen(branch) != the_hash_algo->hexsz)\n \t\treturn branch;\n \txsnprintf(githead_env, sizeof(githead_env), \"GITHEAD_%s\", branch);\n \tname = getenv(githead_env);\n"},{"id":"352595","messageId":"20180716012808.961328-14-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 13/16] diff: switch GIT_SHA1_HEXSZ to use the_hash_algo","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:28:05Z","receivedAt":"2018-07-16T01:28:36Z","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 diff.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 639eb646b9..485ff6c264 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -3832,7 +3832,7 @@ static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev)\n \t\tchar *hex = oid_to_hex(oid);\n \t\tif (abbrev < 0)\n \t\t\tabbrev = FALLBACK_DEFAULT_ABBREV;\n-\t\tif (abbrev > GIT_SHA1_HEXSZ)\n+\t\tif (abbrev > the_hash_algo->hexsz)\n \t\t\tBUG(\"oid abbreviation out of range: %d\", abbrev);\n \t\tif (abbrev)\n \t\t\thex[abbrev] = '\\0';\n@@ -4947,7 +4947,7 @@ const char *diff_aligned_abbrev(const struct object_id *oid, int len)\n \tconst char *abbrev;\n \n \t/* Do we want all 40 hex characters? */\n-\tif (len == GIT_SHA1_HEXSZ)\n+\tif (len == the_hash_algo->hexsz)\n \t\treturn oid_to_hex(oid);\n \n \t/* An abbreviated value is fine, possibly followed by an ellipsis. */\n@@ -4977,7 +4977,7 @@ const char *diff_aligned_abbrev(const struct object_id *oid, int len)\n \t * the automatic sizing is supposed to give abblen that ensures\n \t * uniqueness across all objects (statistically speaking).\n \t */\n-\tif (abblen < GIT_SHA1_HEXSZ - 3) {\n+\tif (abblen < the_hash_algo->hexsz - 3) {\n \t\tstatic char hex[GIT_MAX_HEXSZ + 1];\n \t\tif (len < abblen && abblen <= len + 2)\n \t\t\txsnprintf(hex, sizeof(hex), \"%s%.*s\", abbrev, len+3-abblen, \"..\");\n"},{"id":"352596","messageId":"20180716012808.961328-15-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 14/16] log-tree: switch GIT_SHA1_HEXSZ to the_hash_algo->hexsz","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:28:06Z","receivedAt":"2018-07-16T01:28:37Z","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 log-tree.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex d3a43e29cd..9655de8ad7 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -545,7 +545,7 @@ void show_log(struct rev_info *opt)\n \tstruct strbuf msgbuf = STRBUF_INIT;\n \tstruct log_info *log = opt->loginfo;\n \tstruct commit *commit = log->commit, *parent = log->parent;\n-\tint abbrev_commit = opt->abbrev_commit ? opt->abbrev : GIT_SHA1_HEXSZ;\n+\tint abbrev_commit = opt->abbrev_commit ? opt->abbrev : the_hash_algo->hexsz;\n \tconst char *extra_headers = opt->extra_headers;\n \tstruct pretty_print_context ctx = {0};\n \n"},{"id":"352597","messageId":"20180716012808.961328-16-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 15/16] sha1-file: convert constants to uses of the_hash_algo","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:28:07Z","receivedAt":"2018-07-16T01:28:39Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Convert one use of 20 and several uses of GIT_SHA1_HEXSZ into references\nto the_hash_algo.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n sha1-file.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/sha1-file.c b/sha1-file.c\nindex de4839e634..1f66b9594f 100644\n--- a/sha1-file.c\n+++ b/sha1-file.c\n@@ -336,7 +336,7 @@ int raceproof_create_file(const char *path, create_file_fn fn, void *cb)\n static void fill_sha1_path(struct strbuf *buf, const unsigned char *sha1)\n {\n \tint i;\n-\tfor (i = 0; i < 20; i++) {\n+\tfor (i = 0; i < the_hash_algo->rawsz; i++) {\n \t\tstatic char hex[] = \"0123456789abcdef\";\n \t\tunsigned int val = sha1[i];\n \t\tstrbuf_addch(buf, hex[val >> 4]);\n@@ -1473,7 +1473,7 @@ void *read_object_with_reference(const struct object_id *oid,\n \t\t}\n \t\tref_length = strlen(ref_type);\n \n-\t\tif (ref_length + GIT_SHA1_HEXSZ > isize ||\n+\t\tif (ref_length + the_hash_algo->hexsz > isize ||\n \t\t    memcmp(buffer, ref_type, ref_length) ||\n \t\t    get_oid_hex((char *) buffer + ref_length, &actual_oid)) {\n \t\t\tfree(buffer);\n@@ -2062,9 +2062,9 @@ int for_each_file_in_obj_subdir(unsigned int subdir_nr,\n \t\tnamelen = strlen(de->d_name);\n \t\tstrbuf_setlen(path, baselen);\n \t\tstrbuf_add(path, de->d_name, namelen);\n-\t\tif (namelen == GIT_SHA1_HEXSZ - 2 &&\n+\t\tif (namelen == the_hash_algo->hexsz - 2 &&\n \t\t    !hex_to_bytes(oid.hash + 1, de->d_name,\n-\t\t\t\t  GIT_SHA1_RAWSZ - 1)) {\n+\t\t\t\t  the_hash_algo->rawsz - 1)) {\n \t\t\tif (obj_cb) {\n \t\t\t\tr = obj_cb(&oid, path->buf, data);\n \t\t\t\tif (r)\n"},{"id":"352598","messageId":"20180716012808.961328-17-sandals@crustytoothpaste.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"[PATCH v2 16/16] pretty: switch hard-coded constants to the_hash_algo","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-07-16T01:28:08Z","receivedAt":"2018-07-16T01:28:41Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Switch several hard-coded constants into expressions based either on\nGIT_MAX_HEXSZ or the_hash_algo.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n pretty.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex 703fa6ff7b..b0e653ff25 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1575,7 +1575,7 @@ static void pp_header(struct pretty_print_context *pp,\n \t\t}\n \n \t\tif (starts_with(line, \"parent \")) {\n-\t\t\tif (linelen != 48)\n+\t\t\tif (linelen != the_hash_algo->hexsz + 8)\n \t\t\t\tdie(\"bad parent line in commit\");\n \t\t\tcontinue;\n \t\t}\n@@ -1583,7 +1583,7 @@ static void pp_header(struct pretty_print_context *pp,\n \t\tif (!parents_shown) {\n \t\t\tunsigned num = commit_list_count(commit->parents);\n \t\t\t/* with enough slop */\n-\t\t\tstrbuf_grow(sb, num * 50 + 20);\n+\t\t\tstrbuf_grow(sb, num * (GIT_MAX_HEXSZ + 10) + 20);\n \t\t\tadd_merge_info(pp, sb, commit);\n \t\t\tparents_shown = 1;\n \t\t}\n"},{"id":"352629","messageId":"668c27f2-fb61-32c5-7664-160d9a9f7e18@gmail.com","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"Re: [PATCH v2 00/16] object_id part 14","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2018-07-16T14:49:11Z","receivedAt":"2018-07-16T14:49:15Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 7/15/2018 9:27 PM, brian m. carlson wrote:\n> This is the fourteenth series of patches to switch to using struct\n> object_id and the_hash_algo.  This series converts several core pieces\n> to use struct object_id, including the oid* and hex functions.\n>\n> All of these patches have been tested with both SHA-1 and a 256-bit\n> hash.\n>\n> Most of these patches are fixes for things that will clearly cause\n> segfaults or other very obvious breakage on a Git with a 256-bit hash.\n>\n> Changes from v1:\n> * Drop patch that's been replaced by one from Ben Peart.\n> * Update patch handling hash* and oid* functions.\n\nI re-read this series and it looks good to me. Thanks!\n\nReviewed-by: Derrick Stolee <dstolee@microsoft.com>\n\n"},{"id":"352630","messageId":"20180716152152.GA51419@syl.attlocal.net","threadId":"48886","inReplyTo":"20180716012808.961328-1-sandals@crustytoothpaste.net","subject":"Re: [PATCH v2 00/16] object_id part 14","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2018-07-16T15:21:52Z","receivedAt":"2018-07-16T15:21:56Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Mon, Jul 16, 2018 at 01:27:52AM +0000, brian m. carlson wrote:\n> This is the fourteenth series of patches to switch to using struct\n> object_id and the_hash_algo.  This series converts several core pieces\n> to use struct object_id, including the oid* and hex functions.\n>\n> All of these patches have been tested with both SHA-1 and a 256-bit\n> hash.\n>\n> Most of these patches are fixes for things that will clearly cause\n> segfaults or other very obvious breakage on a Git with a 256-bit hash.\n>\n> Changes from v1:\n> * Drop patch that's been replaced by one from Ben Peart.\n> * Update patch handling hash* and oid* functions.\n\nAlong with Derrick, I also read this series and found it to be without\nproblems. This looks good to me, too.\n\nReviewed-by: Taylor Blau <me@ttaylorr.com>\n\nThanks,\nTaylor\n"},{"id":"352640","messageId":"CAGZ79kbAMJXAPtc5b45_PRDC=AQRKUYLC8seXqfMrJZEaL-KfQ@mail.gmail.com","threadId":"48886","inReplyTo":"20180716152152.GA51419@syl.attlocal.net","subject":"Re: [PATCH v2 00/16] object_id part 14","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-07-16T18:04:41Z","receivedAt":"2018-07-16T18:04:54Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Jul 16, 2018 at 8:21 AM Taylor Blau <me@ttaylorr.com> wrote:\n>\n> On Mon, Jul 16, 2018 at 01:27:52AM +0000, brian m. carlson wrote:\n> > This is the fourteenth series of patches to switch to using struct\n> > object_id and the_hash_algo.  This series converts several core pieces\n> > to use struct object_id, including the oid* and hex functions.\n> >\n> > All of these patches have been tested with both SHA-1 and a 256-bit\n> > hash.\n> >\n> > Most of these patches are fixes for things that will clearly cause\n> > segfaults or other very obvious breakage on a Git with a 256-bit hash.\n> >\n> > Changes from v1:\n> > * Drop patch that's been replaced by one from Ben Peart.\n> > * Update patch handling hash* and oid* functions.\n>\n> Along with Derrick, I also read this series and found it to be without\n> problems. This looks good to me, too.\n\nI just had a hickup with the patch replacing number magic\n( \"(num_parents * 50) + 20\") in a strbuf_grow, but I do not\nsee the problem there, it is just a bit of overly large grow estimates.\nDespite that said, this series is\n\nReviewed-by: Stefan Beller <sbeller@google.com>\n\nThanks,\nStefan\n"}]}