summaryrefslogtreecommitdiff
path: root/src/util/filebuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/filebuf.c')
-rw-r--r--src/util/filebuf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/filebuf.c b/src/util/filebuf.c
index e014d43b2..7afb76b88 100644
--- a/src/util/filebuf.c
+++ b/src/util/filebuf.c
@@ -302,11 +302,16 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
}
/* If we are hashing on-write, allocate a new hash context */
- if (flags & GIT_FILEBUF_HASH_CONTENTS) {
+ if (flags & GIT_FILEBUF_HASH_SHA1) {
file->compute_digest = 1;
if (git_hash_ctx_init(&file->digest, GIT_HASH_ALGORITHM_SHA1) < 0)
goto cleanup;
+ } else if (flags & GIT_FILEBUF_HASH_SHA256) {
+ file->compute_digest = 1;
+
+ if (git_hash_ctx_init(&file->digest, GIT_HASH_ALGORITHM_SHA256) < 0)
+ goto cleanup;
}
compression = flags >> GIT_FILEBUF_DEFLATE_SHIFT;