Diff is a representation of a git diff.
More...
#include <Diff.h>
|
|
size_t | numDeltas () const noexcept |
| | Get count of deltas in this Diff.
|
|
size_t | numDeltas (const git_delta_t &type) const noexcept |
| | Get count of deltas with the type (GIT_DELTA_ADDED, ...).
|
|
const git_diff_delta * | getDelta (size_t idx) const noexcept |
| | Get a delta on the idx-th position.
|
| bool | findSimilar (const git_diff_find_options *options=nullptr) const noexcept |
| | Find similar files in the Diff (in-place).
|
|
bool | isSortedICase () const noexcept |
| | Return true if ignore-case-sorted.
|
| int | forEach (const ForEachCB &forEachCB) const |
| | Invoke forEachCB callbacks for each file, hunk, ... in the diff.
|
| int | print (git_diff_format_t format, const PrintCB &printCB) const |
| | Invoke forEachCB callbacks for each file, hunk, ... in the diff.
|
|
std::optional< Buf > | toBuf (git_diff_format_t format) const noexcept |
| | Convert to Buf.
|
|
GitTy * | diff () const noexcept |
| | Get the stored pointer to libgit2's git_diff.
|
|
| operator GitTy * () const noexcept |
| | Alias for diff() – implicit conversion.
|
|
|
static std::optional< Diff > | createFromBuffer (std::string_view buffer) noexcept |
| | Create a new Diff from buffer.
|
Diff is a representation of a git diff.
◆ PrintCB
Initial value:std::function<int(const git_diff_delta &delta, const git_diff_hunk *hunk,
const git_diff_line &line)>
Callback for print().
◆ findSimilar()
| bool SlGit::Diff::findSimilar |
( |
const git_diff_find_options * | options = nullptr | ) |
const |
|
inlinenoexcept |
Find similar files in the Diff (in-place).
- Parameters
-
| options | Options to use (like rename threshold) |
- Returns
- True on success.
◆ forEach()
| int SlGit::Diff::forEach |
( |
const ForEachCB & | forEachCB | ) |
const |
Invoke forEachCB callbacks for each file, hunk, ... in the diff.
- Parameters
-
- Returns
- 0 on success, non-zero callback return value, or error code.
◆ print()
| int SlGit::Diff::print |
( |
git_diff_format_t | format, |
|
|
const PrintCB & | printCB ) const |
Invoke forEachCB callbacks for each file, hunk, ... in the diff.
- Parameters
-
| format | GIT_DIFF_FORMAT_PATCH, GIT_DIFF_FORMAT_PATCH_HEADER, ... |
| printCB | Callback |
- Returns
- 0 on success, non-zero callback return value, or error code.
The documentation for this class was generated from the following file:
- /home/abuild/rpmbuild/BUILD/slhelpers-20260428.f233ce9-build/slhelpers-20260428.f233ce9/include/git/Diff.h