builtin/maintenance: fix leaking config string
[git/gitster.git] / reset.h
bloba28f81829d859dc3dfd3817d6449ab7eb195b0d3
1 #ifndef RESET_H
2 #define RESET_H
4 #include "hash.h"
5 #include "repository.h"
7 #define GIT_REFLOG_ACTION_ENVIRONMENT "GIT_REFLOG_ACTION"
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)
20 struct reset_head_opts {
22 * The commit to checkout/reset to. Defaults to HEAD.
24 const struct object_id *oid;
26 * Optional value to set ORIG_HEAD. Defaults to HEAD.
28 const struct object_id *orig_head;
30 * Optional branch to switch to.
32 const char *branch;
34 * Flags defined above.
36 unsigned flags;
38 * Optional reflog message for branch, defaults to head_msg.
40 const char *branch_msg;
42 * Optional reflog message for HEAD, if this omitted but oid or branch
43 * are given then default_reflog_action must be given.
45 const char *head_msg;
47 * Optional reflog message for ORIG_HEAD, if this omitted and flags
48 * contains RESET_ORIG_HEAD then default_reflog_action must be given.
50 const char *orig_head_msg;
52 * Action to use in default reflog messages, only required if a ref is
53 * being updated and the reflog messages above are omitted.
55 const char *default_reflog_action;
58 int reset_head(struct repository *r, const struct reset_head_opts *opts);
60 #endif