Re: [PATCH v2 1/2] test-lib: extend test_decode_color to handle more color codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Oct 20, 2010, at 4:40 PM, Junio C Hamano wrote:

> Kevin Ballard <kevin@xxxxxx> writes:
> 
>> Enhance the test_decode_color function to handle all common color codes,
>> including background colors and escapes that contain multiple codes.
>> This change necessitates changing <WHITE> to <BOLD>, so update t4034
>> as well.
>> 
>> This change is necessary for the next commit in order to test
>> background colors properly.
>> 
>> Signed-off-by: Kevin Ballard <kevin@xxxxxx>
>> ---
>> I turned sed into awk. Looks like awk is already used elsehwere in git,
>> so I'm assuming this is safe, but please let me know if it's not.
> 
> I think calling BOLD BOLD is the right thing to do (who came up with the
> bogus WHITE in the first place anyway---my terminal is black letters on
> white background, thank you).
> 
> Even though some scripts seem to already use awk, they are all used for
> very small and trivial processing without exercising anything remotely
> fancy e.g. hexadecimal \xXX quoting or match() function, so I wouldn't be
> surprised if we see breakage reports from minority platforms.

Entirely possible, but I'm hoping that's not the case. I used this against
BSD awk version 20070501, so there's nothing remotely fancy there, and the
regular expression conforms to the subset of BRE's mentioned in
CodingGuidelines. But as you said, it's possible that minority platforms
don't handle this correctly.

> But I do not think of a trivial way to express combination of attributes
> by extending the existing sed script (we can write loops and do the same
> computation as your awk script does, but it does not reduce the complexity
> nor risk of portability issues), so let's see what happens.  We already
> use Perl everywhere, which we might end up using for this if there are
> platforms that have issues with your awk script.

I considered writing this in Perl, but my complete lack of knowledge of Perl
made that a non-starter. However if there are any problems with the awk
script then I would welcome a Perl rewrite by someone who actually knows the
language.

-Kevin Ballard
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]