Skip to content

Commit creation API streamlining #5116

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

Closed
wants to merge 8 commits into from

Conversation

tiennou
Copy link
Contributor

@tiennou tiennou commented Jun 15, 2019

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.

  • prepare a buffer given a git_commit_desc
  • write a commit object to a repository, given a git_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 fromstate becomes 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.

carlosmn and others added 8 commits June 14, 2019 15:17
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.
Base automatically changed from master to main January 7, 2021 10:09
@ethomson
Copy link
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. 🙏

@ethomson ethomson closed this Oct 19, 2024
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.

3 participants