Merge branch 'pw/cherry-pick-continue'
"git cherry-pick --options A..B", after giving control back to the user to ask help resolving a conflicted step, did not honor the options it originally received, which has been corrected. * pw/cherry-pick-continue: cherry-pick --continue: remember options cherry-pick: demonstrate option amnesia sequencer: break some long lines
This commit is contained in:
commit
d2dba18ced
53
sequencer.c
53
sequencer.c
@ -2275,6 +2275,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);
|
opts->no_commit = git_config_bool_or_int(key, value, &error_flag);
|
||||||
else if (!strcmp(key, "options.edit"))
|
else if (!strcmp(key, "options.edit"))
|
||||||
opts->edit = git_config_bool_or_int(key, value, &error_flag);
|
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"))
|
else if (!strcmp(key, "options.signoff"))
|
||||||
opts->signoff = git_config_bool_or_int(key, value, &error_flag);
|
opts->signoff = git_config_bool_or_int(key, value, &error_flag);
|
||||||
else if (!strcmp(key, "options.record-origin"))
|
else if (!strcmp(key, "options.record-origin"))
|
||||||
@ -2668,36 +2677,54 @@ static int save_opts(struct replay_opts *opts)
|
|||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
if (opts->no_commit)
|
if (opts->no_commit)
|
||||||
res |= git_config_set_in_file_gently(opts_file, "options.no-commit", "true");
|
res |= git_config_set_in_file_gently(opts_file,
|
||||||
|
"options.no-commit", "true");
|
||||||
if (opts->edit)
|
if (opts->edit)
|
||||||
res |= git_config_set_in_file_gently(opts_file, "options.edit", "true");
|
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)
|
if (opts->signoff)
|
||||||
res |= git_config_set_in_file_gently(opts_file, "options.signoff", "true");
|
res |= git_config_set_in_file_gently(opts_file,
|
||||||
|
"options.signoff", "true");
|
||||||
if (opts->record_origin)
|
if (opts->record_origin)
|
||||||
res |= git_config_set_in_file_gently(opts_file, "options.record-origin", "true");
|
res |= git_config_set_in_file_gently(opts_file,
|
||||||
|
"options.record-origin", "true");
|
||||||
if (opts->allow_ff)
|
if (opts->allow_ff)
|
||||||
res |= git_config_set_in_file_gently(opts_file, "options.allow-ff", "true");
|
res |= git_config_set_in_file_gently(opts_file,
|
||||||
|
"options.allow-ff", "true");
|
||||||
if (opts->mainline) {
|
if (opts->mainline) {
|
||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
strbuf_addf(&buf, "%d", opts->mainline);
|
strbuf_addf(&buf, "%d", opts->mainline);
|
||||||
res |= git_config_set_in_file_gently(opts_file, "options.mainline", buf.buf);
|
res |= git_config_set_in_file_gently(opts_file,
|
||||||
|
"options.mainline", buf.buf);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
}
|
}
|
||||||
if (opts->strategy)
|
if (opts->strategy)
|
||||||
res |= git_config_set_in_file_gently(opts_file, "options.strategy", opts->strategy);
|
res |= git_config_set_in_file_gently(opts_file,
|
||||||
|
"options.strategy", opts->strategy);
|
||||||
if (opts->gpg_sign)
|
if (opts->gpg_sign)
|
||||||
res |= git_config_set_in_file_gently(opts_file, "options.gpg-sign", opts->gpg_sign);
|
res |= git_config_set_in_file_gently(opts_file,
|
||||||
|
"options.gpg-sign", opts->gpg_sign);
|
||||||
if (opts->xopts) {
|
if (opts->xopts) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < opts->xopts_nr; i++)
|
for (i = 0; i < opts->xopts_nr; i++)
|
||||||
res |= git_config_set_multivar_in_file_gently(opts_file,
|
res |= git_config_set_multivar_in_file_gently(opts_file,
|
||||||
"options.strategy-option",
|
"options.strategy-option",
|
||||||
opts->xopts[i], "^$", 0);
|
opts->xopts[i], "^$", 0);
|
||||||
}
|
}
|
||||||
if (opts->allow_rerere_auto)
|
if (opts->allow_rerere_auto)
|
||||||
res |= git_config_set_in_file_gently(opts_file, "options.allow-rerere-auto",
|
res |= git_config_set_in_file_gently(opts_file,
|
||||||
opts->allow_rerere_auto == RERERE_AUTOUPDATE ?
|
"options.allow-rerere-auto",
|
||||||
"true" : "false");
|
opts->allow_rerere_auto == RERERE_AUTOUPDATE ?
|
||||||
|
"true" : "false");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,11 @@ test_expect_success setup '
|
|||||||
test_commit base foo b &&
|
test_commit base foo b &&
|
||||||
test_commit picked foo c &&
|
test_commit picked foo c &&
|
||||||
test_commit --signoff picked-signed foo d &&
|
test_commit --signoff picked-signed foo d &&
|
||||||
|
git checkout -b topic initial &&
|
||||||
|
test_commit redundant-pick foo c redundant &&
|
||||||
|
git commit --allow-empty --allow-empty-message &&
|
||||||
|
git tag empty &&
|
||||||
|
git checkout master &&
|
||||||
git config advice.detachedhead false
|
git config advice.detachedhead false
|
||||||
|
|
||||||
'
|
'
|
||||||
@ -405,4 +410,23 @@ test_expect_success 'cherry-pick preserves sparse-checkout' '
|
|||||||
test_i18ngrep ! "Changes not staged for commit:" actual
|
test_i18ngrep ! "Changes not staged for commit:" actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
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 &&
|
||||||
|
echo c >foo &&
|
||||||
|
git add foo &&
|
||||||
|
git cherry-pick --continue
|
||||||
|
'
|
||||||
|
|
||||||
|
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 \
|
||||||
|
picked empty &&
|
||||||
|
echo c >foo &&
|
||||||
|
git add foo &&
|
||||||
|
git cherry-pick --continue
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user