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

Re: [PATCH] fiter-branch: fix commit map init from state branch

From
GMGrant Moyer <dev@grantmoyer.com>
Date
Sep 30, 2026, 15:48 UTC
Message-ID
<c6d3deb4-088b-476e-921c-c2ee788fb309@grantmoyer.com>
In-Reply-To
<ar0fRtN8XMG-fyis@pks.im>
On September 30, 2026 10:40:06 AM EDT, Patrick Steinhardt <ps@pks.im> wrote:
>Okay. A simpler fix could've been the following diff:
>
>- echo "${line%:*}" >../map/"${line#*:}";;
>+ echo "${line#*:}" >../map/"${line%:*}";;

Yep, that's equivalent and was my first version, but I decided to err on the side of clearer intent. Plus, the more verbose version mirrors how the state branch is constructed further down in the script.

>So... does this mean that we don't have test coverage for this case at
>all?
Yeah, the test for this case was broken.
Show 9 quoted lines
>>  test_expect_success 'using --state-branch to skip already rewritten commits' '
>>  test_when_finished git reset --hard $V &&
>>  git reset --hard $V &&
>> - git filter-branch --state-branch state -f --tree-filter "touch file || :" HEAD &&
>> + git filter-branch --state-branch state -f --tree-filter "exit 1" HEAD &&
>>  test_cmp_rev $W HEAD
>>  '
>
>So does this now detect the issue? If so, it feels somewhat roundabout.

The current test seemingly intends to check if the --tree-filter filter was run on already processed commits, but it only checks that the filter produces the same final result. Since the filter is deterministic, the final result is the same whether or not the filter is re-run on already processed commits.

The proposed change makes the test fail immediately if the tree-filter is re-run. I looked around other tests for a test_* command or conventions to fail with a message, but I didn't find anything. I've checked that the test fails without the filter-branch change, and passes with it.

>Nit: pointed out by Michele: the subject has a typo in "fiter-branch".

I'm new here. Is this something I should fix by submitting a new version of the patch, or will the maintainer fix it up if/when they merge the patch?

Grant
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 4 of 12 in “fiter-branch: fix commit map init from state branch”
  1. fiter-branch: fix commit map init from state branchGrant Moyer, Aug 1, 2026
  2. Michele LocatiSep 29, 2026
  3. Patrick SteinhardtSep 30, 2026
  4. Grant MoyerSep 30, 2026
  5. Patrick SteinhardtSep 30, 2026
  6. Michele LocatiSep 30, 2026
  7. filter-branch: fix commit map init from state branchGrant Moyer, Oct 1, 2026
  8. Patrick SteinhardtOct 1, 2026
  9. Michele LocatiOct 1, 2026
  10. Junio C HamanoOct 1, 2026
  11. filter-branch: fix commit map init from state branchGrant Moyer, Oct 3, 2026
  12. Patrick SteinhardtOct 5, 2026

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.