summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2018-11-12 03:44:31 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-11-13 15:05:02 +0900
commit73d6d7b24b498df98295763dd82c010c15e65db5 (patch)
treeed4ac5249f22a725bc6c3f67f9bc5729883f5ae1 /builtin
parentrebase: consolidate clean-up code before leaving reset_head() (diff)
downloadtgif-73d6d7b24b498df98295763dd82c010c15e65db5.tar.xz
rebase: prepare reset_head() for more flags
Currently, we only accept the flag indicating whether the HEAD should be detached not. In the next commit, we want to introduce another flag: to toggle between emulating `reset --hard` vs `checkout -q`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/rebase.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index e173654d56..074594cf10 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -522,10 +522,13 @@ finished_rebase:
#define GIT_REFLOG_ACTION_ENVIRONMENT "GIT_REFLOG_ACTION"
+#define RESET_HEAD_DETACH (1<<0)
+
static int reset_head(struct object_id *oid, const char *action,
- const char *switch_to_branch, int detach_head,
+ const char *switch_to_branch, unsigned flags,
const char *reflog_orig_head, const char *reflog_head)
{
+ unsigned detach_head = flags & RESET_HEAD_DETACH;
struct object_id head_oid;
struct tree_desc desc;
struct lock_file lock = LOCK_INIT;
@@ -1500,8 +1503,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
"it...\n"));
strbuf_addf(&msg, "rebase: checkout %s", options.onto_name);
- if (reset_head(&options.onto->object.oid, "checkout", NULL, 1,
- NULL, msg.buf))
+ if (reset_head(&options.onto->object.oid, "checkout", NULL,
+ RESET_HEAD_DETACH, NULL, msg.buf))
die(_("Could not detach HEAD"));
strbuf_release(&msg);