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

Re: [PATCH v3 2/2] rebase: support --trailer

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Aug 6, 2025, 13:19 UTC
Message-ID
<499da566-66a8-4c38-a2b3-13c06092568f@gmail.com>
In-Reply-To
<e911d897-8664-40a7-b7a9-8eb9f71a8735@gmail.com>
Hi Li
I had a couple more thoughts about the tests ...
On 06/08/2025 11:28, Phillip Wood wrote:
Show 11 quoted lines
> On 03/08/2025 16:00, Li Chen wrote:
>> +create_expect() {
>> +    cat >"$1" <<-EOF
>> +        $2
>> +
>> +        Reviewed-by: Dev <dev@example.com>
>> +    EOF
>> +}
>> +
>> +test_expect_success 'setup repo with a small history' '
>> [...]
 >> +    create_expect third-signed    "third"                 &&>> +    
create_expect conflict-signed "conflict"
> 
> Normally we create the "expect" file in the test where it is used.

Thinking about this some more, if we want to use test_commit_message then I think we can change create_expect to write to stdout and do

	test_commit_message HEAD <<-EOF
	$(create_expect first)
	EOF
rather than having to create a file.
>> +
>> +test_expect_success 'reject empty --trailer argument' '
>> [...]
>> +test_expect_success 'reject trailer with missing key before separator' '

Should we also test for a missing value or are trailers without a value allowed?

>> +        git rebase -m \
>> +            --trailer "Signed-off-by: Dev A <a@ex.com>" \
>> +            --trailer "Signed-off-by: Dev B <b@ex.com>" HEAD~1 &&

Lets use example.com here rather than some random domain that might actually exist.

Show 8 quoted lines
>> +test_expect_success 'rebase -m --trailer adds trailer after conflicts' '
>> +    git reset --hard third &&
>> +    test_must_fail git rebase -m \
>> +        --trailer "Reviewed-by: Dev <dev@example.com>" \
>> +        second third &&
>> +    git checkout --theirs file &&
>> +    git add file &&
>> +    git rebase --continue &&

This checks that the commit with conflicts has a trailer added but it does not check that the commits picked by "git rebase --continue" do. To check that we actually save the trailers and use them when continuing we need to add a fourth commit on top of third and check that has a trailer add here as well.

A couple more thoughts:
  - We should check that
      git -c trailer.review.key=Reviewed-by rebase \
          --trailer=review="Dev <dev@example.com>"
    adds a "Reviewed-by:" trailer. We can do that by changing one of the
    tests in this patch rather than adding a new one. This checks that we
    accept '=' as a separator as well a respecting the config.
  - We should check that the todo list
      pick first
      fixup second
    adds the trailer as expected and that
      pick first
      fixup -C second
    also works. To do that we will need to source lib-rebase.sh at the
    start of the test file and add a test that uses set_replace_editor()
    which should be called in a subshell.
Do please ask if you have any questions about these suggestions
Thanks
Phillip
Previous: Phillip WoodNext: Li Chen
Message 9 of 15 in “rebase: support --trailer”
  1. 0/2 rebase: support --trailerLi Chen, Aug 3, 2025
  2. 1/2 trailer: append trailers in-process and drop the fork to `interpret-trailers`Li Chen, Aug 3, 2025
  3. Phillip WoodAug 5, 2025
  4. Li ChenAug 7, 2025
  5. Li ChenOct 21, 2025
  6. 2/2 rebase: support --trailerLi Chen, Aug 3, 2025
  7. Phillip WoodAug 5, 2025
  8. Phillip WoodAug 6, 2025
  9. Phillip WoodAug 6, 2025
  10. Li ChenAug 7, 2025
  11. Junio C HamanoAug 28, 2025
  12. Li ChenSep 18, 2025
  13. Li ChenAug 7, 2025
  14. Junio C HamanoAug 3, 2025
  15. Li ChenAug 4, 2025

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.