Skip to content

Commit d16b59c

Browse files
author
Edward Thomson
committed
odb: don't unconditionally add oid_type to stream
`git_odb_stream` should have an `oid_type` to disambiguate; that's not necessary on non-experimental SHA256 builds. Avoid unnecessary ABI breakage for consumers and hide it behind an ifdef for now.
1 parent c9387a6 commit d16b59c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

include/git2/odb_backend.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ struct git_odb_stream {
171171
unsigned int mode;
172172
void *hash_ctx;
173173

174+
#ifdef GIT_EXPERIMENTAL_SHA256
174175
git_oid_t oid_type;
176+
#endif
175177

176178
git_object_size_t declared_size;
177179
git_object_size_t received_bytes;

src/libgit2/odb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,9 @@ int git_odb_open_wstream(
17041704
(error = hash_header(ctx, size, type)) < 0)
17051705
goto done;
17061706

1707+
#ifdef GIT_EXPERIMENTAL_SHA256
17071708
(*stream)->oid_type = db->options.oid_type;
1709+
#endif
17081710
(*stream)->hash_ctx = ctx;
17091711
(*stream)->declared_size = size;
17101712
(*stream)->received_bytes = 0;

0 commit comments

Comments
 (0)