From 937d1436302582c4e769594a805978d03e89ad59 Mon Sep 17 00:00:00 2001 From: Jiang Xin Date: Wed, 11 Mar 2020 14:55:27 +0800 Subject: i18n: unmark a message in rebase.c Commit v2.25.0-4-ge98c4269c8 (rebase (interactive-backend): fix handling of commits that become empty, 2020-02-15) marked "{drop,keep,ask}" for translation, but this message should not be changed. Signed-off-by: Jiang Xin Signed-off-by: Junio C Hamano diff --git a/builtin/rebase.c b/builtin/rebase.c index f3036f4..2bd1178 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1551,7 +1551,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) "ignoring them"), REBASE_PRESERVE_MERGES, PARSE_OPT_HIDDEN), OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate), - OPT_CALLBACK_F(0, "empty", &options, N_("{drop,keep,ask}"), + OPT_CALLBACK_F(0, "empty", &options, "{drop,keep,ask}", N_("how to handle commits that become empty"), PARSE_OPT_NONEG, parse_opt_empty), { OPTION_CALLBACK, 'k', "keep-empty", &options, NULL, -- cgit v0.10.2-6-g49f6 From 9a1b7474d6babad5fabed9a2926a57d875f3820b Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Wed, 11 Mar 2020 15:30:22 +0000 Subject: sequencer: clear state upon dropping a become-empty commit In commit e98c4269c8 ("rebase (interactive-backend): fix handling of commits that become empty", 2020-02-15), the merge backend was changed to drop commits that did not start empty but became so after being applied (because their changes were a subset of what was already upstream). This new code path did not need to go through the process of creating a commit, since we were dropping the commit instead. Unfortunately, this also means we bypassed the clearing of the CHERRY_PICK_HEAD and MERGE_MSG files, which if there were no further commits to cherry-pick would mean that the rebase would end but assume there was still an operation in progress. Ensure that we clear such state files when we decide to drop the commit. Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano diff --git a/sequencer.c b/sequencer.c index f8e242b..df89ff4 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1955,6 +1955,8 @@ static int do_pick_commit(struct repository *r, flags |= ALLOW_EMPTY; } else if (allow == 2) { drop_commit = 1; + unlink(git_path_cherry_pick_head(r)); + unlink(git_path_merge_msg(r)); fprintf(stderr, _("dropping %s %s -- patch contents already upstream\n"), oid_to_hex(&commit->object.oid), msg.subject); diff --git a/t/t3424-rebase-empty.sh b/t/t3424-rebase-empty.sh index 98fc2a5..e1e3051 100755 --- a/t/t3424-rebase-empty.sh +++ b/t/t3424-rebase-empty.sh @@ -123,4 +123,12 @@ test_expect_success 'rebase --interactive uses default of --empty=ask' ' test_cmp expect actual ' +test_expect_success 'rebase --merge does not leave state laying around' ' + git checkout -B testing localmods~2 && + git rebase --merge upstream && + + test_path_is_missing .git/CHERRY_PICK_HEAD && + test_path_is_missing .git/MERGE_MSG +' + test_done -- cgit v0.10.2-6-g49f6 From 120b1eb7314687375e0a229e102ffd194cae0e06 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Wed, 11 Mar 2020 15:30:23 +0000 Subject: git-rebase.txt: highlight backend differences with commit rewording As noted by Junio: Back when "git am" was written, it was not considered a bug that the "git am --resolved" option did not offer the user a chance to update the log message to match the adjustment of the code the user made, but honestly, I'd have to say that it is a bug in "git am" in that over time it wasn't adjusted to the new world order where we encourage users to describe what they did when the automation hiccuped by opening an editor. These days, even when automation worked well (e.g. a clean auto-merge with "git merge"), we open an editor. The world has changed, and so should the expectations. Junio also suggested providing a workaround such as allowing --no-edit together with git rebase --continue, but that should probably be done in a patch after the git-2.26.0 release. For now, just document the known difference in the Behavioral Differences section. Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 8c1f4b8..f7a6033 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -699,6 +699,16 @@ suffer from the same shortcoming. (See https://lore.kernel.org/git/20200207132152.GC2868@szeder.dev/ for details.) +Commit Rewording +~~~~~~~~~~~~~~~~ + +When a conflict occurs while rebasing, rebase stops and asks the user +to resolve. Since the user may need to make notable changes while +resolving conflicts, after conflicts are resolved and the user has run +`git rebase --continue`, the rebase should open an editor and ask the +user to update the commit message. The merge backend does this, while +the apply backend blindly applies the original commit message. + Miscellaneous differences ~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v0.10.2-6-g49f6