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

Re: [PATCH] filter-branch: Fix renaming a directory in the tree-filter

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 31, 2008, 12:15 UTC
Message-ID
<alpine.LSU.1.00.0803311412090.18259@racer.site>
In-Reply-To
<7v3aq7mgly.fsf@gitster.siamese.dyndns.org>
Hi,
On Mon, 31 Mar 2008, Junio C Hamano wrote:
Show 23 quoted lines
> Johannes Sixt <johannes.sixt@telecom.at> writes:
> 
> > 2. Then filter-branch checks out the files for the next commit. This 
> >    leaves the new directory behind because there is no real "branch 
> >    switching" involved that would notice that the directory can be 
> >    removed.
> 
> Thanks.
> 
> It obviously is a correct fix to use "clean -d" here, but I strongly 
> suspect this awkwardness comes from the fact that there is no clear 
> invariant in this loop.
> 
> For example, if you make it the invariant that $T contains the tree that 
> matches the contents of the "$tempdir/t" work tree left in the previous 
> round of filter-tree (and obviously you would want to do this only 
> filter_tree is in effect), the "checkout-index + clean" would become a 
> proper "branch switching".
>
> This is obviously untested, and you would need to prime $T with an empty 
> tree before entering the loop (but you could cheat by initializing T 
> with an empty string), but it might make the code a bit more readable 
> than the current mess.  I dunno.
Yes, I'd prefer this.

Originally, I wanted to clean up filter-branch a little, but then somebody worked on a builtin version of it, which unfortunately came in after the code freeze, and I always waited for that thing to be picked up and enhanced. (AFAIR there were quite a few issues which made rewrite-commits much less useful than it should be.)

Ciao, Dscho

Previous: Johannes SixtNext: Jean-François Veillette
Message 8 of 9 in “[bug] filter-branch skipping removed files”
  1. Jean-François VeilletteMar 30, 2008
  2. Jean-François VeilletteMar 30, 2008
  3. filter-branch: Test renaming directories in a tree-filterJohannes Sixt, Mar 31, 2008
  4. filter-branch: Fix renaming a directory in the tree-filterJohannes Sixt, Mar 31, 2008
  5. Johannes SixtMar 31, 2008
  6. Junio C HamanoMar 31, 2008
  7. Johannes SixtMar 31, 2008
  8. Johannes SchindelinMar 31, 2008
  9. Jean-François VeilletteMar 31, 2008

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.