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

Re: subdirectory-filter does not delete files before the directory came into existence?

From
JWJan Wielemaker <j.wielemaker@cs.vu.nl>
Date
Dec 19, 2010, 09:34 UTC
Message-ID
<1292751289.21229.26.camel@ct>
In-Reply-To
<201012190323.59829.trast@student.ethz.ch>
On Sun, 2010-12-19 at 03:23 +0100, Thomas Rast wrote:
Show 19 quoted lines
> Jan Wielemaker wrote:
> > The reported problems also apply to the next module.  What appears to
> > work is this:
> > 
> >   * Walk through the history, finding the commit where the directory
> >   is created.
> >   * use git tag -l --contains <commit that created dir> to get the 
> >   tags we want to keep.
> >   * get all tags, use comm and delete the tags not in the `contained'
> >   set above.
> > 
> > Not very friendly and I'm (with Thomas) about the status of these
> > findings.  I like to thank Thomas for giving me the right clue.
> 
> Now I finally remember where I knew this problem from:
> 
>   http://article.gmane.org/gmane.comp.version-control.git/91708
> 
> (My memory really sucks.)

Funny. That was me having problems with filtering out directories as well :-) I thought your patch was added using the --prune-empty flag. I guess you can comment on that. I can confirm that I've got nice and clean filtering using

  * git filter-branch --subdirectory-filter <dir> --prune-empty
--tag-name-filter cat -- --all
  
followed by the steps above.  I use qgit with the tree-view enabled
to find the place where the hierarchy changes from the complete one
to the only-this-dir one.  You can do a binary search for that and
you spot the exact commit easily by the gap in the history-line.  Then
I run this little bit of code:
#!/bin/bash
contains="$1"

git tag | sort > tags.all git tag -l --contains $contains | sort > tags.keep

for t in `comm -23 tags.all tags.keep`; do
  git tag -d $t
done
Not ideal, but doable.
	Cheers --- Jan
Previous: Thomas RastNext: Thomas Rast
Message 7 of 8 in “subdirectory-filter does not delete files before the directory came into existence?”
  1. Jan WielemakerDec 14, 2010
  2. Thomas RastDec 14, 2010
  3. Jan WielemakerDec 15, 2010
  4. Jan WielemakerDec 15, 2010
  5. Jan WielemakerDec 15, 2010
  6. Thomas RastDec 19, 2010
  7. Jan WielemakerDec 19, 2010
  8. Thomas RastDec 19, 2010

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.