]> git.proxmox.com Git - libgit2.git/blame - src/patch_parse.h
Upload to experimental
[libgit2.git] / src / patch_parse.h
CommitLineData
17572f67
ET
1/*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7#ifndef INCLUDE_patch_parse_h__
8#define INCLUDE_patch_parse_h__
9
eae0bfdc
PP
10#include "common.h"
11
12#include "parse.h"
13#include "patch.h"
14
7166bb16
ET
15typedef struct {
16 git_refcount rc;
17
7166bb16
ET
18 git_patch_options opts;
19
eae0bfdc 20 git_parse_ctx parse_ctx;
7166bb16
ET
21} git_patch_parse_ctx;
22
23extern git_patch_parse_ctx *git_patch_parse_ctx_init(
24 const char *content,
25 size_t content_len,
26 const git_patch_options *opts);
27
28extern void git_patch_parse_ctx_free(git_patch_parse_ctx *ctx);
29
17572f67
ET
30/**
31 * Create a patch for a single file from the contents of a patch buffer.
32 *
33 * @param out The patch to be created
34 * @param contents The contents of a patch file
35 * @param contents_len The length of the patch file
36 * @param opts The git_patch_options
37 * @return 0 on success, <0 on failure.
38 */
39extern int git_patch_from_buffer(
40 git_patch **out,
41 const char *contents,
42 size_t contents_len,
43 const git_patch_options *opts);
44
7166bb16
ET
45extern int git_patch_parse(
46 git_patch **out,
47 git_patch_parse_ctx *ctx);
48
b859faa6
ET
49extern int git_patch_parsed_from_diff(git_patch **, git_diff *, size_t);
50
17572f67 51#endif