]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'pw/rebase-i-ignore-cherry-pick-help-environment'
authorJunio C Hamano <gitster@pobox.com>
Mon, 18 Mar 2024 20:04:25 +0000 (13:04 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Mar 2024 20:04:25 +0000 (13:04 -0700)
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

builtin/rebase.c
sequencer.c
sequencer.h

index be787690bd7c2b6396784a1476314b8f757ab749..e444ab102dfe5c99dae8b004960b27a8a600a16b 100644 (file)
@@ -567,13 +567,6 @@ static int move_to_original_branch(struct rebase_options *opts)
        return ret;
 }
 
-static const char *resolvemsg =
-N_("Resolve all conflicts manually, mark them as resolved with\n"
-"\"git add/rm <conflicted_files>\", then run \"git rebase --continue\".\n"
-"You can instead skip this commit: run \"git rebase --skip\".\n"
-"To abort and get back to the state before \"git rebase\", run "
-"\"git rebase --abort\".");
-
 static int run_am(struct rebase_options *opts)
 {
        struct child_process am = CHILD_PROCESS_INIT;
@@ -587,7 +580,7 @@ static int run_am(struct rebase_options *opts)
                     opts->reflog_action);
        if (opts->action == ACTION_CONTINUE) {
                strvec_push(&am.args, "--resolved");
-               strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
+               strvec_pushf(&am.args, "--resolvemsg=%s", rebase_resolvemsg);
                if (opts->gpg_sign_opt)
                        strvec_push(&am.args, opts->gpg_sign_opt);
                status = run_command(&am);
@@ -598,7 +591,7 @@ static int run_am(struct rebase_options *opts)
        }
        if (opts->action == ACTION_SKIP) {
                strvec_push(&am.args, "--skip");
-               strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
+               strvec_pushf(&am.args, "--resolvemsg=%s", rebase_resolvemsg);
                status = run_command(&am);
                if (status)
                        return status;
@@ -672,7 +665,7 @@ static int run_am(struct rebase_options *opts)
 
        strvec_pushv(&am.args, opts->git_am_opts.v);
        strvec_push(&am.args, "--rebasing");
-       strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
+       strvec_pushf(&am.args, "--resolvemsg=%s", rebase_resolvemsg);
        strvec_push(&am.args, "--patch-format=mboxrd");
        if (opts->allow_rerere_autoupdate == RERERE_AUTOUPDATE)
                strvec_push(&am.args, "--rerere-autoupdate");
@@ -700,7 +693,6 @@ static int run_specific_rebase(struct rebase_options *opts)
 
        if (opts->type == REBASE_MERGE) {
                /* Run sequencer-based rebase */
-               setenv("GIT_CHERRY_PICK_HELP", resolvemsg, 1);
                if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT))
                        setenv("GIT_SEQUENCE_EDITOR", ":", 1);
                if (opts->gpg_sign_opt) {
index ea1441e617400717458a805b1c27766e27ea7a34..4e14fa6541c7012c8549e84957c47f386efbc7ec 100644 (file)
@@ -461,10 +461,22 @@ static void free_message(struct commit *commit, struct commit_message *msg)
        repo_unuse_commit_buffer(the_repository, commit, msg->message);
 }
 
+const char *rebase_resolvemsg =
+N_("Resolve all conflicts manually, mark them as resolved with\n"
+"\"git add/rm <conflicted_files>\", then run \"git rebase --continue\".\n"
+"You can instead skip this commit: run \"git rebase --skip\".\n"
+"To abort and get back to the state before \"git rebase\", run "
+"\"git rebase --abort\".");
+
 static void print_advice(struct repository *r, int show_hint,
                         struct replay_opts *opts)
 {
-       char *msg = getenv("GIT_CHERRY_PICK_HELP");
+       const char *msg;
+
+       if (is_rebase_i(opts))
+               msg = rebase_resolvemsg;
+       else
+               msg = getenv("GIT_CHERRY_PICK_HELP");
 
        if (msg) {
                advise("%s\n", msg);
index dcef7bb99c08b0f8e5a29905f8f3a4d6d2d34a45..437eabd38af0398ae9f72b5badd2f691290aa694 100644 (file)
@@ -14,6 +14,8 @@ const char *rebase_path_todo(void);
 const char *rebase_path_todo_backup(void);
 const char *rebase_path_dropped(void);
 
+extern const char *rebase_resolvemsg;
+
 #define APPEND_SIGNOFF_DEDUP (1u << 0)
 
 enum replay_action {