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

[BUG?] bulk checkin does not respect filters

From
Jeff King <peff@peff.net>
Date
Feb 24, 2012, 03:02 UTC
Message-ID
<20120224030244.GA15742@sigill.intra.peff.net>
If I do this:
  git init repo &&
  cd repo &&
  echo foo >small &&
  cat small small small small >large &&
  echo '* filter=foo2bar' >.gitattributes &&
  git config filter.foo2bar.clean 'sed s/foo/bar/' &&
  git config core.bigfilethreshold 10 &&
  git add . &&
  echo "===> small" && git cat-file blob :small
  echo "===> large" && git cat-file blob :large
the output I get is:
  ===> small
  bar
  ===> large
  foo
  foo
  foo
  foo

I.e., the clean filter is not applied to the bulk checkin file. Nor can it be easily, because we need to know the size of the file to write the blob header, and we don't know that until we see all of the filter's output.

In practice, I don't know if this is a huge deal, as people aren't going to be asking to de-CRLF files that actually cross the 512M bigfilethreshold (OTOH, I seem to recall there are some filters floating around for normalizing gzip'd files, which could plausibly be gigantic).

But it seems like the right choice when we see this conflict is not "don't do filters for streaming checkin", but rather "don't do streaming checkin when filters are in use" (because streaming is an optimization, and filters are about correctness).

It would be even nicer if filters could play well with bulk checkin, but I think that would involve streaming to a tempfile, checking the size of the file, and then streaming that into an object. Which is better than putting the whole thing in memory if it would involve swapping, but probably worse than doing so if you can possibly fit the whole thing in (because you're doing a ton of extra I/O for the tempfile).

Thoughts? Was this intentional, or just overlooked?
-Peff
Next: Junio C Hamano
Message 1 of 19 in “[BUG?] bulk checkin does not respect filters”
  1. Jeff KingFeb 24, 2012
  2. Junio C HamanoFeb 24, 2012
  3. Junio C HamanoFeb 24, 2012
  4. Jeff KingFeb 24, 2012
  5. Junio C HamanoFeb 24, 2012
  6. Jeff KingFeb 24, 2012
  7. Jeff KingFeb 24, 2012
  8. 1/2 teach convert_to_git a "dry run" modeJeff King, Feb 24, 2012
  9. 2/2 do not stream large files to pack when filters are in useJeff King, Feb 24, 2012
  10. Junio C HamanoFeb 24, 2012
  11. Jeff KingFeb 24, 2012
  12. Jeff KingFeb 24, 2012
  13. Junio C HamanoFeb 24, 2012
  14. Jeff KingFeb 24, 2012
  15. 1/3 teach convert_to_git a "dry run" modeJeff King, Feb 24, 2012
  16. 2/3 teach dry-run convert_to_git not to require a src bufferJeff King, Feb 24, 2012
  17. 3/3 do not stream large files to pack when filters are in useJeff King, Feb 24, 2012
  18. Junio C HamanoFeb 24, 2012
  19. Junio C HamanoFeb 24, 2012

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.