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

Re: How to use filter-branch with --state-branch?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Mar 8, 2018, 09:25 UTC
Message-ID
<87zi3inckw.fsf@evledraar.gmail.com>
In-Reply-To
<P56D58$52E406B139FE9D3C295CB5ABAB5C8893@locati.it>
On Tue, Mar 06 2018, Michele Locati jotted:
Show 41 quoted lines
> Recent versions of git filter-branch command introduced the --state-branch
> option.
> BTW I can't find any info about how this can be actually used.
>
> We have this repository on github:
> https://github.com/concrete5/concrete5
>
> When someone pushes to that repo, we clone it and execute
> `git filter-branch --subdirectory-filter concrete`
> to extract the concrete directory, and we push the result to
> https://github.com/concrete5/concrete5-core
> (including all the branches and tags)
>
> The script at the moment is this one:
> https://github.com/concrete5/core_splitter/blob/70879e676b95160f7fc5d0ffc22b8f7420b0580b/bin/splitcore
>
> I tried to use the --state-branch option on a local mirror, so that we could
> do an incremental filtering. Here's the script:
>
> # Executed just one time
> git clone --no-checkout --mirror \
>    https://github.com/concrete5/concrete5.git work
> cd work
> git filter-branch \
>    --subdirectory-filter concrete \
>    --tag-name-filter cat \
>    --prune-empty \
>    --state-branch FILTERBRANCH_STATE \
>    -- --all
> # Executed every time the repo is updated
> git remote update --prune
> git filter-branch \
>    --subdirectory-filter concrete \
>    --tag-name-filter cat \
>    --prune-empty \
>    --state-branch FILTERBRANCH_STATE \
>    -- --all
>
> The first filter-branch call required 7168 steps, so did the second call...
> I also tried without the --prune option of remote update (I had to add
> --force to the second filter-branch), but nothing changed.

CC-ing the author of that feature. Usually I'd just look at how the tests for it work to answer your question, but I see this new feature made it in recently with no tests for it, which doesn't make me very happy :(

Previous: Michele LocatiNext: Ian Campbell
Message 2 of 6 in “How to use filter-branch with --state-branch?”
  1. Michele LocatiMar 6, 2018
  2. Ævar Arnfjörð BjarmasonMar 8, 2018
  3. Ian CampbellMar 8, 2018
  4. Michele LocatiMar 9, 2018
  5. Ian CampbellMar 9, 2018
  6. Michele LocatiMar 9, 2018

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.