Thread (2 messages) 2 messages, 2 authors, 2024-02-28

Re: [PATCH] rebase -i: stop setting GIT_CHERRY_PICK_HELP

From: <hidden>
Date: 2024-02-28 14:45:43

On 27/02/2024 18:38, Junio C Hamano wrote:
"Phillip Wood via GitGitGadget" [off-list ref] writes:
quoted
Note that we retain the changes in e4301f73fff (sequencer: unset
GIT_CHERRY_PICK_HELP for 'exec' commands, 2024-02-02) just in case
GIT_CHERRY_PICK_HELP is set in the environment when "git rebase" is
run.
Is this comment about this part of the code?
No, it is about

         strvec_push(&cmd.env, "GIT_CHERRY_PICK_HELP");

in do_exec() which clears GIT_CHERRY_PICK_HELP in the child environment 
when running an exec command so that "exec git cherry-pick ..." retains 
the correct author information.
quoted
+	const char *msg;
+
+	if (is_rebase_i(opts))
+		msg = rebase_resolvemsg;
+	else
+		msg = getenv("GIT_CHERRY_PICK_HELP");
Testing is_rebase_i() first means we ignore the environment
unconditionally and use our own message always in "rebase -i", no?
Yes, this matches the existing behavior in builtin/rebase.c where we call

	setenv("GIT_CHERRY_PICK_HELP", resolvemsg, 1);

to set GIT_CHERRY_PICK_HELP even if it is already set in the environment.
Not that I think we should honor the environment variable and let it
override our message.  I just found the description a bit confusing.
I should have been clearer what that it was talking about - i.e. it is 
still worth clearing GIT_CHERRY_PICK_HELP in the environment when 
running exec commands.

Best Wishes

Phillip

quoted
diff --git a/sequencer.h b/sequencer.h
index dcef7bb99c0..437eabd38af 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -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;
This is more library-ish part of the system than a random file in
the builtin/ directory.  This place as the final location for the
string makes sense to me.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help