]> git.ipfire.org Git - thirdparty/git.git/blob - reset.h
Merge branch 'hs/rebase-not-in-progress' into HEAD
[thirdparty/git.git] / reset.h
1 #ifndef RESET_H
2 #define RESET_H
3
4 #include "hash-ll.h"
5 #include "repository.h"
6
7 #define GIT_REFLOG_ACTION_ENVIRONMENT "GIT_REFLOG_ACTION"
8
9 /* Request a detached checkout */
10 #define RESET_HEAD_DETACH (1<<0)
11 /* Request a reset rather than a checkout */
12 #define RESET_HEAD_HARD (1<<1)
13 /* Run the post-checkout hook */
14 #define RESET_HEAD_RUN_POST_CHECKOUT_HOOK (1<<2)
15 /* Only update refs, do not touch the worktree */
16 #define RESET_HEAD_REFS_ONLY (1<<3)
17 /* Update ORIG_HEAD as well as HEAD */
18 #define RESET_ORIG_HEAD (1<<4)
19
20 struct reset_head_opts {
21 /*
22 * The commit to checkout/reset to. Defaults to HEAD.
23 */
24 const struct object_id *oid;
25 /*
26 * Optional value to set ORIG_HEAD. Defaults to HEAD.
27 */
28 const struct object_id *orig_head;
29 /*
30 * Optional branch to switch to.
31 */
32 const char *branch;
33 /*
34 * Flags defined above.
35 */
36 unsigned flags;
37 /*
38 * Optional reflog message for branch, defaults to head_msg.
39 */
40 const char *branch_msg;
41 /*
42 * Optional reflog message for HEAD, if this omitted but oid or branch
43 * are given then default_reflog_action must be given.
44 */
45 const char *head_msg;
46 /*
47 * Optional reflog message for ORIG_HEAD, if this omitted and flags
48 * contains RESET_ORIG_HEAD then default_reflog_action must be given.
49 */
50 const char *orig_head_msg;
51 /*
52 * Action to use in default reflog messages, only required if a ref is
53 * being updated and the reflog messages above are omitted.
54 */
55 const char *default_reflog_action;
56 };
57
58 int reset_head(struct repository *r, const struct reset_head_opts *opts);
59
60 #endif