Blame src/patch_parse.h

Packit ae9e2a
/*
Packit ae9e2a
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit ae9e2a
 *
Packit ae9e2a
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit ae9e2a
 * a Linking Exception. For full terms see the included COPYING file.
Packit ae9e2a
 */
Packit ae9e2a
#ifndef INCLUDE_patch_parse_h__
Packit ae9e2a
#define INCLUDE_patch_parse_h__
Packit ae9e2a
Packit ae9e2a
typedef struct {
Packit ae9e2a
	git_refcount rc;
Packit ae9e2a
Packit ae9e2a
	/* Original content buffer */
Packit ae9e2a
	const char *content;
Packit ae9e2a
	size_t content_len;
Packit ae9e2a
Packit ae9e2a
	git_patch_options opts;
Packit ae9e2a
Packit ae9e2a
	/* The remaining (unparsed) buffer */
Packit ae9e2a
	const char *remain;
Packit ae9e2a
	size_t remain_len;
Packit ae9e2a
Packit ae9e2a
	const char *line;
Packit ae9e2a
	size_t line_len;
Packit ae9e2a
	size_t line_num;
Packit ae9e2a
} git_patch_parse_ctx;
Packit ae9e2a
Packit ae9e2a
extern git_patch_parse_ctx *git_patch_parse_ctx_init(
Packit ae9e2a
	const char *content,
Packit ae9e2a
	size_t content_len,
Packit ae9e2a
	const git_patch_options *opts);
Packit ae9e2a
Packit ae9e2a
extern void git_patch_parse_ctx_free(git_patch_parse_ctx *ctx);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Create a patch for a single file from the contents of a patch buffer.
Packit ae9e2a
 *
Packit ae9e2a
 * @param out The patch to be created
Packit ae9e2a
 * @param contents The contents of a patch file
Packit ae9e2a
 * @param contents_len The length of the patch file
Packit ae9e2a
 * @param opts The git_patch_options
Packit ae9e2a
 * @return 0 on success, <0 on failure.
Packit ae9e2a
 */
Packit ae9e2a
extern int git_patch_from_buffer(
Packit ae9e2a
	git_patch **out,
Packit ae9e2a
	const char *contents,
Packit ae9e2a
	size_t contents_len,
Packit ae9e2a
	const git_patch_options *opts);
Packit ae9e2a
Packit ae9e2a
extern int git_patch_parse(
Packit ae9e2a
	git_patch **out,
Packit ae9e2a
	git_patch_parse_ctx *ctx);
Packit ae9e2a
Packit ae9e2a
extern int git_patch_parsed_from_diff(git_patch **, git_diff *, size_t);
Packit ae9e2a
Packit ae9e2a
#endif