]> git.ipfire.org Git - thirdparty/git.git/blame - reset.h
Start the 2.46 cycle
[thirdparty/git.git] / reset.h
CommitLineData
b309a971
DL
1#ifndef RESET_H
2#define RESET_H
3
d1cbe1e6 4#include "hash-ll.h"
b309a971
DL
5#include "repository.h"
6
7#define GIT_REFLOG_ACTION_ENVIRONMENT "GIT_REFLOG_ACTION"
8
6ae80861 9/* Request a detached checkout */
b309a971 10#define RESET_HEAD_DETACH (1<<0)
6ae80861 11/* Request a reset rather than a checkout */
b309a971 12#define RESET_HEAD_HARD (1<<1)
6ae80861 13/* Run the post-checkout hook */
b309a971 14#define RESET_HEAD_RUN_POST_CHECKOUT_HOOK (1<<2)
6ae80861 15/* Only update refs, do not touch the worktree */
b309a971 16#define RESET_HEAD_REFS_ONLY (1<<3)
6ae80861 17/* Update ORIG_HEAD as well as HEAD */
b309a971
DL
18#define RESET_ORIG_HEAD (1<<4)
19
6ae80861
PW
20struct reset_head_opts {
21 /*
22 * The commit to checkout/reset to. Defaults to HEAD.
23 */
24 const struct object_id *oid;
cd1528ef
PW
25 /*
26 * Optional value to set ORIG_HEAD. Defaults to HEAD.
27 */
28 const struct object_id *orig_head;
6ae80861
PW
29 /*
30 * Optional branch to switch to.
31 */
32 const char *branch;
33 /*
34 * Flags defined above.
35 */
36 unsigned flags;
7700ab08
PW
37 /*
38 * Optional reflog message for branch, defaults to head_msg.
39 */
40 const char *branch_msg;
6ae80861
PW
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
58int reset_head(struct repository *r, const struct reset_head_opts *opts);
b309a971
DL
59
60#endif