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
Patrick Steinhardt <ps@pks.im>
Date
Sep 30, 2026, 16:08 UTC
Message-ID
<ar00BTrDQ4voz38a@pks.im>
In-Reply-To
<c6d3deb4-088b-476e-921c-c2ee788fb309@grantmoyer.com>
On Wed, Sep 30, 2026 at 11:48:25AM -0400, Grant Moyer wrote:
Show 36 quoted lines
> 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.
> 
> > >  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.

The thing that I'm worried about is that the test seems to only coincidentally exercise the code. I think it may be helpful to have a test that explicitly tests for the scenarios that were reported as broken by Michele. Let's maybe wait for them to respond -- if we're lucky they already have a test we can reuse here that more directly exercises a couple of the reportedly-broken scenarios.

> > 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?

It depends. For a small fix like this the maintainer may make the change themselves if nothing else needs to be changed. But Junio will often tell you in that case, so if he stays quiet without the series getting merged down, then I'd eventually just send a new version. Also helps to bump up the patch series on the mailing list again :)

Thanks!
Patrick
Previous: Grant MoyerNext: Michele Locati
Message 5 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.