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

Re: gitattributes - clean filter invoked on pull?

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Apr 11, 2011, 09:50 UTC
Message-ID
<4DA2CED1.6070107@drmicha.warpmail.net>
In-Reply-To
<20110411091919.GE28959@kytes>
Ramkumar Ramachandra venit, vidit, dixit 11.04.2011 11:19:
Show 23 quoted lines
> Hi Miklos,
> 
> Miklos Vajna writes:
>> Background: We at LibreOffice are trying to use the 'filter'
>> gitattributes feature to clean up line wrappings in po files.
>>
>> The problem is that it seems the clean filter - which is supposed to be
>> invoked only in case a new blob is created - is invoked even on
>> clone/pull, and other developers are claiming that it slows down their
>> workflow.
>>
>> Is this a bug? I don't exactly understand why this would be necessary.
> 
> From config.txt:
> - 'clean' is "The command which is used to convert the content of a
> worktree file to a blob upon checkin".
> - 'smudge' is "The command which is used to convert the content of a
> blob object to a worktree file upon checkout."
> 
> According to the documentation, 'smudge' is *supposed* to be invoked
> on a clone/ pull, since it involves a checkout.  I don't see how you
> can avoid running these filters on every checkin/ checkout unless you
> cache the result somewhere.

Exactly that is why it's surprising that the clean filter is invoked on pull - clean is about checking in, pull only checks out.

If you run your script with GIT_TRACE=1 you see that the two last clean invocations come from merge and gc. They go away when you do a fetch only.

Note that with clean/smudge, a check "worktree == repo" requires a conversion of "worktree" to what would be checked in, and that uses "clean". That's why it's invoked not only for "commit".

But maybe there is a better solution for your actual use case? Do you want to ignore line wrap or normalise it?

Michael
Previous: Johannes SixtNext: Miklos Vajna
Message 6 of 10 in “gitattributes - clean filter invoked on pull?”
  1. Miklos VajnaApr 11, 2011
  2. Ramkumar RamachandraApr 11, 2011
  3. Miklos VajnaApr 11, 2011
  4. Ramkumar RamachandraApr 11, 2011
  5. Johannes SixtApr 11, 2011
  6. Michael J GruberApr 11, 2011
  7. Miklos VajnaApr 11, 2011
  8. Michael J GruberApr 11, 2011
  9. Miklos VajnaApr 11, 2011
  10. Dmitry PotapovApr 11, 2011

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.