|
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_parse_h__
|
|
Packit Service |
20376f |
#define INCLUDE_patch_parse_h__
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
typedef struct {
|
|
Packit Service |
20376f |
git_refcount rc;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
/* Original content buffer */
|
|
Packit Service |
20376f |
const char *content;
|
|
Packit Service |
20376f |
size_t content_len;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
git_patch_options opts;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
/* The remaining (unparsed) buffer */
|
|
Packit Service |
20376f |
const char *remain;
|
|
Packit Service |
20376f |
size_t remain_len;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
const char *line;
|
|
Packit Service |
20376f |
size_t line_len;
|
|
Packit Service |
20376f |
size_t line_num;
|
|
Packit Service |
20376f |
} git_patch_parse_ctx;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
extern git_patch_parse_ctx *git_patch_parse_ctx_init(
|
|
Packit Service |
20376f |
const char *content,
|
|
Packit Service |
20376f |
size_t content_len,
|
|
Packit Service |
20376f |
const git_patch_options *opts);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
extern void git_patch_parse_ctx_free(git_patch_parse_ctx *ctx);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
/**
|
|
Packit Service |
20376f |
* Create a patch for a single file from the contents of a patch buffer.
|
|
Packit Service |
20376f |
*
|
|
Packit Service |
20376f |
* @param out The patch to be created
|
|
Packit Service |
20376f |
* @param contents The contents of a patch file
|
|
Packit Service |
20376f |
* @param contents_len The length of the patch file
|
|
Packit Service |
20376f |
* @param opts The git_patch_options
|
|
Packit Service |
20376f |
* @return 0 on success, <0 on failure.
|
|
Packit Service |
20376f |
*/
|
|
Packit Service |
20376f |
extern int git_patch_from_buffer(
|
|
Packit Service |
20376f |
git_patch **out,
|
|
Packit Service |
20376f |
const char *contents,
|
|
Packit Service |
20376f |
size_t contents_len,
|
|
Packit Service |
20376f |
const git_patch_options *opts);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
extern int git_patch_parse(
|
|
Packit Service |
20376f |
git_patch **out,
|
|
Packit Service |
20376f |
git_patch_parse_ctx *ctx);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
extern int git_patch_parsed_from_diff(git_patch **, git_diff *, size_t);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
#endif
|