git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Andy Parkins <andyparkins@gmail.com>
Cc: git@vger.kernel.org, "Martin Langhoff" <martin.langhoff@gmail.com>
Subject: Re: [PATCH] cvsserver: Make always-binary mode a config file option
Date: Thu, 01 Mar 2007 02:04:00 -0800	[thread overview]
Message-ID: <7vr6s9th4f.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vk5y1uwhg.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Thu, 01 Mar 2007 01:46:51 -0800")

Junio C Hamano <junkio@cox.net> writes:

> Andy Parkins <andyparkins@gmail.com> writes:
>
>> Erm, yes, I know that.  But who is going to set that switch?
>> This isn't real CVS where the repository records that
>> information.  At the moment git does not know whether any
>> given file is binary or text.
>
> What do you think I have been hacking around pathattr stuff
> today for ;-)? 

A bit more clarification.  Although I won't be hacking on it
anymore since it is almost my bedtime,...

I think the 4 patch series I sent out tonight was fun but
slightly misdesigned.  I should have made the classification of
paths and actions on them separate sections.  That is, instead
of saying:

	[pathattr "a/v"]
        	path = "*.mpg"
                path = "*.mp3"
                path = "*.jpg"
		conv_i = none
                conv_o = none
	[pathattr "text"]
        	path = "*" ; all the rest
                conv_i = crlf
                conv_o = crlf

we should make two kinds of configuration.  Classification of
paths is property of the project and does not depend on where
the user uses the paths from the project:

	[pathattr "a/v"]
        	path = "*.mpg"
                path = "*.mp3"
                path = "*.jpg"
	[pathattr "text"]
        	path = "*" ; all the rest

while how they are handled can be platform dependent.  On UNIX,
you might have this in $HOME/.gitconfig:

	[handler "a/v"]
        	pretty = "cmd xine %s" ; nb. there is no 'cmd' yet...
	[handler "text"]
		pretty = "pipe fmt -"

while on another system, you might have:

	[handler "a/v"]
        	pretty = "cmd mediaplayer %s"
	[handler "text"]
                conv_i = crlf
                conv_o = crlf

One thing to note is that [pathattr "kind"] may need to behave
like existing .gitignore in that they are read from directories,
but [handler "kind"] does not have to.

We probably need to expose pathattr_lookup(path) to scripts, and
cvsserver could use that interface to query.  The interface may
look like this:

	$ git pathattr --lookup porn.mpg
        a/v
        $ git config --get handler.a/v
	cmd xine %s

and kopts_from_path would look like:

	sub kopts_from_path {
        	my ($path) = shift;
                my $kind = `git pathattr $path`;
		my $conv_o = `git config --get "handler.$kind"`

                if ($conv_o eq 'crlf') {
			return '-kb';
		}
		return '';
	}

Hmm?

  reply	other threads:[~2007-03-01 10:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-22 15:04 git-cvsserver and binary files Andy Parkins
2007-02-22 16:06 ` [PATCH] Added "-kb" to all the entries lines sent to the client Andy Parkins
2007-02-22 20:37   ` Junio C Hamano
2007-02-27 13:45     ` [PATCH] cvsserver: Make always-binary mode a config file option Andy Parkins
2007-02-28 11:36       ` Martin Langhoff
2007-02-28 13:01         ` Andy Parkins
2007-02-28 23:40           ` Martin Langhoff
2007-03-01  8:40             ` Andy Parkins
2007-03-01  9:13               ` Martin Langhoff
2007-03-01  9:41                 ` Andy Parkins
2007-03-01  9:46                   ` Junio C Hamano
2007-03-01 10:04                     ` Junio C Hamano [this message]
2007-03-01 11:03                       ` Junio C Hamano
2007-03-01 11:40                         ` Andy Parkins
2007-03-01 11:44                         ` Karl Hasselström
2007-02-27 13:46     ` Andy Parkins
2007-02-27 23:56       ` 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=7vr6s9th4f.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martin.langhoff@gmail.com \
    /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).