diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2021-10-17 09:25:47 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-17 09:25:47 -0400 |
| commit | 66ffac25110b3ab0f81e547f0045a1d0fe6991d5 (patch) | |
| tree | 8ac2c277f0d9618a6aeecd7f61ac51a7b06c692b /src/midx.c | |
| parent | b5a7af28894331c3ab920737a5608172a445e3fc (diff) | |
| parent | f0a0916028ef1c599030f513c0685b77d74e6c21 (diff) | |
| download | libgit2-66ffac25110b3ab0f81e547f0045a1d0fe6991d5.tar.gz | |
Merge pull request #6082 from libgit2/ethomson/oid
hash: separate hashes and git_oid
Diffstat (limited to 'src/midx.c')
| -rw-r--r-- | src/midx.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/midx.c b/src/midx.c index 6a885eddc..cd3c98cef 100644 --- a/src/midx.c +++ b/src/midx.c @@ -212,7 +212,7 @@ int git_midx_parse( return midx_error("wrong index size"); git_oid_cpy(&idx->checksum, (git_oid *)(data + trailer_offset)); - if (git_hash_buf(&idx_checksum, data, (size_t)trailer_offset) < 0) + if (git_hash_buf(idx_checksum.id, data, (size_t)trailer_offset, GIT_HASH_ALGORITHM_SHA1) < 0) return midx_error("could not calculate signature"); if (!git_oid_equal(&idx_checksum, &idx->checksum)) return midx_error("index signature mismatch"); @@ -668,7 +668,7 @@ static int midx_write( hash_cb_data.cb_data = cb_data; hash_cb_data.ctx = &ctx; - error = git_hash_ctx_init(&ctx); + error = git_hash_ctx_init(&ctx, GIT_HASH_ALGORITHM_SHA1); if (error < 0) return error; cb_data = &hash_cb_data; @@ -819,7 +819,7 @@ static int midx_write( goto cleanup; /* Finalize the checksum and write the trailer. */ - error = git_hash_final(&idx_checksum, &ctx); + error = git_hash_final(idx_checksum.id, &ctx); if (error < 0) goto cleanup; error = write_cb((const char *)&idx_checksum, sizeof(idx_checksum), cb_data); |
