cherry-pick --continue: remember options
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 13 Mar 2019 18:26:15 +0000 (18:26 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Mar 2019 07:43:13 +0000 (16:43 +0900)
Remember --allow-empty, --allow-empty-message and
--keep-redundant-commits when cherry-pick stops for a conflict
resolution.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
t/t3507-cherry-pick-conflict.sh
index 4941e48c35877c30a0087eacd8e6d578e2fce1ae..e4941d6e17eaeb02f53c6f77ea5809ae2024eeac 100644 (file)
@@ -2308,6 +2308,15 @@ static int populate_opts_cb(const char *key, const char *value, void *data)
                opts->no_commit = git_config_bool_or_int(key, value, &error_flag);
        else if (!strcmp(key, "options.edit"))
                opts->edit = git_config_bool_or_int(key, value, &error_flag);
+       else if (!strcmp(key, "options.allow-empty"))
+               opts->allow_empty =
+                       git_config_bool_or_int(key, value, &error_flag);
+       else if (!strcmp(key, "options.allow-empty-message"))
+               opts->allow_empty_message =
+                       git_config_bool_or_int(key, value, &error_flag);
+       else if (!strcmp(key, "options.keep-redundant-commits"))
+               opts->keep_redundant_commits =
+                       git_config_bool_or_int(key, value, &error_flag);
        else if (!strcmp(key, "options.signoff"))
                opts->signoff = git_config_bool_or_int(key, value, &error_flag);
        else if (!strcmp(key, "options.record-origin"))
@@ -2706,6 +2715,15 @@ static int save_opts(struct replay_opts *opts)
        if (opts->edit)
                res |= git_config_set_in_file_gently(opts_file,
                                        "options.edit", "true");
+       if (opts->allow_empty)
+               res |= git_config_set_in_file_gently(opts_file,
+                                       "options.allow-empty", "true");
+       if (opts->allow_empty_message)
+               res |= git_config_set_in_file_gently(opts_file,
+                               "options.allow-empty-message", "true");
+       if (opts->keep_redundant_commits)
+               res |= git_config_set_in_file_gently(opts_file,
+                               "options.keep-redundant-commits", "true");
        if (opts->signoff)
                res |= git_config_set_in_file_gently(opts_file,
                                        "options.signoff", "true");
index 79e994cffa8b05ae8a512c2c6b0ffb7b2f87dc49..1ef8e9d534eae78014d9cccebc5f827a3cef91f3 100755 (executable)
@@ -410,7 +410,7 @@ test_expect_success 'cherry-pick preserves sparse-checkout' '
        test_i18ngrep ! "Changes not staged for commit:" actual
 '
 
-test_expect_failure 'cherry-pick --continue remembers --keep-redundant-commits' '
+test_expect_success 'cherry-pick --continue remembers --keep-redundant-commits' '
        test_when_finished "git cherry-pick --abort || :" &&
        pristine_detach initial &&
        test_must_fail git cherry-pick --keep-redundant-commits picked redundant &&
@@ -419,7 +419,7 @@ test_expect_failure 'cherry-pick --continue remembers --keep-redundant-commits'
        git cherry-pick --continue
 '
 
-test_expect_failure 'cherry-pick --continue remembers --allow-empty and --allow-empty-message' '
+test_expect_success 'cherry-pick --continue remembers --allow-empty and --allow-empty-message' '
        test_when_finished "git cherry-pick --abort || :" &&
        pristine_detach initial &&
        test_must_fail git cherry-pick --allow-empty --allow-empty-message \