[PATCH v2 0/2] test-lib.sh: do tests for color support after changing HOME
- From
- Richard Hansen <rhansen@bbn.com>
- Date
- Jan 6, 2015, 22:57 UTC
- Message-ID
- <1420585071-28973-1-git-send-email-rhansen@bbn.com>
- In-Reply-To
- <xmqq8uhfpw3s.fsf@gitster.dls.corp.google.com>
On 2015-01-06T11:06-08:00, Junio C Hamano wrote:
Show 23 quoted lines
>> +unset color
>> while test "$#" -ne 0
>> do
>> case "$1" in
>> @@ -258,40 +250,6 @@ then
>> verbose=t
>> fi
>>
>> -if test -n "$color"
>> ...
>> @@ -857,6 +815,52 @@ HOME="$TRASH_DIRECTORY"
>> GNUPGHOME="$HOME/gnupg-home-not-used"
>> export HOME GNUPGHOME
>>
>> +# run the tput tests *after* changing HOME (in case ncurses needs
>> +# ~/.terminfo for $TERM)
>> +test -n "${color+set}" || [ "x$ORIGINAL_TERM" != "xdumb" ] && (
>
> OK, $color used to be boolean between '' (unset included) and 't',
> but now we do this after possibly processing the --no-color
> argument, so this is guarded slightly differently from the original.
>
> Makes sense.I updated the commit message to make this change more obvious.
> This is a tangent but this patch shows 2 places out of the only > three places we use [ ... ] construct (as opposed to a more > traditionalist "test"). Perhaps we may want to fix them with a > follow-up patch?
I added a prequel patch to address this.
Thank you for taking a look, Richard
Richard Hansen (2): use 'test ...' instead of '[ ... ]' test-lib.sh: do tests for color support after changing HOME
t/test-lib.sh | 92 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 44 deletions(-)
-- 2.2.1