Commit 090a07d2 by Carlos Martín Nieto

odb: avoid hashing twice in and edge case

If none of the backends support direct writes and we must stream the
whole file, we already know what the object's id should be; so use the
stream's functions directly, bypassing the frontend's hashing and
overwriting of our existing id.
parent 7a3764be
...@@ -864,8 +864,8 @@ int git_odb_write( ...@@ -864,8 +864,8 @@ int git_odb_write(
if ((error = git_odb_open_wstream(&stream, db, len, type)) != 0) if ((error = git_odb_open_wstream(&stream, db, len, type)) != 0)
return error; return error;
git_odb_stream_write(stream, data, len); stream->write(stream, data, len);
error = git_odb_stream_finalize_write(oid, stream); error = stream->finalize_write(stream, oid);
git_odb_stream_free(stream); git_odb_stream_free(stream);
return error; return error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment