[PATCH v2 1/1] ui_plain: automatically lookup mimetype when mimetype-file is set
Ferry Huberts
mailings at hupie.com
Tue Jul 19 11:29:04 CEST 2011
On 07/19/2011 11:29 AM, larsh at hjemli.net wrote:
> On Tue, Jul 19, 2011 at 10:51:58AM +0200, Ferry Huberts wrote:
>> From: Ferry Huberts <ferry.huberts at pelagic.nl>
>>
>> For sites that do not want to configure mime types by hand but
>> still want the correct mime type for 'plain' blobs, configuring
>> a mime type file is made possible. This is handy since such a
>> file is normally already provided (at least on Linux systems).
>>
>> Also, this reflects the gitweb option '$mimetypes_file'
>>
>> Signed-off-by: Ferry Huberts <ferry.huberts at pelagic.nl>
>
> Thanks. I've merged this to my wip branch with the following fixup to
> avoid random free()'s:
thanks.
the fixup is much appreciated :-)
can you push out your tree into the public cgit repo today?
can we also use a newer git version please?
>
> diff --git a/ui-plain.c b/ui-plain.c
> index 50476f4..7fecc32 100644
> --- a/ui-plain.c
> +++ b/ui-plain.c
> @@ -75,8 +75,8 @@ static void print_object(const unsigned char *sha1, const char *path)
> }
> ctx.page.mimetype = NULL;
> ext = strrchr(path, '.');
> + freemime = 0;
> if (ext && *(++ext)) {
> - freemime = 0;
> mime = string_list_lookup(&ctx.cfg.mimetypes, ext);
> if (mime) {
> ctx.page.mimetype = (char *)mime->util;
>
> --
> larsh
--
Ferry Huberts
More information about the CGit
mailing list