summaryrefslogtreecommitdiff
path: root/tests/diff/patch.c
Commit message (Collapse)AuthorAgeFilesLines
* refactor: `tests` is now `tests/libgit2`Edward Thomson2022-02-221-703/+0
| | | | | | Like we want to separate libgit2 and utility source code, we want to separate libgit2 and utility tests. Start by moving all the tests into libgit2.
* str: introduce `git_str` for internal, `git_buf` is externalethomson/gitstrEdward Thomson2021-10-171-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* buf: remove internal `git_buf_text` namespaceEdward Thomson2021-05-111-1/+0
| | | | | The `git_buf_text` namespace is unnecessary and strange. Remove it, just keep the functions prefixed with `git_buf`.
* Rename opt init functions to `options_init`Edward Thomson2019-06-141-1/+1
| | | | | | | | | | | | | In libgit2 nomenclature, when we need to verb a direct object, we name a function `git_directobject_verb`. Thus, if we need to init an options structure named `git_foo_options`, then the name of the function that does that should be `git_foo_options_init`. The previous names of `git_foo_init_options` is close - it _sounds_ as if it's initializing the options of a `foo`, but in fact `git_foo_options` is its own noun that should be respected. Deprecate the old names; they'll now call directly to the new ones.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-7/+7
|
* Sanitize the hunk header to ensure it contains UTF-8 valid dataStan Hu2018-05-051-0/+92
| | | | | | | | | | The diff driver truncates the hunk header text to 80 bytes, which can truncate 4-byte Unicode characters and introduce garbage characters in the diff output. This change sanitizes the hunk header before it is displayed. This mirrors the test in git: https://github.com/git/git/blob/master/t/t4025-hunk-header.sh Closes https://github.com/libgit2/rugged/issues/716
* patch: emit binary patches (optionally)Edward Thomson2014-04-221-0/+1
|
* Drop git_patch_to_strNicolas Hake2014-01-221-21/+22
| | | | | | | It's hard or even impossible to correctly free the string buffer allocated by git_patch_to_str in some circumstances. Drop the function so people have to use git_patch_to_buf instead - git_buf has a dedicated destructor.
* More tests of canceling from callbacksRussell Belfer2013-12-121-3/+36
| | | | | This covers diff print, push, and ref foreach. This also has a fix for a small memory leak in the push tests.
* Add content offset to git_diff_lineNick Hengeveld2013-11-181-0/+6
| | | | | | For additions and deletions, external consumers like subversion can make use of the content offset to generate diffs in their proprietary formats.
* Rename tests-clar to testsBen Straub2013-11-141-0/+571