pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/libgit2/libgit2/pull/7237

4bb.css" /> Introduce a new commit API by ethomson · Pull Request #7237 · libgit2/libgit2 · GitHub
Skip to content

Introduce a new commit API#7237

Open
ethomson wants to merge 3 commits into
mainfrom
ethomson/commit
Open

Introduce a new commit API#7237
ethomson wants to merge 3 commits into
mainfrom
ethomson/commit

Conversation

@ethomson
Copy link
Copy Markdown
Member

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_ext function, 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:

  • Added git_commit_create_ext_options and git_commit_header structs, enabling extra headers, commit signing callbacks, and reference updates when creating commits.
  • Introduced the git_commit_create_ext function, which provides the most flexible way to create commit objects, supporting the new options structure.
  • Added git_commitbuilder struct and git_commitbuilder_add_header function for setting custom commit headers during the signing process. [1] [2]

Refactoring of internal commit creation logic:

  • Refactored internal commit creation to use the new options struct (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:

  • Added support for appending extra headers and handling commit signing callbacks in the commit creation buffer logic. [1] [2] [3]

API cleanup and consistency:

  • Removed the old git_commit_create_options struct and related functions, consolidating options into the new extensible format.
  • Updated function signatures and internal data structures for consistency and future extensibility. [1] [2] [3] [4]

@ethomson ethomson force-pushed the ethomson/commit branch 3 times, most recently from 1a14be7 to 7d4022b Compare April 30, 2026 22:48
Comment thread include/git2/commit.h
* 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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks!

ethomson added 3 commits May 2, 2026 08:52
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.
@ethomson ethomson force-pushed the ethomson/commit branch from 7d4022b to b71caf7 Compare May 2, 2026 07:52
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.

2 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy