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

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 = 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?
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 17 in “git-cvsserver and binary files”
  1. Andy ParkinsFeb 22, 2007
  2. Added "-kb" to all the entries lines sent to the clientAndy Parkins, Feb 22, 2007
  3. Junio C HamanoFeb 22, 2007
  4. cvsserver: Make always-binary mode a config file optionAndy Parkins, Feb 27, 2007
  5. Martin LanghoffFeb 28, 2007
  6. Andy ParkinsFeb 28, 2007
  7. Martin LanghoffFeb 28, 2007
  8. Andy ParkinsMar 1, 2007
  9. Martin LanghoffMar 1, 2007
  10. Andy ParkinsMar 1, 2007
  11. Junio C HamanoMar 1, 2007
  12. Junio C HamanoMar 1, 2007
  13. Junio C HamanoMar 1, 2007
  14. Andy ParkinsMar 1, 2007
  15. Karl HasselströmMar 1, 2007
  16. cvsserver: Make always-binary mode a config file optionAndy Parkins, Feb 27, 2007
  17. Junio C HamanoFeb 27, 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.