summaryrefslogtreecommitdiff
path: root/tests/object/commit
Commit message (Collapse)AuthorAgeFilesLines
* str: introduce `git_str` for internal, `git_buf` is externalethomson/gitstrEdward Thomson2021-10-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | libgit2 has two distinct requirements that were previously solved by `git_buf`. We require: 1. A general purpose string class that provides a number of utility APIs for manipulating data (eg, concatenating, truncating, etc). 2. A structure that we can use to return strings to callers that they can take ownership of. By using a single class (`git_buf`) for both of these purposes, we have confused the API to the point that refactorings are difficult and reasoning about correctness is also difficult. Move the utility class `git_buf` to be called `git_str`: this represents its general purpose, as an internal string buffer class. The name also is an homage to Junio Hamano ("gitstr"). The public API remains `git_buf`, and has a much smaller footprint. It is generally only used as an "out" param with strict requirements that follow the documentation. (Exceptions exist for some legacy APIs to avoid breaking callers unnecessarily.) Utility functions exist to convert a user-specified `git_buf` to a `git_str` so that we can call internal functions, then converting it back again.
* clar: include the function nameethomson/clar_tapEdward Thomson2020-06-051-5/+5
|
* object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-011-2/+2
| | | | Use the new object_type enumeration names within the codebase.
* commit: fix reading out of bounds when parsing encodingPatrick Steinhardt2018-10-251-0/+19
| | | | | | | | | | | The commit message encoding is currently being parsed by the `git__prefixcmp` function. As this function does not accept a buffer length, it will happily skip over a buffer's end if it is not `NUL` terminated. Fix the issue by using `git__prefixncmp` instead. Add a test that verifies that we are unable to parse the encoding field if it's cut off by the supplied buffer length.
* tests: add tests that exercise commit parsingPatrick Steinhardt2018-10-251-0/+213
| | | | | | We currently do not have any test suites dedicated to parsing commits from their raw representations. Add one based on `git_object__from_raw` to be able to test special cases more easily.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-1/+1
|
* message: don't assume the comment charcmn/comment-charCarlos Martín Nieto2014-05-181-1/+1
| | | | | The comment char is configurable and we need to provide a way for the user to specify which comment char they chose for their message.
* commit: safer commit creation with reference updatecmn/commit-create-safeCarlos Martín Nieto2014-04-301-0/+9
| | | | | | | | | | | | | | The current version of the commit creation and amend function are unsafe to use when passing the update_ref parameter, as they do not check that the reference at the moment of update points to what the user expects. Make sure that we're moving history forward when we ask the library to update the reference for us by checking that the first parent of the new commit is the current value of the reference. We also make sure that the ref we're updating hasn't moved between the read and the write. Similarly, when amending a commit, make sure that the current tip of the branch is the commit we're amending.
* Add git_commit_amend APIRussell Belfer2014-02-071-0/+76
| | | | | | | | | This adds an API to amend an existing commit, basically a shorthand for creating a new commit filling in missing parameters from the values of an existing commit. As part of this, I also added a new "sys" API to create a commit using a callback to get the parents. This allowed me to rewrite all the other commit creation APIs so that temporary allocations are no longer needed.
* Merge pull request #2075 from libgit2/cmn/leftover-oidVicent Marti2014-01-271-1/+1
|\ | | | | Leftover OID -> ID changes
| * index: rename an entry's id to 'id'Carlos Martín Nieto2014-01-251-1/+1
| | | | | | | | This was not converted when we converted the rest, so do it now.
* | messsage: use git_buf in prettify()Carlos Martín Nieto2014-01-271-3/+5
|/ | | | | A lot of the tests were checking for overflow, which we don't have anymore, so we can remove them.
* Rename tests-clar to testsBen Straub2013-11-141-0/+132