Re: [PATCH] cvsserver: Make always-binary mode a config file option
- From
Junio C Hamano <junkio@cox.net>
- Date
- Mar 1, 2007, 10:04 UTC
- Message-ID
- <7vr6s9th4f.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <7vk5y1uwhg.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
Show 9 quoted lines
> 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 = crlfwe 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 restwhile 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 = crlfOne 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 %sand 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?