[PATCH v2 0/9] filter framework and lua support: complete

Jason A. Donenfeld Jason at zx2c4.com
Mon Jan 13 15:00:21 CET 2014

In this second installment I've squashed things down and cleanly separated
the framework commits from the lua commits. It should be much easier to

The weakest part is still the Makefile changes, which might not be very
portable and could probably be more configurable somehow. If anybody would
like to step in and brush this up, that'd be quite nice. You can base commits
off of jd-jk/filter-infra, and I'll fold it into this series.

The other controversial item is the write() hooking. The reason we do this
instead of replacing the html_raw function is that in various places, such
as lines 82 and 83 of ui-patch.c, we use other facilities for writing to
standard out -- either via stdio (which has its own buffering), or via git,
which also has its own buffering. So, it turned out to be safer to hook
libc's write than to try and monkey patch git itself.

Another comment brought up in v1 was adding a filter_lua.c file. I'd like to
keep things fairly compact for now, partially because I like inline and
static functions, and partially because I don't want to create a filter.h.
Right now despite supporting a scripting language, this is pretty lean; I'd
like for it to remain so. At least for now.

Jason A. Donenfeld (6):
  filter: allow for cleanup hook for filter types
  filter: basic write hooking infrastructure
  filter: add lua support
  filter: return on null filter from open and close
  filter: add support for email filter
  filter: add gravatar scripts

John Keeping (3):
  filter: add fprintf_filter function
  filter: add interface layer
  filter: introduce "filter type" prefix

 cgit.c                     |  15 +-
 cgit.h                     |  18 ++-
 cgit.mk                    |  22 ++-
 cgitrc.5.txt               |  56 +++++++
 filter.c                   | 376 ++++++++++++++++++++++++++++++++++++++++++---
 filters/email-gravatar.lua |  25 +++
 filters/email-gravatar.py  |  33 ++++
 shared.c                   |   1 +
 ui-commit.c                |  22 ++-
 ui-log.c                   |   2 +
 ui-refs.c                  |   9 +-
 ui-repolist.c              |   6 +-
 ui-snapshot.c              |  11 +-
 ui-summary.c               |   8 +-
 ui-tag.c                   |   2 +
 15 files changed, 550 insertions(+), 56 deletions(-)
 create mode 100644 filters/email-gravatar.lua
 create mode 100755 filters/email-gravatar.py


More information about the CGit mailing list