Skip to content

Commit 184969c

Browse files
committed
Merge branch 'pw/rebase-i-ignore-cherry-pick-help-environment'
Code simplification by getting rid of code that sets an environment variable that is no longer used. * pw/rebase-i-ignore-cherry-pick-help-environment: rebase -i: stop setting GIT_CHERRY_PICK_HELP
2 parents 2953d95 + 72a8d3f commit 184969c

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

builtin/rebase.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -567,13 +567,6 @@ static int move_to_original_branch(struct rebase_options *opts)
567567
return ret;
568568
}
569569

570-
static const char *resolvemsg =
571-
N_("Resolve all conflicts manually, mark them as resolved with\n"
572-
"\"git add/rm <conflicted_files>\", then run \"git rebase --continue\".\n"
573-
"You can instead skip this commit: run \"git rebase --skip\".\n"
574-
"To abort and get back to the state before \"git rebase\", run "
575-
"\"git rebase --abort\".");
576-
577570
static int run_am(struct rebase_options *opts)
578571
{
579572
struct child_process am = CHILD_PROCESS_INIT;
@@ -587,7 +580,7 @@ static int run_am(struct rebase_options *opts)
587580
opts->reflog_action);
588581
if (opts->action == ACTION_CONTINUE) {
589582
strvec_push(&am.args, "--resolved");
590-
strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
583+
strvec_pushf(&am.args, "--resolvemsg=%s", rebase_resolvemsg);
591584
if (opts->gpg_sign_opt)
592585
strvec_push(&am.args, opts->gpg_sign_opt);
593586
status = run_command(&am);
@@ -598,7 +591,7 @@ static int run_am(struct rebase_options *opts)
598591
}
599592
if (opts->action == ACTION_SKIP) {
600593
strvec_push(&am.args, "--skip");
601-
strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
594+
strvec_pushf(&am.args, "--resolvemsg=%s", rebase_resolvemsg);
602595
status = run_command(&am);
603596
if (status)
604597
return status;
@@ -672,7 +665,7 @@ static int run_am(struct rebase_options *opts)
672665

673666
strvec_pushv(&am.args, opts->git_am_opts.v);
674667
strvec_push(&am.args, "--rebasing");
675-
strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
668+
strvec_pushf(&am.args, "--resolvemsg=%s", rebase_resolvemsg);
676669
strvec_push(&am.args, "--patch-format=mboxrd");
677670
if (opts->allow_rerere_autoupdate == RERERE_AUTOUPDATE)
678671
strvec_push(&am.args, "--rerere-autoupdate");
@@ -700,7 +693,6 @@ static int run_specific_rebase(struct rebase_options *opts)
700693

701694
if (opts->type == REBASE_MERGE) {
702695
/* Run sequencer-based rebase */
703-
setenv("GIT_CHERRY_PICK_HELP", resolvemsg, 1);
704696
if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT))
705697
setenv("GIT_SEQUENCE_EDITOR", ":", 1);
706698
if (opts->gpg_sign_opt) {

sequencer.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,22 @@ static void free_message(struct commit *commit, struct commit_message *msg)
461461
repo_unuse_commit_buffer(the_repository, commit, msg->message);
462462
}
463463

464+
const char *rebase_resolvemsg =
465+
N_("Resolve all conflicts manually, mark them as resolved with\n"
466+
"\"git add/rm <conflicted_files>\", then run \"git rebase --continue\".\n"
467+
"You can instead skip this commit: run \"git rebase --skip\".\n"
468+
"To abort and get back to the state before \"git rebase\", run "
469+
"\"git rebase --abort\".");
470+
464471
static void print_advice(struct repository *r, int show_hint,
465472
struct replay_opts *opts)
466473
{
467-
char *msg = getenv("GIT_CHERRY_PICK_HELP");
474+
const char *msg;
475+
476+
if (is_rebase_i(opts))
477+
msg = rebase_resolvemsg;
478+
else
479+
msg = getenv("GIT_CHERRY_PICK_HELP");
468480

469481
if (msg) {
470482
advise("%s\n", msg);

sequencer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const char *rebase_path_todo(void);
1414
const char *rebase_path_todo_backup(void);
1515
const char *rebase_path_dropped(void);
1616

17+
extern const char *rebase_resolvemsg;
18+
1719
#define APPEND_SIGNOFF_DEDUP (1u << 0)
1820

1921
enum replay_action {

0 commit comments

Comments
 (0)