git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <junkio@cox.net>
Subject: Re: [PATCH 1/2] pathattr: path based configuration of various attributes.
Date: Thu, 1 Mar 2007 09:11:54 +0000	[thread overview]
Message-ID: <200703010911.56048.andyparkins@gmail.com> (raw)
In-Reply-To: <7vps7txwie.fsf@assigned-by-dhcp.cox.net>

On Thursday 2007 March 01 07:18, Junio C Hamano wrote:

> 	[pathattr "text/plain"]
>         	conv_i = crlf
> 		path = "*.txt"
>                 path = "*.c"
>                 path = "*.h"

Can I suggest that "crlf" is not the right name for something like this?  What 
you actually want is to say

 conv_i = convert_from_local_lineendings
 conv_o = convert_to_local_lineendings

(Obviously I'm not really suggesting such long names).  "crlf" implies that 
you want to convert to crlf endings /whatever/ the local line ending.  Given 
that exactly the same .gitattributes would be in use on both windows and 
linux for the same repository, it's got to be an attribute name that makes 
sense in both cases.  How about:

 conv_i = eol_to_lf
 conv_o = eol_to_local

I'm not sure about "conv" either.  "filter" would be more accurate.

 infilter = eol_to_lf
 outfilter = eol_to_local

--- Wild rantings start here, ignore at will ---

Also; for things like Ted's example of OpenDocument files, you might want

 infilter = gunzip
 outfilter = gzip

Then of course, order has to be significant:

 infilter = gunzip eol_to_lf
 outfilter = eol_to_local gzip

(That's probably a crazy thing to want to do, but it would make git 
spectacularly impressive).  Here's another idea, what about making the 
filters configurable, with some builtin (and overridable)

[infilter "perfectpatch"]
  exec = hooks/perfectpatch

[infilter "codingstandards"]
  exec = scripts/check-for-spaces-in-the-wrong-place

[pathattr "text/c"]
  infilter = perfectpatch
  path = *.cc
  path = *.cpp
  path = *.c
  path = *.C
  path = *.h

We could also support a prettyfilter for getting your display example from 
patch 2/2 in the right place.

[prettyfilter]
  exec = display -

[pathattr "image/"]
  prettyfilter = rundisplay
  path = *.png

Which would be equally good for fixing line endings for display; prettyfilter 
could, I suppose, default to be the same as outfilter, which would be correct 
in most cases.

[pathattr "text/c"]
  prettyfilter = eol_to_local

Sorry for the long rambling email, it's very exciting this attribute stuff.  I 
already love it.



Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com

  reply	other threads:[~2007-03-01  9:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-01  7:18 [PATCH 1/2] pathattr: path based configuration of various attributes Junio C Hamano
2007-03-01  9:11 ` Andy Parkins [this message]
2007-03-01  9:24   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200703010911.56048.andyparkins@gmail.com \
    --to=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).