[PATCH v2 12/15] ui-tree: render any matching README file in tree view

Andy Green andy at warmcat.com
Tue Jun 19 10:38:10 CEST 2018



On 06/19/2018 04:31 PM, John Keeping wrote:

>>> We can lose a level of indentation here by writing it as:
>>>
>>> 	if (render)
>>> 		...
>>> 	else if (mimetype)
>>> 		...
>>> 	else
>>> 		...
>>
>> OK.  Actually this was a modified cut-n-paste from your patch's
>> implementation in print_object().  So I also changed that code to follow
>> this scheme.
>>
>> 	if (use_render) {
>> 		if (render)
>> 			render_buffer(render, basename, buf, size);
>> 		else
>> 			include_file(path, mimetype);
>> 	} else {
>> 		print_buffer(basename, buf, size);
>> 	}
>>
>> became
>>
>>           if (!use_render)
>>                   print_buffer(basename, buf, size);
>>           else if (render)
>>                   render_buffer(render, basename, buf, size);
>>           else
>>                   include_file(path, mimetype);
> 
> I think the point is that the logic is different, in that this version
> effectively has use_render always true, whereas the version in
> print_object() must allow the caller to disable render/mimetype handling
> even if those variables are non-null.
> 
> It's personal taste, but I think the positive logic is clearer to read.

OK...

-Andy


More information about the CGit mailing list