Introduce a new commit API#7237
Open
ethomson wants to merge 3 commits into
Open
Conversation
1a14be7 to
7d4022b
Compare
| * Flags for creating the commit. | ||
| * | ||
| * If `allow_empty_commit` is specified, a commit with no changes | ||
| * from the prior commit (and "empty" commit) is allowed. Otherwise, |
Contributor
There was a problem hiding this comment.
is this a typo?
Suggested change
| * from the prior commit (and "empty" commit) is allowed. Otherwise, | |
| * from the prior commit (an "empty" commit) is allowed. Otherwise, |
Introduce `git_commit_create_ext` and an options structure for extensibility. Non-default arguments (message encoding, reference updates) are in the options structure. This simplifies the complex self-service commit creation APIs and allows for future sustainable improvements.
Some clients (eg GitButler) are storing additional information in custom user-specified commit headers. We should make this a first-class concept.
Callers can now introduce a commit signing callback instead of needing to call a specialized commit buffer creation function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new, extensible API for creating commits in libgit2, providing greater flexibility and control over commit creation. The main changes include the addition of new options structures for commit creation (including support for extra headers and signing callbacks), the introduction of a new
git_commit_create_extfunction, and the refactoring of internal commit creation logic to use these new options. Existing commit creation functions are updated to use the new API internally, ensuring backward compatibility.New commit creation API and extensibility:
git_commit_create_ext_optionsandgit_commit_headerstructs, enabling extra headers, commit signing callbacks, and reference updates when creating commits.git_commit_create_extfunction, which provides the most flexible way to create commit objects, supporting the new options structure.git_commitbuilderstruct andgit_commitbuilder_add_headerfunction for setting custom commit headers during the signing process. [1] [2]Refactoring of internal commit creation logic:
git_commit_create_ext_options), and updated all existing commit creation functions (git_commit_create,git_commit_create_v,git_commit_create_from_ids,git_commit_create_from_callback,git_commit_amend) to use this new infrastructure. [1] [2] [3] [4] [5] [6] [7] [8]Support for extra commit headers and signing:
API cleanup and consistency:
git_commit_create_optionsstruct and related functions, consolidating options into the new extensible format.