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

Re: [PATCH 2/2] commit: add support for --fixup <commit> -m"<extra message>"

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 20, 2017, 21:40 UTC
Message-ID
<87bmit5b8a.fsf@evledraar.gmail.com>
In-Reply-To
<CAPig+cSeRZR7J9WSozTETVu=Y9N2wMRpoCgUkLXyzAaBOmTNZw@mail.gmail.com>
On Wed, Dec 20 2017, Eric Sunshine jotted:
Show 10 quoted lines
> On Wed, Dec 20, 2017 at 2:38 PM, Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>> Add support for supplying the -m option with --fixup. Doing so has
>> errored out ever since --fixup was introduced. Before this, the only
>> way to amend the fixup message while committing was to use --edit and
>> amend it in the editor.
>
> I can't tell, based upon this description, if '-m<msg> --edit' is a
> valid combination and, if so, does it correctly open the editor after
> appending <msg>?

Yes, that's works as expected for all the options, and this doesn't break that.

Show 21 quoted lines
>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> ---
>> diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
>> @@ -272,6 +272,14 @@ test_expect_success 'commit --fixup provides correct one-line commit message' '
>>         commit_msg_is "fixup! target message subject line"
>>  '
>>
>> +test_expect_success 'commit --fixup -m"something" -m"extra"' '
>> +       commit_for_rebase_autosquash_setup &&
>> +       git commit --fixup HEAD~1 -m"something" -m"extra" &&
>> +       commit_msg_is "fixup! target message subject linesomething
>> +
>> +extra"
>> +'
>
> Hmm, so the first -m appended to the "fixup!" line, but the second -m
> appended after a blank line? That doesn't seem very intuitive.
>
> Also, doesn't the text following "fixup!" need to exactly match the
> summary line of the commit message in order for "git rebase -i
> --autosquash" to work? Am I overlooking something obvious?

It does the right thing and it's actually "$fixup_line\n\n$first_m\n\n$second_m" etc. It's just that this commit_msg_is function is testing against the "%s%b" format, so the first line of the body comes right after the subject.

Thanks for the review of both patches. I'll clarify the points raised in commit message for v2 pending further feedback.

Previous: Eric SunshineNext: Eric Sunshine
Message 4 of 16 in “commit doc: document that -c, -C, -F and --fixup with -m error”
  1. 1/2 commit doc: document that -c, -C, -F and --fixup with -m errorÆvar Arnfjörð Bjarmason, Dec 20, 2017
  2. 2/2 commit: add support for --fixup <commit> -m"<extra message>"Ævar Arnfjörð Bjarmason, Dec 20, 2017
  3. Eric SunshineDec 20, 2017
  4. Ævar Arnfjörð BjarmasonDec 20, 2017
  5. Eric SunshineDec 20, 2017
  6. 0/2 support -m"<msg>" combined with commit --fixupÆvar Arnfjörð Bjarmason, Dec 22, 2017
  7. 1/2 commit doc: document that -c, -C, -F and --fixup with -m errorÆvar Arnfjörð Bjarmason, Dec 22, 2017
  8. Eric SunshineDec 22, 2017
  9. Ævar Arnfjörð BjarmasonDec 22, 2017
  10. 2/2 commit: add support for --fixup <commit> -m"<extra message>"Ævar Arnfjörð Bjarmason, Dec 22, 2017
  11. Junio C HamanoDec 22, 2017
  12. Junio C HamanoDec 22, 2017
  13. Ævar Arnfjörð BjarmasonDec 22, 2017
  14. Junio C HamanoDec 22, 2017
  15. Ævar Arnfjörð BjarmasonDec 23, 2017
  16. Eric SunshineDec 20, 2017

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.