summaryrefslogtreecommitdiff
path: root/src/config_file.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/config_file.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/config_file.c')
-rw-r--r--src/config_file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/config_file.c b/src/config_file.c
index e1adb2cbc..2f83a4070 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -144,7 +144,7 @@ static int config_file_is_modified(int *modified, config_file *file)
if ((error = git_futils_readbuffer(&buf, file->path)) < 0)
goto out;
- if ((error = git_hash_buf(&hash, buf.ptr, buf.size, GIT_HASH_ALGORITHM_SHA1)) < 0)
+ if ((error = git_hash_buf(hash.id, buf.ptr, buf.size, GIT_HASH_ALGORITHM_SHA1)) < 0)
goto out;
if (!git_oid_equal(&hash, &file->checksum)) {
@@ -869,7 +869,7 @@ static int config_file_read(
goto out;
git_futils_filestamp_set_from_stat(&file->stamp, &st);
- if ((error = git_hash_buf(&file->checksum, contents.ptr, contents.size, GIT_HASH_ALGORITHM_SHA1)) < 0)
+ if ((error = git_hash_buf(file->checksum.id, contents.ptr, contents.size, GIT_HASH_ALGORITHM_SHA1)) < 0)
goto out;
if ((error = config_file_read_buffer(entries, repo, file, level, depth,