Subject: bug#64055: Implementation of modifying VC change comments for Git

From: Eli Zaretskii <[email-masked]>
Date: Mon, 21 Oct 2024 16:48:28 +0300

> From: Sean Whitton <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Mon, 21 Oct 2024 09:52:02 +0800
> 
> I think the next thing to do is try the rebase from the command line.
> So, please use the debugging version of my patch to create the special
> "amend!" commit again, or use the one from yesterday if you still have
> it, or you could manually create it by passing --allow-empty to 'git
> commit'.
> 
> Then, at the command line, use
> 
>     git rebase --autosquash -i REV~1
> 
> where REV is the sha1 of the commit whose message you intend to edit.
> 
> This should open an editor with a rebase plan in which you see
> 
>     - the commit whose message you wanted to change
>     - followed by the special amend! commit
>     - followed by any other commits following the one whose message you wanted to change
> 
> i.e. the amend! commit has been pulled down in history to just after the
> commit whose message you want to cahnge.
> 
> Just save and exit without making any changes to the plan.
> 
> After that, the whole process should be complete: you should have the
> same commits as previously except the message should have been updated,
> and sha1 hashes will have changed.
> 
> Let me know if this all works.

I'm not sure I understood you correctly, but if I perform all these
step, I'm back at the original tip, with the original log message, not
the edited one.

But let me describe what I did and saw, to make sure I did it
correctly.

>     git rebase --autosquash -i REV~1
> 
> where REV is the sha1 of the commit whose message you intend to edit.

At this point "git log" shows a revision with my amended log message
(let's call this AMENDED-REV), followed by the revision with the
original log message (let's call it ORIG-REV).  So my Git command
looks like this:

  git rebase --autosquash -i ORIG-REV~1

After this step, I see this in the editor (where I indented the text
by 2 columns):

  pick bf73d7e Foobar with some Unicode אבגד ą ě č
  # pick bc3c567b2b136d040fd13373b6594c1ec026fec6 Foobar with some Unicode אבגד ą ě č

  # Rebase 6c6ea73..bc3c567 onto 6c6ea73 (1 command)
  #
  # Commands:
  # p, pick = use commit
  # r, reword = use commit, but edit the commit message
  # e, edit = use commit, but stop for amending
  # s, squash = use commit, but meld into previous commit
  # f, fixup = like "squash", but discard this commit's log message
  # x, exec = run command (the rest of the line) using shell
  # d, drop = remove commit
  #
  # These lines can be re-ordered; they are executed from top to bottom.
  #
  # If you remove a line here THAT COMMIT WILL BE LOST.
  #
  # However, if you remove everything, the rebase will be aborted.
  #
  # Note that empty commits are commented out

Here bf73d7e is ORIG-REV and bc3c567b is AMENDED-REV.  At this point,
I just type "C-x #", since you said "just save and exit" (of course,
saving is not needed, since I didn't edit the buffer).

After that, I see in the shell window:

  $ git rebase --autosquash -i bf73d7e036c5d80cdd112f34255a0ab1ea697c07~1
  Waiting for Emacs...
  Successfully rebased and updated refs/heads/master.

But "git log" shows the original log message for ORIG-REV.

Does this mean it didn't work? or did I misinterpret the steps?