mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-04 12:14:50 +00:00

This is a major reorganization of the diff code. This changes the diff functions to use the iterators for traversing the content. This allowed a lot of code to be simplified. Also, this moved the functions relating to outputting a diff into a new file (diff_output.c). This includes a number of other changes - adding utility functions, extending iterators, etc. plus more tests for the diff code. This also takes the example diff.c program much further in terms of emulating git-diff command line options.
44 lines
735 B
C
44 lines
735 B
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 file_adds;
|
|
int file_dels;
|
|
int file_mods;
|
|
int file_ignored;
|
|
int file_untracked;
|
|
|
|
int hunks;
|
|
int hunk_new_lines;
|
|
int hunk_old_lines;
|
|
|
|
int lines;
|
|
int line_ctxt;
|
|
int line_adds;
|
|
int line_dels;
|
|
} diff_expects;
|
|
|
|
extern int diff_file_fn(
|
|
void *cb_data,
|
|
git_diff_delta *delta,
|
|
float progress);
|
|
|
|
extern int diff_hunk_fn(
|
|
void *cb_data,
|
|
git_diff_delta *delta,
|
|
git_diff_range *range,
|
|
const char *header,
|
|
size_t header_len);
|
|
|
|
extern int diff_line_fn(
|
|
void *cb_data,
|
|
git_diff_delta *delta,
|
|
char line_origin,
|
|
const char *content,
|
|
size_t content_len);
|
|
|