Skip to content

Introduce git_object_id_from... APIs #7001

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

ethomson
Copy link
Member

@ethomson ethomson commented Jan 3, 2025

Introduce git_object_id_from... APIs; these allow consumers to calculate object IDs from raw content either in a buffer, or on-disk. This deprecates git_odb_hash and git_odb_hashfile.

These are basically just refactorings of those old APIs into a new namespace that takes an options structure for SHA256 compatibility. In addition, object_type is moved into the options structure since most consumers likely only ever hash blobs and are not playing with other types. Finally, filters are now optional, to remove the internal hashfd_filtered APIs and to better support git_repository_hashfile.

@ethomson ethomson force-pushed the ethomson/object_id branch 6 times, most recently from 3d64cee to eae19b4 Compare January 3, 2025 17:17
Introduce APIs within the `git_object` namespace to calculate the IDs
of objects based on their raw content.
Using the `git_object_id_from` is an overall code simplification; switch
to it.
Hash generation is not a concern of the object database; deprecate
`git_odb_hash`.
@ethomson ethomson force-pushed the ethomson/object_id branch from eae19b4 to db23a7e Compare January 3, 2025 20:10
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