diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2018-01-28 23:25:07 +0000 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2018-11-03 16:44:26 +0000 |
| commit | 02b1083ab779e4d8d2279dea1a4ae38ec1d2e47b (patch) | |
| tree | 66998d89fe22cf2609b296ceca742f6d47bdeae4 /include | |
| parent | 2b12dcf6d6971a622abe9730472dc373c0856d98 (diff) | |
| download | libgit2-02b1083ab779e4d8d2279dea1a4ae38ec1d2e47b.tar.gz | |
apply: introduce `git_apply_tree`
Introduce `git_apply_tree`, which will apply a `git_diff` to a given
`git_tree`, allowing an in-memory patch application for a repository.
Diffstat (limited to 'include')
| -rw-r--r-- | include/git2.h | 1 | ||||
| -rw-r--r-- | include/git2/apply.h | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/include/git2.h b/include/git2.h index e182ce924..9239b48c8 100644 --- a/include/git2.h +++ b/include/git2.h @@ -9,6 +9,7 @@ #define INCLUDE_git_git_h__ #include "git2/annotated_commit.h" +#include "git2/apply.h" #include "git2/attr.h" #include "git2/blob.h" #include "git2/blame.h" diff --git a/include/git2/apply.h b/include/git2/apply.h new file mode 100644 index 000000000..a4ec4fc08 --- /dev/null +++ b/include/git2/apply.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_git_apply_h__ +#define INCLUDE_git_apply_h__ + +#include "common.h" +#include "types.h" +#include "oid.h" +#include "diff.h" + +/** + * @file git2/apply.h + * @brief Git patch application routines + * @defgroup git_apply Git patch application routines + * @ingroup Git + * @{ + */ +GIT_BEGIN_DECL + +/** + * Apply a `git_diff` to a `git_tree`, and return the resulting image + * as an index. + * + * @param out the postimage of the application + * @param repo the repository to apply + * @param preimage the tree to apply the diff to + * @param diff the diff to apply + */ +GIT_EXTERN(int) git_apply_to_tree( + git_index **out, + git_repository *repo, + git_tree *preimage, + git_diff *diff); + +/** @} */ +GIT_END_DECL +#endif |
