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

Re: [PATCH v4] git-rebase--interactive.sh: add config option for custom instruction format

From
Mike Rappazzo <rappazzo@gmail.com>
Date
Jun 12, 2015, 22:15 UTC
Message-ID
<CANoM8SXQq_zbRui7SHDDAnrgf2VUdCkkJJ7_RHLu355JUzdNxA@mail.gmail.com>
In-Reply-To
<xmqqzj44bn1l.fsf@gitster.dls.corp.google.com>
On Fri, Jun 12, 2015 at 6:05 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> But because you overwrite the $message variable you read from the
> original insn sheet (which uses the custom format) and compute $rest
> based on the default "%s" and store that in "$1.sq", lines in
> "$1.sq" do not know anything about the custom format, do they?
>
> And then they are injected to appropriate places in "$1.rearranged".
> Moved lines in the the rearranged result would end up written in the
> default "%s" format, no?
>
> That was the part that made me uneasy.
>
> I do not think that is a bug worth fixing, but I view it as a sign
> that fundamentally the autosquash and the idea of configurable
> format do not mesh well with each other.

My understanding of the rearrange_squash function is this: There are two loops. The first loop collects the commits which should be moved (squashed). The second loop re-constructs the instruction list using the info from the first loop.

In the second loop, I changed it to recalculate the presented message when the re-ordered commit is added:

+       if test -n "${format}"
+       then
+            msg_content=$(git log -n 1 --format="${format}" ${squash})
That is the "$rest".

I have patched my locally installed `git-rebase--interactive` with these changes, and I did see the proper rearrangement of commits with the custom formatted message.

Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 7 in “git-rebase--interactive.sh: add config option for custom instruction format”
  1. git-rebase--interactive.sh: add config option for custom instruction formatMichael Rappazzo, Jun 12, 2015
  2. git-rebase--interactive.sh: add config option for custom instruction formatMichael Rappazzo, Jun 12, 2015
  3. Junio C HamanoJun 12, 2015
  4. Mike RappazzoJun 12, 2015
  5. Junio C HamanoJun 12, 2015
  6. Mike RappazzoJun 12, 2015
  7. Junio C HamanoJun 12, 2015

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.