Add commit to recipes
The recipes section doesn't contain commit example. It would be nice to see "empty commit" example and example with some payload there.
https://github.com/sdg-mit/gitless/issues/176
Something like: http://www.pygit2.org/objects.html#creating-commits ?
Like, but with explanations. If both author and committer are obligatory? What is tree and can I omit that for empty commit? What is this name of reference and can I again skip it?
author and committer are mandatory tree is required, just don't change it if you want to do an empty commit (taking a guess here, not tested) the reference is the branch where the commit is, it's mandatory
I'm also stuck on the amazingly simple task of making a commit and it's shocking to me that it's not one of the first "recipies."
I've followed that section under creating-commits and as far as I can tell it hasn't actually fully committed my change, so in addition to it not being explained clearly as a recipe, it's also not complete or even correct.
Something like: http://www.pygit2.org/objects.html#creating-commits ?
sadly, not quite enough. this example results in KeyError or _pygit2.GitError being raised, "the requested type does not match the type in the ODB" or, "failed to create commit: current tip is not the first parent", etc. most of the google results for "pygit2 create commit" are years old and the code doesn't work the same now and prior attempts are often The Wrong Way and result in corrupted repos. further, nearly all of these examples do all the work on the main/master branch and nearly all of them refer to a virgin repository.
how about a few examples reflecting these situations:
totally new, the virgin repository
- git init
- create branch hotfix/foobar1
- create commit
- push
- checkout main
- merge hotfix/foobar
existing repo, new branch
- git clone (or pull) (main branch)
- create branch hotfix/foobar2
- checkout branch hotfix/foobar2
- create commit
- push
- checkout main
- merge hotfix/foobar2
existing repo, existing branch with prior commits
- git clone (or pull) (main branch)
- checkout existing branch (hotfix/foobar3)
- git pull
- create commit
- push
- checkout main
- merge hotfix/foobar3
I see this recipe was created this February, though I've long since moved on from what I was working on that I needed this so I can't validate if it works, but at least it makes sense as I read it. https://www.pygit2.org/recipes/git-commit.html#
unfortunately, those recipes don't work except for the starting new repo
commit is added to examples https://www.pygit2.org/recipes/git-commit.html by @skieffer in #1125.
@FirefighterBlu3 do you mean that these recipes don't work with existing repositories? What error do you get? Or what specifically doesn't work for you?