mirror of
https://github.com/git/git.git
synced 2026-01-18 14:44:28 +00:00
Merge branch 'rebase-r-and-merge-head-v1'
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "wt-status.h"
|
||||
#include "revision.h"
|
||||
#include "rerere.h"
|
||||
#include "branch.h"
|
||||
|
||||
static char const * const builtin_rebase_usage[] = {
|
||||
N_("git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] "
|
||||
@@ -1179,6 +1180,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||
|
||||
if (reset_head(NULL, "reset", NULL, 0, NULL, NULL) < 0)
|
||||
die(_("could not discard worktree changes"));
|
||||
remove_branch_state();
|
||||
if (read_basic_state(&options))
|
||||
exit(1);
|
||||
goto run_rebase;
|
||||
@@ -1196,6 +1198,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||
options.head_name, 0, NULL, NULL) < 0)
|
||||
die(_("could not move back to %s"),
|
||||
oid_to_hex(&options.orig_head));
|
||||
remove_branch_state();
|
||||
ret = finish_rebase(&options);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
10
sequencer.c
10
sequencer.c
@@ -3184,10 +3184,6 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
|
||||
}
|
||||
|
||||
merge_commit = to_merge->item;
|
||||
write_message(oid_to_hex(&merge_commit->object.oid), GIT_SHA1_HEXSZ,
|
||||
git_path_merge_head(the_repository), 0);
|
||||
write_message("no-ff", 5, git_path_merge_mode(the_repository), 0);
|
||||
|
||||
bases = get_merge_bases(head_commit, merge_commit);
|
||||
if (bases && !oidcmp(&merge_commit->object.oid,
|
||||
&bases->item->object.oid)) {
|
||||
@@ -3196,6 +3192,10 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
|
||||
goto leave_merge;
|
||||
}
|
||||
|
||||
write_message(oid_to_hex(&merge_commit->object.oid), GIT_SHA1_HEXSZ,
|
||||
git_path_merge_head(the_repository), 0);
|
||||
write_message("no-ff", 5, git_path_merge_mode(the_repository), 0);
|
||||
|
||||
for (j = bases; j; j = j->next)
|
||||
commit_list_insert(j->item, &reversed);
|
||||
free_commit_list(bases);
|
||||
@@ -3434,6 +3434,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
|
||||
unlink(rebase_path_author_script());
|
||||
unlink(rebase_path_stopped_sha());
|
||||
unlink(rebase_path_amend());
|
||||
unlink(git_path_merge_head(the_repository));
|
||||
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
|
||||
}
|
||||
if (item->command <= TODO_SQUASH) {
|
||||
@@ -3790,6 +3791,7 @@ static int commit_staged_changes(struct replay_opts *opts,
|
||||
opts, flags))
|
||||
return error(_("could not commit staged changes."));
|
||||
unlink(rebase_path_amend());
|
||||
unlink(git_path_merge_head(the_repository));
|
||||
if (final_fixup) {
|
||||
unlink(rebase_path_fixup_msg());
|
||||
unlink(rebase_path_squash_msg());
|
||||
|
||||
@@ -396,4 +396,20 @@ test_expect_success 'with --autosquash and --exec' '
|
||||
grep "G: +G" actual
|
||||
'
|
||||
|
||||
test_expect_success '--continue after resolving conflicts after a merge' '
|
||||
git checkout -b already-has-g E &&
|
||||
git cherry-pick E..G &&
|
||||
test_commit H2 &&
|
||||
|
||||
git checkout -b conflicts-in-merge H &&
|
||||
test_commit H2 H2.t conflicts H2-conflict &&
|
||||
test_must_fail git rebase -r already-has-g &&
|
||||
grep conflicts H2.t &&
|
||||
echo resolved >H2.t &&
|
||||
git add -u &&
|
||||
git rebase --continue &&
|
||||
test_must_fail git rev-parse --verify HEAD^2 &&
|
||||
test_path_is_missing .git/MERGE_HEAD
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -1553,6 +1553,7 @@ void wt_status_get_state(struct wt_status_state *state,
|
||||
struct object_id oid;
|
||||
|
||||
if (!stat(git_path_merge_head(the_repository), &st)) {
|
||||
wt_status_check_rebase(NULL, state);
|
||||
state->merge_in_progress = 1;
|
||||
} else if (wt_status_check_rebase(NULL, state)) {
|
||||
; /* all set */
|
||||
@@ -1576,9 +1577,13 @@ static void wt_longstatus_print_state(struct wt_status *s,
|
||||
struct wt_status_state *state)
|
||||
{
|
||||
const char *state_color = color(WT_STATUS_HEADER, s);
|
||||
if (state->merge_in_progress)
|
||||
if (state->merge_in_progress) {
|
||||
if (state->rebase_interactive_in_progress) {
|
||||
show_rebase_information(s, state, state_color);
|
||||
fputs("\n", s->fp);
|
||||
}
|
||||
show_merge_in_progress(s, state, state_color);
|
||||
else if (state->am_in_progress)
|
||||
} else if (state->am_in_progress)
|
||||
show_am_in_progress(s, state, state_color);
|
||||
else if (state->rebase_in_progress || state->rebase_interactive_in_progress)
|
||||
show_rebase_in_progress(s, state, state_color);
|
||||
|
||||
Reference in New Issue
Block a user