|
||||
File indexing completed on 2025-01-18 09:59:38
0001 /* 0002 * Copyright (C) the libgit2 contributors. All rights reserved. 0003 * 0004 * This file is part of libgit2, distributed under the GNU GPL v2 with 0005 * a Linking Exception. For full terms see the included COPYING file. 0006 */ 0007 #ifndef INCLUDE_git_revert_h__ 0008 #define INCLUDE_git_revert_h__ 0009 0010 #include "common.h" 0011 #include "types.h" 0012 #include "merge.h" 0013 0014 /** 0015 * @file git2/revert.h 0016 * @brief Git revert routines 0017 * @defgroup git_revert Git revert routines 0018 * @ingroup Git 0019 * @{ 0020 */ 0021 GIT_BEGIN_DECL 0022 0023 /** 0024 * Options for revert 0025 */ 0026 typedef struct { 0027 unsigned int version; 0028 0029 /** For merge commits, the "mainline" is treated as the parent. */ 0030 unsigned int mainline; 0031 0032 git_merge_options merge_opts; /**< Options for the merging */ 0033 git_checkout_options checkout_opts; /**< Options for the checkout */ 0034 } git_revert_options; 0035 0036 #define GIT_REVERT_OPTIONS_VERSION 1 0037 #define GIT_REVERT_OPTIONS_INIT {GIT_REVERT_OPTIONS_VERSION, 0, GIT_MERGE_OPTIONS_INIT, GIT_CHECKOUT_OPTIONS_INIT} 0038 0039 /** 0040 * Initialize git_revert_options structure 0041 * 0042 * Initializes a `git_revert_options` with default values. Equivalent to 0043 * creating an instance with `GIT_REVERT_OPTIONS_INIT`. 0044 * 0045 * @param opts The `git_revert_options` struct to initialize. 0046 * @param version The struct version; pass `GIT_REVERT_OPTIONS_VERSION`. 0047 * @return Zero on success; -1 on failure. 0048 */ 0049 GIT_EXTERN(int) git_revert_options_init( 0050 git_revert_options *opts, 0051 unsigned int version); 0052 0053 /** 0054 * Reverts the given commit against the given "our" commit, producing an 0055 * index that reflects the result of the revert. 0056 * 0057 * The returned index must be freed explicitly with `git_index_free`. 0058 * 0059 * @param out pointer to store the index result in 0060 * @param repo the repository that contains the given commits 0061 * @param revert_commit the commit to revert 0062 * @param our_commit the commit to revert against (eg, HEAD) 0063 * @param mainline the parent of the revert commit, if it is a merge 0064 * @param merge_options the merge options (or null for defaults) 0065 * @return zero on success, -1 on failure. 0066 */ 0067 GIT_EXTERN(int) git_revert_commit( 0068 git_index **out, 0069 git_repository *repo, 0070 git_commit *revert_commit, 0071 git_commit *our_commit, 0072 unsigned int mainline, 0073 const git_merge_options *merge_options); 0074 0075 /** 0076 * Reverts the given commit, producing changes in the index and working directory. 0077 * 0078 * @param repo the repository to revert 0079 * @param commit the commit to revert 0080 * @param given_opts the revert options (or null for defaults) 0081 * @return zero on success, -1 on failure. 0082 */ 0083 GIT_EXTERN(int) git_revert( 0084 git_repository *repo, 0085 git_commit *commit, 0086 const git_revert_options *given_opts); 0087 0088 /** @} */ 0089 GIT_END_DECL 0090 #endif 0091
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |