Commit 8d44f8b7 by Edward Thomson Committed by Edward Thomson

patch: `patch_diff` -> `patch_generated`

parent 53571f2f
......@@ -7,7 +7,7 @@
#include "common.h"
#include "diff.h"
#include "diff_file.h"
#include "patch_diff.h"
#include "patch_generate.h"
#include "fileops.h"
#include "zstream.h"
#include "blob.h"
......
......@@ -7,7 +7,7 @@
#include "common.h"
#include "vector.h"
#include "diff.h"
#include "patch_diff.h"
#include "patch_generate.h"
#define DIFF_RENAME_FILE_SEPARATOR " => "
#define STATS_FULL_MIN_SCALE 7
......
......@@ -9,7 +9,7 @@
#include "diff.h"
#include "diff_driver.h"
#include "diff_xdiff.h"
#include "patch_diff.h"
#include "patch_generate.h"
static int git_xdiff_scan_int(const char **str, int *value)
{
......@@ -56,7 +56,7 @@ fail:
typedef struct {
git_xdiff_output *xo;
git_patch_diff *patch;
git_patch_generated *patch;
git_diff_hunk hunk;
int old_lineno, new_lineno;
mmfile_t xd_old_data, xd_new_data;
......@@ -110,9 +110,9 @@ static int diff_update_lines(
static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
{
git_xdiff_info *info = priv;
git_patch_diff *patch = info->patch;
git_patch_generated *patch = info->patch;
const git_diff_delta *delta = patch->base.delta;
git_patch_diff_output *output = &info->xo->output;
git_patch_generated_output *output = &info->xo->output;
git_diff_line line;
if (len == 1) {
......@@ -181,7 +181,7 @@ static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
return output->error;
}
static int git_xdiff(git_patch_diff_output *output, git_patch_diff *patch)
static int git_xdiff(git_patch_generated_output *output, git_patch_generated *patch)
{
git_xdiff_output *xo = (git_xdiff_output *)output;
git_xdiff_info info;
......@@ -194,7 +194,7 @@ static int git_xdiff(git_patch_diff_output *output, git_patch_diff *patch)
xo->callback.priv = &info;
git_diff_find_context_init(
&xo->config.find_func, &findctxt, git_patch_diff_driver(patch));
&xo->config.find_func, &findctxt, git_patch_generated_driver(patch));
xo->config.find_func_priv = &findctxt;
if (xo->config.find_func != NULL)
......@@ -206,8 +206,8 @@ static int git_xdiff(git_patch_diff_output *output, git_patch_diff *patch)
* updates are needed to xo->params.flags
*/
git_patch_diff_old_data(&info.xd_old_data.ptr, &info.xd_old_data.size, patch);
git_patch_diff_new_data(&info.xd_new_data.ptr, &info.xd_new_data.size, patch);
git_patch_generated_old_data(&info.xd_old_data.ptr, &info.xd_old_data.size, patch);
git_patch_generated_new_data(&info.xd_new_data.ptr, &info.xd_new_data.size, patch);
if (info.xd_old_data.size > GIT_XDIFF_MAX_SIZE ||
info.xd_new_data.size > GIT_XDIFF_MAX_SIZE) {
......
......@@ -9,19 +9,19 @@
#include "diff.h"
#include "xdiff/xdiff.h"
#include "patch_diff.h"
#include "patch_generate.h"
/* xdiff cannot cope with large files. these files should not be passed to
* xdiff. callers should treat these large files as binary.
*/
#define GIT_XDIFF_MAX_SIZE (1024LL * 1024 * 1023)
/* A git_xdiff_output is a git_patch_diff_output with extra fields necessary
* to use libxdiff. Calling git_xdiff_init() will set the diff_cb field
* of the output to use xdiff to generate the diffs.
/* A git_xdiff_output is a git_patch_generate_output with extra fields
* necessary to use libxdiff. Calling git_xdiff_init() will set the diff_cb
* field of the output to use xdiff to generate the diffs.
*/
typedef struct {
git_patch_diff_output output;
git_patch_generated_output output;
xdemitconf_t config;
xpparam_t params;
......
......@@ -4,8 +4,8 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_diff_patch_h__
#define INCLUDE_diff_patch_h__
#ifndef INCLUDE_patch_generate_h__
#define INCLUDE_patch_generate_h__
#include "common.h"
#include "diff.h"
......@@ -13,17 +13,17 @@
#include "patch.h"
enum {
GIT_PATCH_DIFF_ALLOCATED = (1 << 0),
GIT_PATCH_DIFF_INITIALIZED = (1 << 1),
GIT_PATCH_DIFF_LOADED = (1 << 2),
GIT_PATCH_GENERATED_ALLOCATED = (1 << 0),
GIT_PATCH_GENERATED_INITIALIZED = (1 << 1),
GIT_PATCH_GENERATED_LOADED = (1 << 2),
/* the two sides are different */
GIT_PATCH_DIFF_DIFFABLE = (1 << 3),
GIT_PATCH_GENERATED_DIFFABLE = (1 << 3),
/* the difference between the two sides has been computed */
GIT_PATCH_DIFF_DIFFED = (1 << 4),
GIT_PATCH_DIFF_FLATTENED = (1 << 5),
GIT_PATCH_GENERATED_DIFFED = (1 << 4),
GIT_PATCH_GENERATED_FLATTENED = (1 << 5),
};
struct git_patch_diff {
struct git_patch_generated {
struct git_patch base;
git_diff *diff; /* for refcount purposes, maybe NULL for blob diffs */
......@@ -34,16 +34,18 @@ struct git_patch_diff {
git_pool flattened;
};
typedef struct git_patch_diff git_patch_diff;
typedef struct git_patch_generated git_patch_generated;
extern git_diff_driver *git_patch_diff_driver(git_patch_diff *);
extern git_diff_driver *git_patch_generated_driver(git_patch_generated *);
extern void git_patch_diff_old_data(char **, size_t *, git_patch_diff *);
extern void git_patch_diff_new_data(char **, size_t *, git_patch_diff *);
extern void git_patch_generated_old_data(
char **, size_t *, git_patch_generated *);
extern void git_patch_generated_new_data(
char **, size_t *, git_patch_generated *);
typedef struct git_patch_diff_output git_patch_diff_output;
typedef struct git_patch_generated_output git_patch_generated_output;
struct git_patch_diff_output {
struct git_patch_generated_output {
/* these callbacks are issued with the diff data */
git_diff_file_cb file_cb;
git_diff_binary_cb binary_cb;
......@@ -57,7 +59,8 @@ struct git_patch_diff_output {
/* this callback is used to do the diff and drive the other callbacks.
* see diff_xdiff.h for how to use this in practice for now.
*/
int (*diff_cb)(git_patch_diff_output *output, git_patch_diff *patch);
int (*diff_cb)(git_patch_generated_output *output,
git_patch_generated *patch);
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment