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

Re: [PATCH 4/4] Add 'filter' attribute and external filter driver definition.

From
DLDavid Lang <david.lang@digitalinsight.com>
Date
Apr 22, 2007, 01:33 UTC
Message-ID
<Pine.LNX.4.63.0704211821560.5655@qynat.qvtvafvgr.pbz>
In-Reply-To
<11771520591703-git-send-email-junkio@cox.net>
On Sat, 21 Apr 2007, Junio C Hamano wrote:
Show 20 quoted lines
> The interface is similar to the custom low-level merge drivers.
>
> First you configure your filter driver by defining 'filter.<name>.*'
> variables in the configuration.
>
> 	filter.<name>.clean	filter command to run upon checkin
> 	filter.<name>.smudge	filter command to run upon checkout
>
> Then you assign filter attribute to each path, whose name
> matches the custom filter driver's name.
>
> Example:
>
> 	(in .gitattributes)
> 	*.c	filter=indent
>
> 	(in config)
> 	[filter "indent"]
> 		clean = indent
> 		smudge = cat
hmm, three things come to mind here
1. it would be useful in many cases for the filter program to know what file 
it's working on (and probably some other things), so there are probably some 
command-line arguments that should be able to be passed to the filter.
2. should this be done as a modification of the in-memory buffer (s this patch 
does it?) or should it be done at the time of the read/write, makeing the filter 
be responsible for actually doing the disk I/O, which would give it the benifit 
of being able to do things like set permissions and other things that can't be 
done until the file is actually on the filesystem (for something managing config 
files, this could include restarting the daemon related to the config file for 
example)
3. why specify seperate clean/smudge programs instead of just one script with a 
read/write parameter? I suspect that in most cases the external filter program 
that cleans files will be the same one that smudges them. the clean/smudge 
version does let you specify vastly different things without requireing a 
wrapper script around them, but it would mean duplicating the line when they are 
the same.

the first two items seem fairly important to me, but the third is a niceity that I could live with as-is.

David Lang
Previous: Shawn O. PearceNext: Junio C Hamano
Message 9 of 22 in “External 'filter' attributes and drivers”
  1. 0/4 External 'filter' attributes and driversJunio C Hamano, Apr 21, 2007
  2. 1/4 Simplify calling of CR/LF conversion routinesJunio C Hamano, Apr 21, 2007
  3. 2/4 convert.c: restructure the attribute checking part.Junio C Hamano, Apr 21, 2007
  4. 3/4 lockfile: record the primary process.Junio C Hamano, Apr 21, 2007
  5. 4/4 Add 'filter' attribute and external filter driver definition.Junio C Hamano, Apr 21, 2007
  6. Shawn O. PearceApr 22, 2007
  7. Junio C HamanoApr 22, 2007
  8. Shawn O. PearceApr 22, 2007
  9. David LangApr 22, 2007
  10. Junio C HamanoApr 22, 2007
  11. David LangApr 22, 2007
  12. David LangApr 22, 2007
  13. Junio C HamanoApr 22, 2007
  14. David LangApr 22, 2007
  15. Nicolas PitreApr 22, 2007
  16. David LangApr 22, 2007
  17. Linus TorvaldsApr 22, 2007
  18. Junio C HamanoApr 22, 2007
  19. Alex RiesenApr 21, 2007
  20. David LangApr 22, 2007
  21. Shawn O. PearceApr 22, 2007
  22. David LangApr 22, 2007

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.