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 module libgit2_d.reset;
8 
9 
10 private static import libgit2_d.checkout;
11 private static import libgit2_d.strarray;
12 private static import libgit2_d.types;
13 
14 /**
15  * @file git2/reset.h
16  * @brief Git reset management routines
17  * @ingroup Git
18  * @{
19  */
20 extern (C):
21 nothrow @nogc:
22 public:
23 
24 /**
25  * Kinds of reset operation
26  */
27 enum git_reset_t
28 {
29 	/**
30 	 * Move the head to the given commit
31 	 */
32 	GIT_RESET_SOFT = 1,
33 
34 	/**
35 	 * SOFT plus reset index to the commit
36 	 */
37 	GIT_RESET_MIXED = 2,
38 
39 	/**
40 	 * MIXED plus changes in working tree discarded
41 	 */
42 	GIT_RESET_HARD = 3,
43 }
44 
45 /**
46  * Sets the current head to the specified commit oid and optionally
47  * resets the index and working tree to match.
48  *
49  * SOFT reset means the Head will be moved to the commit.
50  *
51  * MIXED reset will trigger a SOFT reset, plus the index will be replaced
52  * with the content of the commit tree.
53  *
54  * HARD reset will trigger a MIXED reset and the working directory will be
55  * replaced with the content of the index.  (Untracked and ignored files
56  * will be left alone, however.)
57  *
58  * TODO: Implement remaining kinds of resets.
59  *
60  * @param repo Repository where to perform the reset operation.
61  *
62  * @param target Committish to which the Head should be moved to. This object
63  * must belong to the given `repo` and can either be a git_commit or a
64  * git_tag. When a git_tag is being passed, it should be dereferencable
65  * to a git_commit which oid will be used as the target of the branch.
66  *
67  * @param reset_type Kind of reset operation to perform.
68  *
69  * @param checkout_opts Optional checkout options to be used for a HARD reset.
70  * The checkout_strategy field will be overridden (based on reset_type).
71  * This parameter can be used to propagate notify and progress callbacks.
72  *
73  * @return 0 on success or an error code
74  */
75 //GIT_EXTERN
76 int git_reset(libgit2_d.types.git_repository* repo, const (libgit2_d.types.git_object)* target, .git_reset_t reset_type, const (libgit2_d.checkout.git_checkout_options)* checkout_opts);
77 
78 /**
79  * Sets the current head to the specified commit oid and optionally
80  * resets the index and working tree to match.
81  *
82  * This behaves like `git_reset()` but takes an annotated commit,
83  * which lets you specify which extended sha syntax string was
84  * specified by a user, allowing for more exact reflog messages.
85  *
86  * See the documentation for `git_reset()`.
87  *
88  * @see git_reset
89  */
90 //GIT_EXTERN
91 int git_reset_from_annotated(libgit2_d.types.git_repository* repo, const (libgit2_d.types.git_annotated_commit)* commit, .git_reset_t reset_type, const (libgit2_d.checkout.git_checkout_options)* checkout_opts);
92 
93 /**
94  * Updates some entries in the index from the target commit tree.
95  *
96  * The scope of the updated entries is determined by the paths
97  * being passed in the `pathspec` parameters.
98  *
99  * Passing a null `target` will result in removing
100  * entries in the index matching the provided pathspecs.
101  *
102  * @param repo Repository where to perform the reset operation.
103  *
104  * @param target The committish which content will be used to reset the content
105  * of the index.
106  *
107  * @param pathspecs List of pathspecs to operate on.
108  *
109  * @return 0 on success or an error code < 0
110  */
111 //GIT_EXTERN
112 int git_reset_default(libgit2_d.types.git_repository* repo, const (libgit2_d.types.git_object)* target, const (libgit2_d.strarray.git_strarray)* pathspecs);
113 
114 /** @} */