Commit Graph

5 Commits

Author SHA1 Message Date
Pierre-Yves David
9b05154b04 color: turn 'ui.color' into a boolean (auto or off)
Previously, 'ui.color=yes' meant "always show color", While
"ui.color=auto" meant "use color automatically when it appears
sensible".

This feels problematic to some people because if an administrator has
disabled color with "ui.color=off", and a user turn it back  on using
"color=on", it will get surprised (because it breaks their output when
redirected to a file.) This patch changes ui.color=true to only move the
default value of --color from "never" to "auto".

I'm not really in favor of this changes as I suspect the above case will
be pretty rare and I would rather keep the logic simpler. However, I'm
providing this patch to help the 4.2 release in the case were others
decide to make this changes.

Users that want to force colors without specifying --color on the
command line can use the 'ui.formatted' config knob, which had to be
enabled in a handful of tests for this patch.

Nice summary table (credit: Augie Fackler)

That is, before this patch:

+--------------------+--------------------+--------------------+
|                    | not a tty          | a tty              |
|                    | --color not set    | --color not set    |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color (not set)    | no color           | no color           |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = auto       | no color           | color              |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = yes        | *color*            | color              |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = no         | no color           | no color           |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
(if --color is specified, it always clobbers the setting in [ui])

and after this patch:

+--------------------+--------------------+--------------------+
|                    | not a tty          | a tty              |
|                    | --color not set    | --color not set    |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color (not set)    | no color           | no color           |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = auto       | no color           | color              |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = yes        | *no color*         | color              |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = no         | no color           | no color           |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
(if --color is specified, it always clobbers the setting in [ui])
2017-05-02 20:01:54 +02:00
Pierre-Yves David
1a7077c9d6 color: turn on by default (but for windows)
Color support is all in core for a couple of months. I've browsed the bug tracker
without finding any blocker bug. So I'm moving forward and enable color on by
default before '4.2-rc'. In the worse case, having it on in the release
candidate will help us to find blocker bug and we can turn it off for the final
release.

I remember people talking about issue with Windows during the freeze so I'm
keeping it off by default on that OS.

We could do various cleaning of the color used and the label issued.  However
the label are probably already in our backward compatibility envelope since the
color extensions has been around since for ever and I do not think the color
choice themself should be considered BC. So I think we should rather gives color
to all user sooner than later.

A couple of test needs to be updated to avoid having color related control code
spoil the tested output.
2017-04-16 02:32:51 +02:00
Pierre-Yves David
54ba19fe49 pager: stop using the color extension in tests
The feature is in core so let us use the core config knob directly.
2017-04-16 02:48:06 +02:00
Martin von Zweigbergk
d32ca3644f pager: if old pager extensions is enabled, respect pager.attend
This patch makes us respect pager.attend again if the extension is
enabled. It also brings back the default attend list, so e.g. summary
is not paged by default, just like it used to be before pager was
moved into core.
2017-03-13 21:43:17 -07:00
Martin von Zweigbergk
ee1e520bcd tests: duplicate test for pager for old extension and for in-core pager
When the old pager extension is enabled, I think we should try to be
as BC as reasonable. To help with that, this patch brings back
test-pager.t as of 45ff5bf9e9c2 (pager: add a test of --pager=no
functionality, 2017-02-06), but under the name test-pager-legacy.t
However, since the behavior has changed in a few cases (notably by no
longer respecting pager.attend), the file is modified to work with the
current version. We will recover some lost BC in coming patches.

Also, to make sure the in-core pager does not depend on the pager
extension being enabled, this patch disables the extension in
test-pager.t. It turns out that pager.attend-$cmd was only supported
when the pager extension was enabled, so the tests are updated to
reflect that. We will need to decide what to do with these.
2017-03-13 21:42:59 -07:00