summaryrefslogtreecommitdiff
path: root/tests/diff/format_email.c
Commit message (Collapse)AuthorAgeFilesLines
* refactor: `tests` is now `tests/libgit2`Edward Thomson2022-02-221-523/+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-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* diff: deprecate diff_format_emailethomson/emailEdward Thomson2021-09-181-0/+20
| | | | `git_diff_format_email` is deprecated in favor of `git_email_create`.
* email: allow `git_diff_commit_as_email` to take 0 as patch indexEdward Thomson2021-09-181-1/+0
| | | | | Allow a `0` patch index and `0` patch count; in this case, simply don't display these in the email.
* Fix binary diff showing /dev/nullKevin Swinton2020-04-181-2/+1
| | | | | | Fixes issue where a changed binary file's content in the working tree isn't displayed correctly, instead showing an oid of zero, and with its path being reported incorrectly as "/dev/null".
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-3/+3
|
* Merge branch 'pr/3809'Edward Thomson2016-10-091-2/+2
|\
| * make git_diff_stats_to_buf not show 0 insertions or 0 deletionsSim Domingo2016-10-091-2/+2
| |
* | patch: show copy information for identical copiesEdward Thomson2016-06-251-3/+0
| | | | | | | | | | | | | | When showing copy information because we are duplicating contents, for example, when performing a `diff --find-copies-harder -M100 -B100`, then show copy from/to lines in a patch, and do not show context. Ensure that we can also parse such patches.
* | git_diff_generated: abstract generated diffsEdward Thomson2016-05-261-0/+1
|/
* tests: take the version from our defineCarlos Martín Nieto2016-03-031-1/+1
|
* diff: include commit message when formatting patchPatrick Steinhardt2015-12-011-0/+41
| | | | | | When formatting a patch as email we do not include the commit's message in the formatted patch output. Implement this and add a test that verifies behavior.
* Use git_diff_get_stats in example/diff + refactorRussell Belfer2014-04-221-141/+52
| | | | | | | | | | | | | | | | | | | | | This takes the `--stat` and related example options in the example diff.c program and converts them to use the `git_diff_get_stats` API which nicely formats stats for you. I went to add bar-graph scaling to the stats formatter and noticed that the `git_diff_stats` structure was holding on to all of the `git_patch` objects. Unfortunately, each of these objects keeps the full text of the diff in memory, so this is very expensive. I ended up modifying `git_diff_stats` to keep just the data that it needs to keep and allowed it to release the patches. Then, I added width scaling to the output on top of that. In making the diff example program match 'git diff' output, I ended up removing an newline from the sumamry output which I then had to compensate for in the email formatting to match the expectations. Lastly, I went through and refactored the tests to use a couple of helper functions and reduce the overall amount of code there.
* Added a test case for formatting a binary patch e-mailJacques Germishuys2014-04-151-0/+43
|
* Sanitize git_diff_format_email_options' summary parameterJacques Germishuys2014-04-151-0/+68
| | | | It will form part of the subject line and should thus be one line.
* Introduce git_diff_format_email and git_diff_commit_as_emailJacques Germishuys2014-04-151-0/+445