mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 16:45:49 +00:00
![]() 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. |
||
---|---|---|
.. | ||
attr | ||
blame | ||
buf | ||
checkout | ||
cherrypick | ||
clar | ||
clone | ||
commit | ||
config | ||
core | ||
date | ||
diff | ||
fetchhead | ||
filter | ||
graph | ||
index | ||
merge | ||
network | ||
notes | ||
object | ||
odb | ||
online | ||
pack | ||
refs | ||
repo | ||
reset | ||
resources | ||
revert | ||
revwalk | ||
stash | ||
status | ||
stress | ||
structinit | ||
submodule | ||
threads | ||
trace | ||
clar_libgit2.c | ||
clar_libgit2.h | ||
clar.c | ||
clar.h | ||
generate.py | ||
main.c | ||
README.md | ||
valgrind-supp-mac.txt |
Writing Clar tests for libgit2
For information on the Clar testing framework and a detailed introduction please visit:
-
Write your modules and tests. Use good, meaningful names.
-
Make sure you actually build the tests by setting:
cmake -DBUILD_CLAR=ON build/
-
Test:
./build/libgit2_clar
-
Make sure everything is fine.
-
Send your pull request. That's it.