summaryrefslogtreecommitdiff
path: root/src/commit_graph.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-09-30 08:11:40 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-10-02 16:34:47 -0400
commit31ecaca2d3e87d20782a54cb319f5c19e6c6e62f (patch)
tree06131413f2e42a8c3e51bbe0134f9267531bad62 /src/commit_graph.c
parent2a713da1ec2e9f74c9edc75b06540ab095c68c34 (diff)
downloadlibgit2-31ecaca2d3e87d20782a54cb319f5c19e6c6e62f.tar.gz
hash: hash functions operate on byte arrays not git_oids
Separate the concerns of the hash functions from the git_oid functions. The git_oid structure will need to understand either SHA1 or SHA256; the hash functions should only deal with the appropriate one of these.
Diffstat (limited to 'src/commit_graph.c')
-rw-r--r--src/commit_graph.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/commit_graph.c b/src/commit_graph.c
index 8bb2397d7..df760b5f8 100644
--- a/src/commit_graph.c
+++ b/src/commit_graph.c
@@ -230,7 +230,7 @@ int git_commit_graph_file_parse(
return commit_graph_error("wrong commit-graph size");
git_oid_cpy(&file->checksum, (git_oid *)(data + trailer_offset));
- if (git_hash_buf(&cgraph_checksum, data, (size_t)trailer_offset, GIT_HASH_ALGORITHM_SHA1) < 0)
+ if (git_hash_buf(cgraph_checksum.id, data, (size_t)trailer_offset, GIT_HASH_ALGORITHM_SHA1) < 0)
return commit_graph_error("could not calculate signature");
if (!git_oid_equal(&cgraph_checksum, &file->checksum))
return commit_graph_error("index signature mismatch");
@@ -1132,7 +1132,7 @@ static int commit_graph_write(
goto cleanup;
/* Finalize the checksum and write the trailer. */
- error = git_hash_final(&cgraph_checksum, &ctx);
+ error = git_hash_final(cgraph_checksum.id, &ctx);
if (error < 0)
goto cleanup;
error = write_cb((const char *)&cgraph_checksum, sizeof(cgraph_checksum), cb_data);