Commit creation API streamlining#5116
Closed
tiennou wants to merge 8 commits into
Closed
Conversation
This variant of the commit creation function takes the reference to update, the tree and the parents from the current branch, index and merging state, allowing for simpler use of a common use-case.
Currently git_commit_create() takes on creating a commit and updating a reference. Provide a better interface by splitting up each of the concerns into named functions for each. git_commit_create() will only create the commit, it will not modify any reference. git_commit_create_on() takes a reference name to update and git_commit_create_on_head() is a convenience function to update HEAD.
We now have `_fromstate` and `_fromstate_on_head`, the latter of which updates the current branch to point to the new commit.
This should be a good place to eventually make use of `_fromstate` depending on what we're trying to show in this example.
Member
|
We've made some nice changes in the commit API space; certainly I'm willing to do more, but this has become very outdated. 🙏 |
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 is a rebase of #3075, with the attempt at a more general low-level API I've envisioned for #4913 (comment).
It's slightly different in that I (should) have taken care of not changing anything with old API, and only implement new things on top on newly added functions.
And then I'm adding low-level methods to manipulate a
git_commit_desc, which serves to keep track of "the parts of a commit", via the following way.git_commit_descgit_commit_desc, and some options.This is still very much in flux, as I'm still trying to see how much things I can delegate to the low-level helpers (stuff like
fromstatebecomes an option when object-writing). Ideally in the end it should be possible to reimplement all the new "helpers" from #3075 using those two, but I wanted the "cleaner API" first. Thus, any design insights would be welcome.