git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 6/8] rebase --apply: make reflog messages match rebase --merge

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 20, 2022, 10:22 UTC
Message-ID
<220420.865yn4833u.gmgdl@evledraar.gmail.com>
In-Reply-To
<95161f21e0004cff1bb0915aa39200b286e592e5.1650448612.git.gitgitgadget@gmail.com>
On Wed, Apr 20 2022, Phillip Wood via GitGitGadget wrote:
Show 68 quoted lines
> From: Phillip Wood <phillip.wood@dunelm.org.uk>
>
> The apply backend creates slightly different reflog messages to the
> merge backend when starting and finishing a rebase and when picking
> commits. The choice of backend is really an implementation detail so
> it is confusing to have the same command create different messages
> depending on which backend is selected. Change the apply backend so
> the reflog messages from the two backends match as closely as
> possible. Note that there is still a difference when committing a
> conflict resolution - the merge backend will use "(continue)" rather
> than "(pick)" in that case as it does not know which command created
> the conflict that it is committing.
>
> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> ---
>  builtin/rebase.c          | 9 +++++----
>  t/t3406-rebase-message.sh | 2 +-
>  2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index e50361fc2a9..678339c7bf7 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -580,10 +580,10 @@ static int move_to_original_branch(struct rebase_options *opts)
>  	if (!opts->onto)
>  		BUG("move_to_original_branch without onto");
>  
> -	strbuf_addf(&branch_reflog, "%s finished: %s onto %s",
> +	strbuf_addf(&branch_reflog, "%s (finish): %s onto %s",
>  		    getenv(GIT_REFLOG_ACTION_ENVIRONMENT),
>  		    opts->head_name, oid_to_hex(&opts->onto->object.oid));
> -	strbuf_addf(&head_reflog, "%s finished: returning to %s",
> +	strbuf_addf(&head_reflog, "%s (finish): returning to %s",
>  		    getenv(GIT_REFLOG_ACTION_ENVIRONMENT), opts->head_name);
>  	ropts.branch = opts->head_name;
>  	ropts.flags = RESET_HEAD_REFS_ONLY;
> @@ -613,7 +613,8 @@ static int run_am(struct rebase_options *opts)
>  
>  	am.git_cmd = 1;
>  	strvec_push(&am.args, "am");
> -
> +	strvec_pushf(&am.env_array, GIT_REFLOG_ACTION_ENVIRONMENT "=%s (pick)",
> +		     getenv(GIT_REFLOG_ACTION_ENVIRONMENT));
>  	if (opts->action && !strcmp("continue", opts->action)) {
>  		strvec_push(&am.args, "--resolved");
>  		strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
> @@ -1763,7 +1764,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>  		printf(_("First, rewinding head to replay your work on top of "
>  			 "it...\n"));
>  
> -	strbuf_addf(&msg, "%s: checkout %s",
> +	strbuf_addf(&msg, "%s (start): checkout %s",
>  		    getenv(GIT_REFLOG_ACTION_ENVIRONMENT), options.onto_name);
>  	ropts.oid = &options.onto->object.oid;
>  	ropts.orig_head = &options.orig_head,
> diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh
> index bb2a4949abc..5c6cd9af3bc 100755
> --- a/t/t3406-rebase-message.sh
> +++ b/t/t3406-rebase-message.sh
> @@ -88,7 +88,7 @@ test_expect_success 'error out early upon -C<n> or --whitespace=<bad>' '
>  write_reflog_expect () {
>  	if test $mode = --apply
>  	then
> -		sed 's/(finish)/finished/; s/ ([^)]*)//'
> +		sed 's/(continue)/(pick)/'
>  	else
>  		cat
>  	fi >expect

I like the new message better, but I wonder given that the old message has been with us since 6fd2f5e60d4 (rebase: operate on a detached HEAD, 2007-11-08) whether this will break anything in the wild.

Previous: Phillip Wood via GitGitGadgetNext: Junio C Hamano
Message 36 of 73 in “rebase: make reflog messages independent of the backend”
  1. 0/7 rebase: make reflog messages independent of the backendPhillip Wood via GitGitGadget, Feb 21, 2022
  2. 3/7 rebase --merge: fix reflog message after skippingPhillip Wood via GitGitGadget, Feb 21, 2022
  3. Elijah NewrenApr 17, 2022
  4. 4/7 rebase --apply: respect GIT_REFLOG_ACTIONPhillip Wood via GitGitGadget, Feb 21, 2022
  5. Christian CouderApr 7, 2022
  6. Phillip WoodApr 15, 2022
  7. 7/7 rebase: cleanup action handlingPhillip Wood via GitGitGadget, Feb 21, 2022
  8. Elijah NewrenApr 17, 2022
  9. 5/7 rebase --apply: make reflog messages match rebase --mergePhillip Wood via GitGitGadget, Feb 21, 2022
  10. Elijah NewrenApr 17, 2022
  11. 2/7 rebase --merge: fix reflog when continuingPhillip Wood via GitGitGadget, Feb 21, 2022
  12. Christian CouderApr 7, 2022
  13. Phillip WoodApr 15, 2022
  14. Elijah NewrenApr 17, 2022
  15. 1/7 rebase --apply: remove duplicated codePhillip Wood via GitGitGadget, Feb 21, 2022
  16. Christian CouderApr 7, 2022
  17. Elijah NewrenApr 17, 2022
  18. 6/7 rebase --abort: improve reflog messagePhillip Wood via GitGitGadget, Feb 21, 2022
  19. Elijah NewrenApr 17, 2022
  20. Review Request (was Re: [PATCH 0/7] rebase: make reflog messages independent of the backend)Phillip Wood, Apr 4, 2022
  21. Elijah NewrenApr 17, 2022
  22. Phillip WoodApr 18, 2022
  23. Christian CouderApr 7, 2022
  24. Elijah NewrenApr 17, 2022
  25. 0/8 rebase: make reflog messages independent of the backendPhillip Wood via GitGitGadget, Apr 20, 2022
  26. 2/8 t3406: rework rebase reflog testsPhillip Wood via GitGitGadget, Apr 20, 2022
  27. Junio C HamanoApr 20, 2022
  28. 1/8 rebase --apply: remove duplicated codePhillip Wood via GitGitGadget, Apr 20, 2022
  29. Ævar Arnfjörð BjarmasonApr 20, 2022
  30. Junio C HamanoApr 20, 2022
  31. Junio C HamanoApr 20, 2022
  32. 3/8 rebase --merge: fix reflog when continuingPhillip Wood via GitGitGadget, Apr 20, 2022
  33. 4/8 rebase --merge: fix reflog message after skippingPhillip Wood via GitGitGadget, Apr 20, 2022
  34. 5/8 rebase --apply: respect GIT_REFLOG_ACTIONPhillip Wood via GitGitGadget, Apr 20, 2022
  35. 6/8 rebase --apply: make reflog messages match rebase --mergePhillip Wood via GitGitGadget, Apr 20, 2022
  36. Ævar Arnfjörð BjarmasonApr 20, 2022
  37. Junio C HamanoApr 20, 2022
  38. 7/8 rebase --abort: improve reflog messagePhillip Wood via GitGitGadget, Apr 20, 2022
  39. 8/8 rebase: cleanup action handlingPhillip Wood via GitGitGadget, Apr 20, 2022
  40. Ævar Arnfjörð BjarmasonApr 20, 2022
  41. 0/8 rebase: make reflog messages independent of the backendPhillip Wood via GitGitGadget, Oct 12, 2022
  42. 1/8 rebase --apply: remove duplicated codePhillip Wood via GitGitGadget, Oct 12, 2022
  43. Junio C HamanoOct 12, 2022
  44. Junio C HamanoOct 13, 2022
  45. Phillip WoodOct 20, 2022
  46. 2/8 t3406: rework rebase reflog testsPhillip Wood via GitGitGadget, Oct 12, 2022
  47. 3/8 rebase --merge: fix reflog when continuingPhillip Wood via GitGitGadget, Oct 12, 2022
  48. 4/8 rebase --merge: fix reflog message after skippingPhillip Wood via GitGitGadget, Oct 12, 2022
  49. 5/8 rebase --apply: respect GIT_REFLOG_ACTIONPhillip Wood via GitGitGadget, Oct 12, 2022
  50. 6/8 rebase --apply: make reflog messages match rebase --mergePhillip Wood via GitGitGadget, Oct 12, 2022
  51. 7/8 rebase --abort: improve reflog messagePhillip Wood via GitGitGadget, Oct 12, 2022
  52. 8/8 rebase: cleanup action handlingPhillip Wood via GitGitGadget, Oct 12, 2022
  53. Junio C HamanoOct 12, 2022
  54. Phillip WoodOct 13, 2022
  55. Junio C HamanoOct 13, 2022
  56. 0/8 rebase: make reflog messages independent of the backendPhillip Wood via GitGitGadget, Oct 21, 2022
  57. 1/8 t3406: rework rebase reflog testsPhillip Wood via GitGitGadget, Oct 21, 2022
  58. 2/8 rebase --apply: improve fast-forward reflog messagePhillip Wood via GitGitGadget, Oct 21, 2022
  59. 3/8 rebase --merge: fix reflog when continuingPhillip Wood via GitGitGadget, Oct 21, 2022
  60. Junio C HamanoOct 21, 2022
  61. Phillip WoodOct 25, 2022
  62. Junio C HamanoOct 25, 2022
  63. Phillip WoodOct 26, 2022
  64. Junio C HamanoOct 26, 2022
  65. 4/8 rebase --merge: fix reflog message after skippingPhillip Wood via GitGitGadget, Oct 21, 2022
  66. 5/8 rebase --apply: respect GIT_REFLOG_ACTIONPhillip Wood via GitGitGadget, Oct 21, 2022
  67. Junio C HamanoOct 21, 2022
  68. 6/8 rebase --apply: make reflog messages match rebase --mergePhillip Wood via GitGitGadget, Oct 21, 2022
  69. Junio C HamanoOct 21, 2022
  70. 7/8 rebase --abort: improve reflog messagePhillip Wood via GitGitGadget, Oct 21, 2022
  71. Junio C HamanoOct 21, 2022
  72. 8/8 rebase: cleanup action handlingPhillip Wood via GitGitGadget, Oct 21, 2022
  73. Junio C HamanoOct 21, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.