Skip to content

Commit a7ca589

Browse files
committed
midx: don't update finalized hash
Ensure that we don't update the finalized commit graph hash; clear it instead.
1 parent 637ab37 commit a7ca589

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/libgit2/midx.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,9 +660,11 @@ static int midx_write_hash(const char *buf, size_t size, void *data)
660660
struct midx_write_hash_context *ctx = (struct midx_write_hash_context *)data;
661661
int error;
662662

663-
error = git_hash_update(ctx->ctx, buf, size);
664-
if (error < 0)
665-
return error;
663+
if (ctx->ctx) {
664+
error = git_hash_update(ctx->ctx, buf, size);
665+
if (error < 0)
666+
return error;
667+
}
666668

667669
return ctx->write_cb(buf, size, ctx->cb_data);
668670
}
@@ -863,6 +865,9 @@ static int midx_write(
863865
error = git_hash_final(checksum, &ctx);
864866
if (error < 0)
865867
goto cleanup;
868+
869+
hash_cb_data.ctx = NULL;
870+
866871
error = write_cb((char *)checksum, checksum_size, cb_data);
867872
if (error < 0)
868873
goto cleanup;

0 commit comments

Comments
 (0)