Blame src/patch_generate.h

Packit Service 20376f
/*
Packit Service 20376f
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit Service 20376f
 *
Packit Service 20376f
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit Service 20376f
 * a Linking Exception. For full terms see the included COPYING file.
Packit Service 20376f
 */
Packit Service 20376f
#ifndef INCLUDE_patch_generate_h__
Packit Service 20376f
#define INCLUDE_patch_generate_h__
Packit Service 20376f
Packit Service 20376f
#include "common.h"
Packit Service 20376f
#include "diff.h"
Packit Service 20376f
#include "diff_file.h"
Packit Service 20376f
#include "patch.h"
Packit Service 20376f
Packit Service 20376f
enum {
Packit Service 20376f
	GIT_PATCH_GENERATED_ALLOCATED = (1 << 0),
Packit Service 20376f
	GIT_PATCH_GENERATED_INITIALIZED = (1 << 1),
Packit Service 20376f
	GIT_PATCH_GENERATED_LOADED = (1 << 2),
Packit Service 20376f
	/* the two sides are different */
Packit Service 20376f
	GIT_PATCH_GENERATED_DIFFABLE = (1 << 3),
Packit Service 20376f
	/* the difference between the two sides has been computed */
Packit Service 20376f
	GIT_PATCH_GENERATED_DIFFED = (1 << 4),
Packit Service 20376f
	GIT_PATCH_GENERATED_FLATTENED = (1 << 5),
Packit Service 20376f
};
Packit Service 20376f
Packit Service 20376f
struct git_patch_generated {
Packit Service 20376f
	struct git_patch base;
Packit Service 20376f
Packit Service 20376f
	git_diff *diff; /* for refcount purposes, maybe NULL for blob diffs */
Packit Service 20376f
	size_t delta_index;
Packit Service 20376f
	git_diff_file_content ofile;
Packit Service 20376f
	git_diff_file_content nfile;
Packit Service 20376f
	uint32_t flags;
Packit Service 20376f
	git_pool flattened;
Packit Service 20376f
};
Packit Service 20376f
Packit Service 20376f
typedef struct git_patch_generated git_patch_generated;
Packit Service 20376f
Packit Service 20376f
extern git_diff_driver *git_patch_generated_driver(git_patch_generated *);
Packit Service 20376f
Packit Service 20376f
extern void git_patch_generated_old_data(
Packit Service 20376f
	char **, size_t *, git_patch_generated *);
Packit Service 20376f
extern void git_patch_generated_new_data(
Packit Service 20376f
	char **, size_t *, git_patch_generated *);
Packit Service 20376f
extern int git_patch_generated_from_diff(
Packit Service 20376f
	git_patch **, git_diff *, size_t);
Packit Service 20376f
Packit Service 20376f
typedef struct git_patch_generated_output git_patch_generated_output;
Packit Service 20376f
Packit Service 20376f
struct git_patch_generated_output {
Packit Service 20376f
	/* these callbacks are issued with the diff data */
Packit Service 20376f
	git_diff_file_cb file_cb;
Packit Service 20376f
	git_diff_binary_cb binary_cb;
Packit Service 20376f
	git_diff_hunk_cb hunk_cb;
Packit Service 20376f
	git_diff_line_cb data_cb;
Packit Service 20376f
	void *payload;
Packit Service 20376f
Packit Service 20376f
	/* this records the actual error in cases where it may be obscured */
Packit Service 20376f
	int error;
Packit Service 20376f
Packit Service 20376f
	/* this callback is used to do the diff and drive the other callbacks.
Packit Service 20376f
	 * see diff_xdiff.h for how to use this in practice for now.
Packit Service 20376f
	 */
Packit Service 20376f
	int (*diff_cb)(git_patch_generated_output *output,
Packit Service 20376f
		git_patch_generated *patch);
Packit Service 20376f
};
Packit Service 20376f
Packit Service 20376f
#endif