libgit2/tests/diff/diff_helpers.h
Russell Belfer b23b112dfe Add payloads, bitmaps to trace API
This is a proposed adjustment to the trace APIs.  This makes the
trace levels into a bitmask so that they can be selectively enabled
and adds a callback-level payload, plus a message-level payload.

This makes it easier for me to a GIT_TRACE_PERF callbacks that
are simply bypassed if the PERF level is not set.
2014-05-02 09:21:33 -07:00

79 lines
1.4 KiB
C

#include "fileops.h"
#include "git2/diff.h"
extern git_tree *resolve_commit_oid_to_tree(
git_repository *repo, const char *partial_oid);
typedef struct {
int files;
int files_binary;
int file_status[10]; /* indexed by git_delta_t value */
int hunks;
int hunk_new_lines;
int hunk_old_lines;
int lines;
int line_ctxt;
int line_adds;
int line_dels;
/* optional arrays of expected specific values */
const char **names;
int *statuses;
int debug;
} diff_expects;
typedef struct {
const char *path;
const char *matched_pathspec;
} notify_expected;
extern int diff_file_cb(
const git_diff_delta *delta,
float progress,
void *cb_data);
extern int diff_print_file_cb(
const git_diff_delta *delta,
float progress,
void *cb_data);
extern int diff_hunk_cb(
const git_diff_delta *delta,
const git_diff_hunk *hunk,
void *cb_data);
extern int diff_line_cb(
const git_diff_delta *delta,
const git_diff_hunk *hunk,
const git_diff_line *line,
void *cb_data);
extern int diff_foreach_via_iterator(
git_diff *diff,
git_diff_file_cb file_cb,
git_diff_hunk_cb hunk_cb,
git_diff_line_cb line_cb,
void *data);
extern void diff_print(FILE *fp, git_diff *diff);
extern void diff_print_raw(FILE *fp, git_diff *diff);
#include "git2/trace.h"
typedef struct {
size_t stat_calls;
size_t oid_calcs;
size_t submodule_lookups;
} diff_perf;
extern void diff_perf_track_stats(
git_trace_level_t level,
void *cb_payload,
void *msg_payload,
const char *msg);