Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improved gitoid_from_buffer, misc. fixups #95

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

alilleybrinker
Copy link
Member

This commit does a few things:

  • Refactors gitoid_from_buffer to delegate to BufReader.
  • Uses format_bytes::format_bytes instead of format to construct
    prefix for hashing.
  • Adds GitOid::from_reader_with_expected_length to support
    non-Seek-able readers and avoid cost of seeking if length is
    already known.
  • Adds GITOID_URL_SCHEME constant to replace two uses of
    literal string and ensure they're always consistent.
  • Updates FFI to support new from_reader_with_expected_length
  • Updates FFI to avoid double-buffering when building a GitOid
    from a reader, since the underlying implementation buffers.
  • Adds FFI support for new from_reader_with_expected_length
    constructor.
  • Renames FFI constructor from new_from* to from*, and
    updates C test code to use the new prefix.

This commit does a few things:

- Refactors gitoid_from_buffer to delegate to BufReader.
- Uses format_bytes::format_bytes instead of format to construct
  prefix for hashing.
- Adds GitOid::from_reader_with_expected_length to support
  non-Seek-able readers and avoid cost of seeking if length is
  already known.
- Adds GITOID_URL_SCHEME constant to replace two uses of
  literal string and ensure they're always consistent.
- Updates FFI to support new from_reader_with_expected_length
- Updates FFI to avoid double-buffering when building a GitOid
  from a reader, since the underlying implementation buffers.
- Adds FFI support for new from_reader_with_expected_length
  constructor.
- Renames FFI constructor from _new_from_* to _from_*, and
  updates C test code to use the new prefix.

Signed-off-by: Andrew Lilley Brinker <[email protected]>
@alilleybrinker alilleybrinker force-pushed the alilleybrinker/better_constructors branch from 0b8ea1d to 93e6824 Compare February 13, 2024 23:39
@alilleybrinker alilleybrinker merged commit d746446 into main Feb 13, 2024
2 checks passed
@alilleybrinker alilleybrinker deleted the alilleybrinker/better_constructors branch February 13, 2024 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant