git/apply.h

#ifndef APPLY_H
#define APPLY_H

#include "hash.h"
#include "lockfile.h"
#include "string-list.h"
#include "strmap.h"

struct repository;

enum apply_ws_error_action {};

enum apply_ws_ignore {};

enum apply_verbosity {};

struct apply_state {};

/*
 * This represents a "patch" to a file, both metainfo changes
 * such as creation/deletion, filemode and content changes represented
 * as a series of fragments.
 */
struct patch {};

int apply_parse_options(int argc, const char **argv,
			struct apply_state *state,
			int *force_apply, int *options,
			const char * const *apply_usage);
int init_apply_state(struct apply_state *state,
		     struct repository *repo,
		     const char *prefix);
void clear_apply_state(struct apply_state *state);
int check_apply_state(struct apply_state *state, int force_apply);

/*
 * Parse a git diff header, starting at line.  Fills the relevant
 * metadata information in 'struct patch'.
 *
 * Returns -1 on failure, the length of the parsed header otherwise.
 */
int parse_git_diff_header(struct strbuf *root,
			  int *linenr,
			  int p_value,
			  const char *line,
			  int len,
			  unsigned int size,
			  struct patch *patch);

void release_patch(struct patch *patch);

/*
 * Some aspects of the apply behavior are controlled by the following
 * bits in the "options" parameter passed to apply_all_patches().
 */
#define APPLY_OPT_INACCURATE_EOF
#define APPLY_OPT_RECOUNT

int apply_all_patches(struct apply_state *state,
		      int argc, const char **argv,
		      int options);

#endif