2020-04-07 14:28:00 +00:00
|
|
|
#ifndef RESET_H
|
|
|
|
#define RESET_H
|
|
|
|
|
|
|
|
#include "hash.h"
|
|
|
|
#include "repository.h"
|
|
|
|
|
|
|
|
#define GIT_REFLOG_ACTION_ENVIRONMENT "GIT_REFLOG_ACTION"
|
|
|
|
|
2022-01-26 13:05:46 +00:00
|
|
|
/* Request a detached checkout */
|
2020-04-07 14:28:00 +00:00
|
|
|
#define RESET_HEAD_DETACH (1<<0)
|
2022-01-26 13:05:46 +00:00
|
|
|
/* Request a reset rather than a checkout */
|
2020-04-07 14:28:00 +00:00
|
|
|
#define RESET_HEAD_HARD (1<<1)
|
2022-01-26 13:05:46 +00:00
|
|
|
/* Run the post-checkout hook */
|
2020-04-07 14:28:00 +00:00
|
|
|
#define RESET_HEAD_RUN_POST_CHECKOUT_HOOK (1<<2)
|
2022-01-26 13:05:46 +00:00
|
|
|
/* Only update refs, do not touch the worktree */
|
2020-04-07 14:28:00 +00:00
|
|
|
#define RESET_HEAD_REFS_ONLY (1<<3)
|
2022-01-26 13:05:46 +00:00
|
|
|
/* Update ORIG_HEAD as well as HEAD */
|
2020-04-07 14:28:00 +00:00
|
|
|
#define RESET_ORIG_HEAD (1<<4)
|
|
|
|
|
2022-01-26 13:05:46 +00:00
|
|
|
struct reset_head_opts {
|
|
|
|
/*
|
|
|
|
* The commit to checkout/reset to. Defaults to HEAD.
|
|
|
|
*/
|
|
|
|
const struct object_id *oid;
|
2022-01-26 13:05:48 +00:00
|
|
|
/*
|
|
|
|
* Optional value to set ORIG_HEAD. Defaults to HEAD.
|
|
|
|
*/
|
|
|
|
const struct object_id *orig_head;
|
2022-01-26 13:05:46 +00:00
|
|
|
/*
|
|
|
|
* Optional branch to switch to.
|
|
|
|
*/
|
|
|
|
const char *branch;
|
|
|
|
/*
|
|
|
|
* Flags defined above.
|
|
|
|
*/
|
|
|
|
unsigned flags;
|
2022-01-26 13:05:47 +00:00
|
|
|
/*
|
|
|
|
* Optional reflog message for branch, defaults to head_msg.
|
|
|
|
*/
|
|
|
|
const char *branch_msg;
|
2022-01-26 13:05:46 +00:00
|
|
|
/*
|
|
|
|
* Optional reflog message for HEAD, if this omitted but oid or branch
|
|
|
|
* are given then default_reflog_action must be given.
|
|
|
|
*/
|
|
|
|
const char *head_msg;
|
|
|
|
/*
|
|
|
|
* Optional reflog message for ORIG_HEAD, if this omitted and flags
|
|
|
|
* contains RESET_ORIG_HEAD then default_reflog_action must be given.
|
|
|
|
*/
|
|
|
|
const char *orig_head_msg;
|
|
|
|
/*
|
|
|
|
* Action to use in default reflog messages, only required if a ref is
|
|
|
|
* being updated and the reflog messages above are omitted.
|
|
|
|
*/
|
|
|
|
const char *default_reflog_action;
|
|
|
|
};
|
|
|
|
|
|
|
|
int reset_head(struct repository *r, const struct reset_head_opts *opts);
|
2020-04-07 14:28:00 +00:00
|
|
|
|
|
|
|
#endif
|