Merge branch 'jk/ui-color-always-to-auto-maint' into jk/ui-color-always-to-auto
authorJunio C Hamano <gitster@pobox.com>
Wed, 4 Oct 2017 03:03:05 +0000 (12:03 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Oct 2017 03:04:47 +0000 (12:04 +0900)
* jk/ui-color-always-to-auto-maint:
color: make "always" the same as "auto" in config
provide --color option for all ref-filter users
t3205: use --color instead of color.branch=always
t3203: drop "always" color test
t6006: drop "always" color config tests
t7502: use diff.noprefix for --verbose test
t7508: use test_terminal for color output
t3701: use test-terminal to collect color output
t4015: prefer --color to -c color.diff=always
test-terminal: set TERM=vt100

1  2 
Documentation/config.txt
Documentation/git-for-each-ref.txt
Documentation/git-tag.txt
builtin/tag.c
color.c
t/t4015-diff-whitespace.sh
t/t4202-log.sh
t/t7004-tag.sh
t/t7006-pager.sh
t/t7301-clean-interactive.sh
t/t7508-status.sh
diff --combined Documentation/config.txt
index 1ac0ae6adb0460a3460084aef2302434e24ee6de,cb0f951ddc4e8cada6889f6eeba0373af1da3104..b53c994d0a9f41da483aa22f66c7e308044eda1e
@@@ -216,15 -216,15 +216,15 @@@ boolean:
         synonyms are accepted for 'true' and 'false'; these are all
         case-insensitive.
  
 -       true;; Boolean true can be spelled as `yes`, `on`, `true`,
 -              or `1`.  Also, a variable defined without `= <value>`
 +      true;; Boolean true literals are `yes`, `on`, `true`,
 +              and `1`.  Also, a variable defined without `= <value>`
                is taken as true.
  
 -       false;; Boolean false can be spelled as `no`, `off`,
 -              `false`, or `0`.
 +      false;; Boolean false literals are `no`, `off`, `false`,
 +              `0` and the empty string.
  +
  When converting value to the canonical form using `--bool` type
 -specifier; 'git config' will ensure that the output is "true" or
 +specifier, 'git config' will ensure that the output is "true" or
  "false" (spelled in lowercase).
  
  integer::
@@@ -776,12 -776,6 +776,12 @@@ core.commentChar:
  If set to "auto", `git-commit` would select a character that is not
  the beginning character of any line in existing commit messages.
  
 +core.filesRefLockTimeout::
 +      The length of time, in milliseconds, to retry when trying to
 +      lock an individual reference. Value 0 means not to retry at
 +      all; -1 means to try indefinitely. Default is 100 (i.e.,
 +      retry for 100ms).
 +
  core.packedRefsTimeout::
        The length of time, in milliseconds, to retry when trying to
        lock the `packed-refs` file. Value 0 means not to retry at
@@@ -1058,10 -1052,10 +1058,10 @@@ clean.requireForce:
  
  color.branch::
        A boolean to enable/disable color in the output of
-       linkgit:git-branch[1]. May be set to `always`,
-       `false` (or `never`) or `auto` (or `true`), in which case colors are used
-       only when the output is to a terminal. If unset, then the
-       value of `color.ui` is used (`auto` by default).
+       linkgit:git-branch[1]. May be set to `false` (or `never`) to
+       disable color entirely, `auto` (or `true` or `always`) in which
+       case colors are used only when the output is to a terminal.  If
+       unset, then the value of `color.ui` is used (`auto` by default).
  
  color.branch.<slot>::
        Use customized color for branch coloration. `<slot>` is one of
  
  color.diff::
        Whether to use ANSI escape sequences to add color to patches.
-       If this is set to `always`, linkgit:git-diff[1],
+       If this is set to `true` or `auto`, linkgit:git-diff[1],
        linkgit:git-log[1], and linkgit:git-show[1] will use color
-       for all patches.  If it is set to `true` or `auto`, those
-       commands will only use color when output is to the terminal.
-       If unset, then the value of `color.ui` is used (`auto` by
-       default).
+       when output is to the terminal. The value `always` is a
+       historical synonym for `auto`.  If unset, then the value of
+       `color.ui` is used (`auto` by default).
  +
  This does not affect linkgit:git-format-patch[1] or the
  'git-diff-{asterisk}' plumbing commands.  Can be overridden on the
  command line with the `--color[=<when>]` option.
  
 +diff.colorMoved::
 +      If set to either a valid `<mode>` or a true value, moved lines
 +      in a diff are colored differently, for details of valid modes
 +      see '--color-moved' in linkgit:git-diff[1]. If simply set to
 +      true the default color mode will be used. When set to false,
 +      moved lines are not colored.
 +
  color.diff.<slot>::
        Use customized color for diff colorization.  `<slot>` specifies
        which part of the patch to use the specified color, and is one
        of `context` (context text - `plain` is a historical synonym),
        `meta` (metainformation), `frag`
        (hunk header), 'func' (function in hunk header), `old` (removed lines),
 -      `new` (added lines), `commit` (commit headers), or `whitespace`
 -      (highlighting whitespace errors).
 +      `new` (added lines), `commit` (commit headers), `whitespace`
 +      (highlighting whitespace errors), `oldMoved` (deleted lines),
 +      `newMoved` (added lines), `oldMovedDimmed`, `oldMovedAlternative`,
 +      `oldMovedAlternativeDimmed`, `newMovedDimmed`, `newMovedAlternative`
 +      and `newMovedAlternativeDimmed` (See the '<mode>'
 +      setting of '--color-moved' in linkgit:git-diff[1] for details).
  
  color.decorate.<slot>::
        Use customized color for 'git log --decorate' output.  `<slot>` is one
@@@ -1141,12 -1123,12 +1140,12 @@@ color.grep.<slot>:
  --
  
  color.interactive::
-       When set to `always`, always use colors for interactive prompts
+       When set to `true` or `auto`, use colors for interactive prompts
        and displays (such as those used by "git-add --interactive" and
-       "git-clean --interactive"). When false (or `never`), never.
-       When set to `true` or `auto`, use colors only when the output is
-       to the terminal. If unset, then the value of `color.ui` is
-       used (`auto` by default).
+       "git-clean --interactive") when the output is to the terminal.
+       When false (or `never`), never show colors. The value `always`
+       is a historical synonym for `auto`.  If unset, then the value of
+       `color.ui` is used (`auto` by default).
  
  color.interactive.<slot>::
        Use customized color for 'git add --interactive' and 'git clean
@@@ -1193,10 -1175,10 +1192,10 @@@ color.ui:
        configuration to set a default for the `--color` option.  Set it
        to `false` or `never` if you prefer Git commands not to use
        color unless enabled explicitly with some other configuration
-       or the `--color` option. Set it to `always` if you want all
-       output not intended for machine consumption to use color, to
-       `true` or `auto` (this is the default since Git 1.8.4) if you
-       want such output to use color when written to the terminal.
+       or the `--color` option. Set it to `true` or `auto` to enable
+       color when output is written to the terminal (this is also the
+       default since Git 1.8.4). The value `always` is a historical
+       synonym for `auto`.
  
  column.ui::
        Specify whether supported commands should output in columns.
@@@ -1570,13 -1552,11 +1569,13 @@@ gc.<pattern>.reflogExpireUnreachable:
  gc.rerereResolved::
        Records of conflicted merge you resolved earlier are
        kept for this many days when 'git rerere gc' is run.
 +      You can also use more human-readable "1.month.ago", etc.
        The default is 60 days.  See linkgit:git-rerere[1].
  
  gc.rerereUnresolved::
        Records of conflicted merge you have not resolved are
        kept for this many days when 'git rerere gc' is run.
 +      You can also use more human-readable "1.month.ago", etc.
        The default is 15 days.  See linkgit:git-rerere[1].
  
  gitcvs.commitMsgAnnotation::
@@@ -2931,8 -2911,8 +2930,8 @@@ sendemail.smtpsslcertpath:
  
  sendemail.<identity>.*::
        Identity-specific versions of the 'sendemail.*' parameters
 -      found below, taking precedence over those when the this
 -      identity is selected, through command-line or
 +      found below, taking precedence over those when this
 +      identity is selected, through either the command-line or
        `sendemail.identity`.
  
  sendemail.aliasesFile::
@@@ -3085,14 -3065,10 +3084,14 @@@ submodule.<name>.url:
        See linkgit:git-submodule[1] and linkgit:gitmodules[5] for details.
  
  submodule.<name>.update::
 -      The default update procedure for a submodule. This variable
 -      is populated by `git submodule init` from the
 -      linkgit:gitmodules[5] file. See description of 'update'
 -      command in linkgit:git-submodule[1].
 +      The method by which a submodule is updated by 'git submodule update',
 +      which is the only affected command, others such as
 +      'git checkout --recurse-submodules' are unaffected. It exists for
 +      historical reasons, when 'git submodule' was the only command to
 +      interact with submodules; settings like `submodule.active`
 +      and `pull.rebase` are more specific. It is populated by
 +      `git submodule init` from the linkgit:gitmodules[5] file.
 +      See description of 'update' command in linkgit:git-submodule[1].
  
  submodule.<name>.branch::
        The remote branch name for a submodule, used by `git submodule
index 66b4e0a4050655e7fab27a6fe72af03d6c99f3b2,b92ebd0cd9820da235967cab937a3ff31d02a187..cbd0a6212a62a618252e7b56397239d4066dcbd7
@@@ -10,9 -10,8 +10,9 @@@ SYNOPSI
  [verse]
  'git for-each-ref' [--count=<count>] [--shell|--perl|--python|--tcl]
                   [(--sort=<key>)...] [--format=<format>] [<pattern>...]
 -                 [--points-at <object>] [(--merged | --no-merged) [<object>]]
 -                 [--contains [<object>]] [--no-contains [<object>]]
 +                 [--points-at=<object>]
 +                 (--merged[=<object>] | --no-merged[=<object>])
 +                 [--contains[=<object>]] [--no-contains[=<object>]]
  
  DESCRIPTION
  -----------
@@@ -26,37 -25,41 +26,42 @@@ host language allowing their direct eva
  
  OPTIONS
  -------
 -<count>::
 +<pattern>...::
 +      If one or more patterns are given, only refs are shown that
 +      match against at least one pattern, either using fnmatch(3) or
 +      literally, in the latter case matching completely or from the
 +      beginning up to a slash.
 +
 +--count=<count>::
        By default the command shows all refs that match
        `<pattern>`.  This option makes it stop after showing
        that many refs.
  
 -<key>::
 +--sort=<key>::
        A field name to sort on.  Prefix `-` to sort in
        descending order of the value.  When unspecified,
        `refname` is used.  You may use the --sort=<key> option
        multiple times, in which case the last key becomes the primary
        key.
  
 -<format>::
 -      A string that interpolates `%(fieldname)` from the
 -      object pointed at by a ref being shown.  If `fieldname`
 +--format=<format>::
 +      A string that interpolates `%(fieldname)` from a ref being shown
 +      and the object it points at.  If `fieldname`
        is prefixed with an asterisk (`*`) and the ref points
 -      at a tag object, the value for the field in the object
 -      tag refers is used.  When unspecified, defaults to
 +      at a tag object, use the value for the field in the object
 +      which the tag object refers to (instead of the field in the tag object).
 +      When unspecified, `<format>` defaults to
        `%(objectname) SPC %(objecttype) TAB %(refname)`.
        It also interpolates `%%` to `%`, and `%xx` where `xx`
        are hex digits interpolates to character with hex code
        `xx`; for example `%00` interpolates to `\0` (NUL),
        `%09` to `\t` (TAB) and `%0a` to `\n` (LF).
  
 -<pattern>...::
 -      If one or more patterns are given, only refs are shown that
 -      match against at least one pattern, either using fnmatch(3) or
 -      literally, in the latter case matching completely or from the
 -      beginning up to a slash.
 -
+ --color[=<when>]:
+       Respect any colors specified in the `--format` option. The
+       `<when>` field must be one of `always`, `never`, or `auto` (if
+       `<when>` is absent, behave as if `always` was given).
  --shell::
  --perl::
  --python::
        the specified host language.  This is meant to produce
        a scriptlet that can directly be `eval`ed.
  
 ---points-at <object>::
 +--points-at=<object>::
        Only list refs which points at the given object.
  
 ---merged [<object>]::
 +--merged[=<object>]::
        Only list refs whose tips are reachable from the
        specified commit (HEAD if not specified),
        incompatible with `--no-merged`.
  
 ---no-merged [<object>]::
 +--no-merged[=<object>]::
        Only list refs whose tips are not reachable from the
        specified commit (HEAD if not specified),
        incompatible with `--merged`.
  
 ---contains [<object>]::
 +--contains[=<object>]::
        Only list refs which contain the specified commit (HEAD if not
        specified).
  
 ---no-contains [<object>]::
 +--no-contains[=<object>]::
        Only list refs which don't contain the specified commit (HEAD
        if not specified).
  
index 95e9f391d88fc434df6bc3f0483c9b3c80983021,a1399a78a0694545ca1d9ce2e7f787717c2e1b09..956fc019f984bca1754a72dc0d7308b39a28445d
@@@ -115,6 -115,11 +115,11 @@@ options for details
        variable if it exists, or lexicographic order otherwise. See
        linkgit:git-config[1].
  
+ --color[=<when>]:
+       Respect any colors specified in the `--format` option. The
+       `<when>` field must be one of `always`, `never`, or `auto` (if
+       `<when>` is absent, behave as if `always` was given).
  -i::
  --ignore-case::
        Sorting and filtering tags are case insensitive.
@@@ -174,7 -179,7 +179,7 @@@ This option is only applicable when lis
        `core.logAllRefUpdates` in linkgit:git-config[1].
        The negated form `--no-create-reflog` only overrides an earlier
        `--create-reflog`, but currently does not negate the setting of
 -      `core.logallrefupdates`.
 +      `core.logAllRefUpdates`.
  
  <tagname>::
        The name of the tag to create, delete, or describe.
        Defaults to HEAD.
  
  <format>::
 -      A string that interpolates `%(fieldname)` from the object
 -      pointed at by a ref being shown.  The format is the same as
 +      A string that interpolates `%(fieldname)` from a tag ref being shown
 +      and the object it points at.  The format is the same as
        that of linkgit:git-for-each-ref[1].  When unspecified,
        defaults to `%(refname:strip=2)`.
  
@@@ -205,9 -210,6 +210,9 @@@ it in the repository configuration as f
      signingKey = <gpg-keyid>
  -------------------------------------
  
 +`pager.tag` is only respected when listing tags, i.e., when `-l` is
 +used or implied. The default is to use a pager.
 +See linkgit:git-config[1].
  
  DISCUSSION
  ----------
diff --combined builtin/tag.c
index c627794181f55d293719e5369d74bb9b598f5450,b9d1a13af57ad8ad84ecafb86bac8c03901463c3..12dbbc56d93f296f09a0f640127311bdeb8c8800
@@@ -113,7 -113,7 +113,7 @@@ static int verify_tag(const char *name
        if (format->format)
                flags = GPG_VERIFY_OMIT_STATUS;
  
 -      if (gpg_verify_tag(oid->hash, name, flags))
 +      if (gpg_verify_tag(oid, name, flags))
                return -1;
  
        if (format->format)
@@@ -411,6 -411,7 +411,7 @@@ int cmd_tag(int argc, const char **argv
                },
                OPT_STRING(  0 , "format", &format.format, N_("format"),
                           N_("format to use for the output")),
+               OPT__COLOR(&format.use_color, N_("respect format colors")),
                OPT_BOOL('i', "ignore-case", &icase, N_("sorting and filtering are case insensitive")),
                OPT_END()
        };
                        cmdmode = 'l';
        }
  
 +      if (cmdmode == 'l')
 +              setup_auto_pager("tag", 1);
 +
        if ((create_tag_object || force) && (cmdmode != 0))
                usage_with_options(git_tag_usage, options);
  
diff --combined color.c
index 9ccd954d6ba5cea1dd275cac23bb19966b9c6386,17e2713f9678fab24d06d0b14db4d73806f3c3cc..9c0dc823701d6aff0979659cd19ebb9c92f2eb8a
+++ b/color.c
@@@ -308,7 -308,7 +308,7 @@@ int git_config_colorbool(const char *va
                if (!strcasecmp(value, "never"))
                        return 0;
                if (!strcasecmp(value, "always"))
-                       return 1;
+                       return var ? GIT_COLOR_AUTO : 1;
                if (!strcasecmp(value, "auto"))
                        return GIT_COLOR_AUTO;
        }
@@@ -338,13 -338,6 +338,13 @@@ static int check_auto_color(void
  
  int want_color(int var)
  {
 +      /*
 +       * NEEDSWORK: This function is sometimes used from multiple threads, and
 +       * we end up using want_auto racily. That "should not matter" since
 +       * we always write the same value, but it's still wrong. This function
 +       * is listed in .tsan-suppressions for the time being.
 +       */
 +
        static int want_auto = -1;
  
        if (var < 0)
index a1b68f5a6f1fc2f250dde9f03be3b6c99604c2e2,94597ff284da22ac55f0bfd6bc00434e5df7d40b..3bca958863e68783105b542765930ebd7518b49b
@@@ -802,6 -802,7 +802,6 @@@ test_expect_success 'combined diff wit
  # Start testing the colored format for whitespace checks
  
  test_expect_success 'setup diff colors' '
 -      git config color.diff always &&
        git config color.diff.plain normal &&
        git config color.diff.meta bold &&
        git config color.diff.frag cyan &&
@@@ -820,7 -821,7 +820,7 @@@ test_expect_success 'diff that introduc
        echo "test" >x &&
        git commit -m "initial" x &&
        echo "{NTN}" | tr "NT" "\n\t" >>x &&
-       git -c color.diff=always diff | test_decode_color >current &&
+       git diff --color | test_decode_color >current &&
  
        cat >expected <<-\EOF &&
        <BOLD>diff --git a/x b/x<RESET>
@@@ -850,7 -851,7 +850,7 @@@ test_expect_success 'diff that introduc
                echo "2. and a new line "
        } >x &&
  
-       git -c color.diff=always diff |
+       git diff --color |
        test_decode_color >current &&
  
        cat >expected <<-\EOF &&
@@@ -922,15 -923,15 +922,15 @@@ test_expect_success 'ws-error-highligh
  
  test_expect_success 'test --ws-error-highlight option' '
  
-       git -c color.diff=always diff --ws-error-highlight=default,old |
+       git diff --color --ws-error-highlight=default,old |
        test_decode_color >current &&
        test_cmp expect.default-old current &&
  
-       git -c color.diff=always diff --ws-error-highlight=all |
+       git diff --color --ws-error-highlight=all |
        test_decode_color >current &&
        test_cmp expect.all current &&
  
-       git -c color.diff=always diff --ws-error-highlight=none |
+       git diff --color --ws-error-highlight=none |
        test_decode_color >current &&
        test_cmp expect.none current
  
  
  test_expect_success 'test diff.wsErrorHighlight config' '
  
-       git -c color.diff=always -c diff.wsErrorHighlight=default,old diff |
+       git -c diff.wsErrorHighlight=default,old diff --color |
        test_decode_color >current &&
        test_cmp expect.default-old current &&
  
-       git -c color.diff=always -c diff.wsErrorHighlight=all diff |
+       git -c diff.wsErrorHighlight=all diff --color |
        test_decode_color >current &&
        test_cmp expect.all current &&
  
-       git -c color.diff=always -c diff.wsErrorHighlight=none diff |
+       git -c diff.wsErrorHighlight=none diff --color |
        test_decode_color >current &&
        test_cmp expect.none current
  
  
  test_expect_success 'option overrides diff.wsErrorHighlight' '
  
-       git -c color.diff=always -c diff.wsErrorHighlight=none \
-               diff --ws-error-highlight=default,old |
+       git -c diff.wsErrorHighlight=none \
+               diff --color --ws-error-highlight=default,old |
        test_decode_color >current &&
        test_cmp expect.default-old current &&
  
-       git -c color.diff=always -c diff.wsErrorHighlight=default \
-               diff --ws-error-highlight=all |
+       git -c diff.wsErrorHighlight=default \
+               diff --color --ws-error-highlight=all |
        test_decode_color >current &&
        test_cmp expect.all current &&
  
-       git -c color.diff=always -c diff.wsErrorHighlight=all \
-               diff --ws-error-highlight=none |
+       git -c diff.wsErrorHighlight=all \
+               diff --color --ws-error-highlight=none |
        test_decode_color >current &&
        test_cmp expect.none current
  
  '
  
 +test_expect_success 'detect moved code, complete file' '
 +      git reset --hard &&
 +      cat <<-\EOF >test.c &&
 +      #include<stdio.h>
 +      main()
 +      {
 +      printf("Hello World");
 +      }
 +      EOF
 +      git add test.c &&
 +      git commit -m "add main function" &&
 +      git mv test.c main.c &&
 +      test_config color.diff.oldMoved "normal red" &&
 +      test_config color.diff.newMoved "normal green" &&
 +      git diff HEAD --color-moved=zebra --color --no-renames | test_decode_color >actual &&
 +      cat >expected <<-\EOF &&
 +      <BOLD>diff --git a/main.c b/main.c<RESET>
 +      <BOLD>new file mode 100644<RESET>
 +      <BOLD>index 0000000..a986c57<RESET>
 +      <BOLD>--- /dev/null<RESET>
 +      <BOLD>+++ b/main.c<RESET>
 +      <CYAN>@@ -0,0 +1,5 @@<RESET>
 +      <BGREEN>+<RESET><BGREEN>#include<stdio.h><RESET>
 +      <BGREEN>+<RESET><BGREEN>main()<RESET>
 +      <BGREEN>+<RESET><BGREEN>{<RESET>
 +      <BGREEN>+<RESET><BGREEN>printf("Hello World");<RESET>
 +      <BGREEN>+<RESET><BGREEN>}<RESET>
 +      <BOLD>diff --git a/test.c b/test.c<RESET>
 +      <BOLD>deleted file mode 100644<RESET>
 +      <BOLD>index a986c57..0000000<RESET>
 +      <BOLD>--- a/test.c<RESET>
 +      <BOLD>+++ /dev/null<RESET>
 +      <CYAN>@@ -1,5 +0,0 @@<RESET>
 +      <BRED>-#include<stdio.h><RESET>
 +      <BRED>-main()<RESET>
 +      <BRED>-{<RESET>
 +      <BRED>-printf("Hello World");<RESET>
 +      <BRED>-}<RESET>
 +      EOF
 +
 +      test_cmp expected actual
 +'
 +
 +test_expect_success 'detect malicious moved code, inside file' '
 +      test_config color.diff.oldMoved "normal red" &&
 +      test_config color.diff.newMoved "normal green" &&
 +      test_config color.diff.oldMovedAlternative "blue" &&
 +      test_config color.diff.newMovedAlternative "yellow" &&
 +      git reset --hard &&
 +      cat <<-\EOF >main.c &&
 +              #include<stdio.h>
 +              int stuff()
 +              {
 +                      printf("Hello ");
 +                      printf("World\n");
 +              }
 +
 +              int secure_foo(struct user *u)
 +              {
 +                      if (!u->is_allowed_foo)
 +                              return;
 +                      foo(u);
 +              }
 +
 +              int main()
 +              {
 +                      foo();
 +              }
 +      EOF
 +      cat <<-\EOF >test.c &&
 +              #include<stdio.h>
 +              int bar()
 +              {
 +                      printf("Hello World, but different\n");
 +              }
 +
 +              int another_function()
 +              {
 +                      bar();
 +              }
 +      EOF
 +      git add main.c test.c &&
 +      git commit -m "add main and test file" &&
 +      cat <<-\EOF >main.c &&
 +              #include<stdio.h>
 +              int stuff()
 +              {
 +                      printf("Hello ");
 +                      printf("World\n");
 +              }
 +
 +              int main()
 +              {
 +                      foo();
 +              }
 +      EOF
 +      cat <<-\EOF >test.c &&
 +              #include<stdio.h>
 +              int bar()
 +              {
 +                      printf("Hello World, but different\n");
 +              }
 +
 +              int secure_foo(struct user *u)
 +              {
 +                      foo(u);
 +                      if (!u->is_allowed_foo)
 +                              return;
 +              }
 +
 +              int another_function()
 +              {
 +                      bar();
 +              }
 +      EOF
 +      git diff HEAD --no-renames --color-moved=zebra --color | test_decode_color >actual &&
 +      cat <<-\EOF >expected &&
 +      <BOLD>diff --git a/main.c b/main.c<RESET>
 +      <BOLD>index 27a619c..7cf9336 100644<RESET>
 +      <BOLD>--- a/main.c<RESET>
 +      <BOLD>+++ b/main.c<RESET>
 +      <CYAN>@@ -5,13 +5,6 @@<RESET> <RESET>printf("Hello ");<RESET>
 +       printf("World\n");<RESET>
 +       }<RESET>
 +       <RESET>
 +      <BRED>-int secure_foo(struct user *u)<RESET>
 +      <BRED>-{<RESET>
 +      <BLUE>-if (!u->is_allowed_foo)<RESET>
 +      <BLUE>-return;<RESET>
 +      <RED>-foo(u);<RESET>
 +      <RED>-}<RESET>
 +      <RED>-<RESET>
 +       int main()<RESET>
 +       {<RESET>
 +       foo();<RESET>
 +      <BOLD>diff --git a/test.c b/test.c<RESET>
 +      <BOLD>index 1dc1d85..2bedec9 100644<RESET>
 +      <BOLD>--- a/test.c<RESET>
 +      <BOLD>+++ b/test.c<RESET>
 +      <CYAN>@@ -4,6 +4,13 @@<RESET> <RESET>int bar()<RESET>
 +       printf("Hello World, but different\n");<RESET>
 +       }<RESET>
 +       <RESET>
 +      <BGREEN>+<RESET><BGREEN>int secure_foo(struct user *u)<RESET>
 +      <BGREEN>+<RESET><BGREEN>{<RESET>
 +      <GREEN>+<RESET><GREEN>foo(u);<RESET>
 +      <BGREEN>+<RESET><BGREEN>if (!u->is_allowed_foo)<RESET>
 +      <BGREEN>+<RESET><BGREEN>return;<RESET>
 +      <GREEN>+<RESET><GREEN>}<RESET>
 +      <GREEN>+<RESET>
 +       int another_function()<RESET>
 +       {<RESET>
 +       bar();<RESET>
 +      EOF
 +
 +      test_cmp expected actual
 +'
 +
 +test_expect_success 'plain moved code, inside file' '
 +      test_config color.diff.oldMoved "normal red" &&
 +      test_config color.diff.newMoved "normal green" &&
 +      test_config color.diff.oldMovedAlternative "blue" &&
 +      test_config color.diff.newMovedAlternative "yellow" &&
 +      # needs previous test as setup
 +      git diff HEAD --no-renames --color-moved=plain --color | test_decode_color >actual &&
 +      cat <<-\EOF >expected &&
 +      <BOLD>diff --git a/main.c b/main.c<RESET>
 +      <BOLD>index 27a619c..7cf9336 100644<RESET>
 +      <BOLD>--- a/main.c<RESET>
 +      <BOLD>+++ b/main.c<RESET>
 +      <CYAN>@@ -5,13 +5,6 @@<RESET> <RESET>printf("Hello ");<RESET>
 +       printf("World\n");<RESET>
 +       }<RESET>
 +       <RESET>
 +      <BRED>-int secure_foo(struct user *u)<RESET>
 +      <BRED>-{<RESET>
 +      <BRED>-if (!u->is_allowed_foo)<RESET>
 +      <BRED>-return;<RESET>
 +      <BRED>-foo(u);<RESET>
 +      <BRED>-}<RESET>
 +      <BRED>-<RESET>
 +       int main()<RESET>
 +       {<RESET>
 +       foo();<RESET>
 +      <BOLD>diff --git a/test.c b/test.c<RESET>
 +      <BOLD>index 1dc1d85..2bedec9 100644<RESET>
 +      <BOLD>--- a/test.c<RESET>
 +      <BOLD>+++ b/test.c<RESET>
 +      <CYAN>@@ -4,6 +4,13 @@<RESET> <RESET>int bar()<RESET>
 +       printf("Hello World, but different\n");<RESET>
 +       }<RESET>
 +       <RESET>
 +      <BGREEN>+<RESET><BGREEN>int secure_foo(struct user *u)<RESET>
 +      <BGREEN>+<RESET><BGREEN>{<RESET>
 +      <BGREEN>+<RESET><BGREEN>foo(u);<RESET>
 +      <BGREEN>+<RESET><BGREEN>if (!u->is_allowed_foo)<RESET>
 +      <BGREEN>+<RESET><BGREEN>return;<RESET>
 +      <BGREEN>+<RESET><BGREEN>}<RESET>
 +      <BGREEN>+<RESET>
 +       int another_function()<RESET>
 +       {<RESET>
 +       bar();<RESET>
 +      EOF
 +
 +      test_cmp expected actual
 +'
 +
 +test_expect_success 'detect permutations inside moved code -- dimmed_zebra' '
 +      git reset --hard &&
 +      cat <<-\EOF >lines.txt &&
 +              long line 1
 +              long line 2
 +              long line 3
 +              line 4
 +              line 5
 +              line 6
 +              line 7
 +              line 8
 +              line 9
 +              line 10
 +              line 11
 +              line 12
 +              line 13
 +              long line 14
 +              long line 15
 +              long line 16
 +      EOF
 +      git add lines.txt &&
 +      git commit -m "add poetry" &&
 +      cat <<-\EOF >lines.txt &&
 +              line 4
 +              line 5
 +              line 6
 +              line 7
 +              line 8
 +              line 9
 +              long line 1
 +              long line 2
 +              long line 3
 +              long line 14
 +              long line 15
 +              long line 16
 +              line 10
 +              line 11
 +              line 12
 +              line 13
 +      EOF
 +      test_config color.diff.oldMoved "magenta" &&
 +      test_config color.diff.newMoved "cyan" &&
 +      test_config color.diff.oldMovedAlternative "blue" &&
 +      test_config color.diff.newMovedAlternative "yellow" &&
 +      test_config color.diff.oldMovedDimmed "normal magenta" &&
 +      test_config color.diff.newMovedDimmed "normal cyan" &&
 +      test_config color.diff.oldMovedAlternativeDimmed "normal blue" &&
 +      test_config color.diff.newMovedAlternativeDimmed "normal yellow" &&
 +      git diff HEAD --no-renames --color-moved=dimmed_zebra --color |
 +              grep -v "index" |
 +              test_decode_color >actual &&
 +      cat <<-\EOF >expected &&
 +      <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
 +      <BOLD>--- a/lines.txt<RESET>
 +      <BOLD>+++ b/lines.txt<RESET>
 +      <CYAN>@@ -1,16 +1,16 @@<RESET>
 +      <BMAGENTA>-long line 1<RESET>
 +      <BMAGENTA>-long line 2<RESET>
 +      <BMAGENTA>-long line 3<RESET>
 +       line 4<RESET>
 +       line 5<RESET>
 +       line 6<RESET>
 +       line 7<RESET>
 +       line 8<RESET>
 +       line 9<RESET>
 +      <BCYAN>+<RESET><BCYAN>long line 1<RESET>
 +      <BCYAN>+<RESET><BCYAN>long line 2<RESET>
 +      <CYAN>+<RESET><CYAN>long line 3<RESET>
 +      <YELLOW>+<RESET><YELLOW>long line 14<RESET>
 +      <BYELLOW>+<RESET><BYELLOW>long line 15<RESET>
 +      <BYELLOW>+<RESET><BYELLOW>long line 16<RESET>
 +       line 10<RESET>
 +       line 11<RESET>
 +       line 12<RESET>
 +       line 13<RESET>
 +      <BMAGENTA>-long line 14<RESET>
 +      <BMAGENTA>-long line 15<RESET>
 +      <BMAGENTA>-long line 16<RESET>
 +      EOF
 +      test_cmp expected actual
 +'
 +
 +test_expect_success 'cmd option assumes configured colored-moved' '
 +      test_config color.diff.oldMoved "magenta" &&
 +      test_config color.diff.newMoved "cyan" &&
 +      test_config color.diff.oldMovedAlternative "blue" &&
 +      test_config color.diff.newMovedAlternative "yellow" &&
 +      test_config color.diff.oldMovedDimmed "normal magenta" &&
 +      test_config color.diff.newMovedDimmed "normal cyan" &&
 +      test_config color.diff.oldMovedAlternativeDimmed "normal blue" &&
 +      test_config color.diff.newMovedAlternativeDimmed "normal yellow" &&
 +      test_config diff.colorMoved zebra &&
 +      git diff HEAD --no-renames --color-moved --color |
 +              grep -v "index" |
 +              test_decode_color >actual &&
 +      cat <<-\EOF >expected &&
 +      <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
 +      <BOLD>--- a/lines.txt<RESET>
 +      <BOLD>+++ b/lines.txt<RESET>
 +      <CYAN>@@ -1,16 +1,16 @@<RESET>
 +      <MAGENTA>-long line 1<RESET>
 +      <MAGENTA>-long line 2<RESET>
 +      <MAGENTA>-long line 3<RESET>
 +       line 4<RESET>
 +       line 5<RESET>
 +       line 6<RESET>
 +       line 7<RESET>
 +       line 8<RESET>
 +       line 9<RESET>
 +      <CYAN>+<RESET><CYAN>long line 1<RESET>
 +      <CYAN>+<RESET><CYAN>long line 2<RESET>
 +      <CYAN>+<RESET><CYAN>long line 3<RESET>
 +      <YELLOW>+<RESET><YELLOW>long line 14<RESET>
 +      <YELLOW>+<RESET><YELLOW>long line 15<RESET>
 +      <YELLOW>+<RESET><YELLOW>long line 16<RESET>
 +       line 10<RESET>
 +       line 11<RESET>
 +       line 12<RESET>
 +       line 13<RESET>
 +      <MAGENTA>-long line 14<RESET>
 +      <MAGENTA>-long line 15<RESET>
 +      <MAGENTA>-long line 16<RESET>
 +      EOF
 +      test_cmp expected actual
 +'
 +
 +test_expect_success 'no effect from --color-moved with --word-diff' '
 +      cat <<-\EOF >text.txt &&
 +      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
 +      EOF
 +      git add text.txt &&
 +      git commit -a -m "clean state" &&
 +      cat <<-\EOF >text.txt &&
 +      simply Lorem Ipsum dummy is text of the typesetting and printing industry.
 +      EOF
 +      git diff --color-moved --word-diff >actual &&
 +      git diff --word-diff >expect &&
 +      test_cmp expect actual
 +'
 +
 +test_expect_success 'move detection ignoring whitespace ' '
 +      git reset --hard &&
 +      cat <<\EOF >lines.txt &&
 +line 1
 +line 2
 +line 3
 +line 4
 +long line 5
 +long line 6
 +long line 7
 +EOF
 +      git add lines.txt &&
 +      git commit -m "add poetry" &&
 +      cat <<\EOF >lines.txt &&
 +      long line 5
 +      long line 6
 +      long line 7
 +line 1
 +line 2
 +line 3
 +line 4
 +EOF
 +      test_config color.diff.oldMoved "magenta" &&
 +      test_config color.diff.newMoved "cyan" &&
 +      git diff HEAD --no-renames --color-moved --color |
 +              grep -v "index" |
 +              test_decode_color >actual &&
 +      cat <<-\EOF >expected &&
 +      <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
 +      <BOLD>--- a/lines.txt<RESET>
 +      <BOLD>+++ b/lines.txt<RESET>
 +      <CYAN>@@ -1,7 +1,7 @@<RESET>
 +      <GREEN>+<RESET> <GREEN>long line 5<RESET>
 +      <GREEN>+<RESET> <GREEN>long line 6<RESET>
 +      <GREEN>+<RESET> <GREEN>long line 7<RESET>
 +       line 1<RESET>
 +       line 2<RESET>
 +       line 3<RESET>
 +       line 4<RESET>
 +      <RED>-long line 5<RESET>
 +      <RED>-long line 6<RESET>
 +      <RED>-long line 7<RESET>
 +      EOF
 +      test_cmp expected actual &&
 +
 +      git diff HEAD --no-renames -w --color-moved --color |
 +              grep -v "index" |
 +              test_decode_color >actual &&
 +      cat <<-\EOF >expected &&
 +      <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
 +      <BOLD>--- a/lines.txt<RESET>
 +      <BOLD>+++ b/lines.txt<RESET>
 +      <CYAN>@@ -1,7 +1,7 @@<RESET>
 +      <CYAN>+<RESET>  <CYAN>long line 5<RESET>
 +      <CYAN>+<RESET>  <CYAN>long line 6<RESET>
 +      <CYAN>+<RESET>  <CYAN>long line 7<RESET>
 +       line 1<RESET>
 +       line 2<RESET>
 +       line 3<RESET>
 +       line 4<RESET>
 +      <MAGENTA>-long line 5<RESET>
 +      <MAGENTA>-long line 6<RESET>
 +      <MAGENTA>-long line 7<RESET>
 +      EOF
 +      test_cmp expected actual
 +'
 +
 +test_expect_success '--color-moved block at end of diff output respects MIN_ALNUM_COUNT' '
 +      git reset --hard &&
 +      >bar &&
 +      cat <<-\EOF >foo &&
 +      irrelevant_line
 +      line1
 +      EOF
 +      git add foo bar &&
 +      git commit -m x &&
 +
 +      cat <<-\EOF >bar &&
 +      line1
 +      EOF
 +      cat <<-\EOF >foo &&
 +      irrelevant_line
 +      EOF
 +
 +      git diff HEAD --color-moved=zebra --color --no-renames |
 +              grep -v "index" |
 +              test_decode_color >actual &&
 +      cat >expected <<-\EOF &&
 +      <BOLD>diff --git a/bar b/bar<RESET>
 +      <BOLD>--- a/bar<RESET>
 +      <BOLD>+++ b/bar<RESET>
 +      <CYAN>@@ -0,0 +1 @@<RESET>
 +      <GREEN>+<RESET><GREEN>line1<RESET>
 +      <BOLD>diff --git a/foo b/foo<RESET>
 +      <BOLD>--- a/foo<RESET>
 +      <BOLD>+++ b/foo<RESET>
 +      <CYAN>@@ -1,2 +1 @@<RESET>
 +       irrelevant_line<RESET>
 +      <RED>-line1<RESET>
 +      EOF
 +
 +      test_cmp expected actual
 +'
 +
 +test_expect_success '--color-moved respects MIN_ALNUM_COUNT' '
 +      git reset --hard &&
 +      cat <<-\EOF >foo &&
 +      nineteen chars 456789
 +      irrelevant_line
 +      twenty chars 234567890
 +      EOF
 +      >bar &&
 +      git add foo bar &&
 +      git commit -m x &&
 +
 +      cat <<-\EOF >foo &&
 +      irrelevant_line
 +      EOF
 +      cat <<-\EOF >bar &&
 +      twenty chars 234567890
 +      nineteen chars 456789
 +      EOF
 +
 +      git diff HEAD --color-moved=zebra --color --no-renames |
 +              grep -v "index" |
 +              test_decode_color >actual &&
 +      cat >expected <<-\EOF &&
 +      <BOLD>diff --git a/bar b/bar<RESET>
 +      <BOLD>--- a/bar<RESET>
 +      <BOLD>+++ b/bar<RESET>
 +      <CYAN>@@ -0,0 +1,2 @@<RESET>
 +      <BOLD;CYAN>+<RESET><BOLD;CYAN>twenty chars 234567890<RESET>
 +      <GREEN>+<RESET><GREEN>nineteen chars 456789<RESET>
 +      <BOLD>diff --git a/foo b/foo<RESET>
 +      <BOLD>--- a/foo<RESET>
 +      <BOLD>+++ b/foo<RESET>
 +      <CYAN>@@ -1,3 +1 @@<RESET>
 +      <RED>-nineteen chars 456789<RESET>
 +       irrelevant_line<RESET>
 +      <BOLD;MAGENTA>-twenty chars 234567890<RESET>
 +      EOF
 +
 +      test_cmp expected actual
 +'
 +
 +test_expect_success '--color-moved treats adjacent blocks as separate for MIN_ALNUM_COUNT' '
 +      git reset --hard &&
 +      cat <<-\EOF >foo &&
 +      7charsA
 +      irrelevant_line
 +      7charsB
 +      7charsC
 +      EOF
 +      >bar &&
 +      git add foo bar &&
 +      git commit -m x &&
 +
 +      cat <<-\EOF >foo &&
 +      irrelevant_line
 +      EOF
 +      cat <<-\EOF >bar &&
 +      7charsB
 +      7charsC
 +      7charsA
 +      EOF
 +
 +      git diff HEAD --color-moved=zebra --color --no-renames | grep -v "index" | test_decode_color >actual &&
 +      cat >expected <<-\EOF &&
 +      <BOLD>diff --git a/bar b/bar<RESET>
 +      <BOLD>--- a/bar<RESET>
 +      <BOLD>+++ b/bar<RESET>
 +      <CYAN>@@ -0,0 +1,3 @@<RESET>
 +      <GREEN>+<RESET><GREEN>7charsB<RESET>
 +      <GREEN>+<RESET><GREEN>7charsC<RESET>
 +      <GREEN>+<RESET><GREEN>7charsA<RESET>
 +      <BOLD>diff --git a/foo b/foo<RESET>
 +      <BOLD>--- a/foo<RESET>
 +      <BOLD>+++ b/foo<RESET>
 +      <CYAN>@@ -1,4 +1 @@<RESET>
 +      <RED>-7charsA<RESET>
 +       irrelevant_line<RESET>
 +      <RED>-7charsB<RESET>
 +      <RED>-7charsC<RESET>
 +      EOF
 +
 +      test_cmp expected actual
 +'
 +
 +test_expect_success 'move detection with submodules' '
 +      test_create_repo bananas &&
 +      echo ripe >bananas/recipe &&
 +      git -C bananas add recipe &&
 +      test_commit fruit &&
 +      test_commit -C bananas recipe &&
 +      git submodule add ./bananas &&
 +      git add bananas &&
 +      git commit -a -m "bananas are like a heavy library?" &&
 +      echo foul >bananas/recipe &&
 +      echo ripe >fruit.t &&
 +
 +      git diff --submodule=diff --color-moved --color >actual &&
 +
 +      # no move detection as the moved line is across repository boundaries.
 +      test_decode_color <actual >decoded_actual &&
 +      ! grep BGREEN decoded_actual &&
 +      ! grep BRED decoded_actual &&
 +
 +      # nor did we mess with it another way
 +      git diff --submodule=diff --color | test_decode_color >expect &&
 +      test_cmp expect decoded_actual
 +'
 +
  test_done
diff --combined t/t4202-log.sh
index 36d120c969f6c116c2bed19c8bb0c027919d66a9,62f9d94fa3c25eabe484422c9238a1c6d0de1712..8f155da7a50a657db9fd092e24639f67cd03cd24
@@@ -750,7 -750,7 +750,7 @@@ test_expect_success 'log.decorate confi
  '
  
  test_expect_success TTY 'log output on a TTY' '
-       git log --oneline --decorate >expect.short &&
+       git log --color --oneline --decorate >expect.short &&
  
        test_terminal git log --oneline >actual &&
        test_cmp expect.short actual
@@@ -1523,12 -1523,6 +1523,12 @@@ test_expect_success 'log diagnoses bogu
        test_i18ngrep broken stderr
  '
  
 +test_expect_success 'log does not default to HEAD when rev input is given' '
 +      >expect &&
 +      git log --branches=does-not-exist >actual &&
 +      test_cmp expect actual
 +'
 +
  test_expect_success 'set up --source tests' '
        git checkout --orphan source-a &&
        test_commit one &&
diff --combined t/t7004-tag.sh
index b545c33f83be94608f18182444ffe37eef753e88,f5547371a360bf819e3a5f29973bd7a2896f62f6..4e62c505fc9ce84adf4b0f74110b39d18c571670
@@@ -1863,6 -1863,13 +1863,6 @@@ test_expect_success 'version sort with 
        git tag -l --sort=version:refname
  '
  
 -run_with_limited_stack () {
 -      (ulimit -s 128 && "$@")
 -}
 -
 -test_lazy_prereq ULIMIT_STACK_SIZE 'run_with_limited_stack true'
 -
 -# we require ulimit, this excludes Windows
  test_expect_success ULIMIT_STACK_SIZE '--contains and --no-contains work in a deep repo' '
        >expect &&
        i=1 &&
@@@ -1881,7 -1888,7 +1881,7 @@@ EOF
        run_with_limited_stack git tag --contains HEAD >actual &&
        test_cmp expect actual &&
        run_with_limited_stack git tag --no-contains HEAD >actual &&
 -      test_line_count ">" 10 actual
 +      test_line_count "-gt" 10 actual
  '
  
  test_expect_success '--format should list tags as per format given' '
@@@ -1907,13 -1914,13 +1907,13 @@@ test_expect_success '%(color) omitted w
  '
  
  test_expect_success TTY '%(color) present with tty' '
-       test_terminal env TERM=vt100 git tag $color_args >actual.raw &&
+       test_terminal git tag $color_args >actual.raw &&
        test_decode_color <actual.raw >actual &&
        test_cmp expect.color actual
  '
  
- test_expect_success 'color.ui=always overrides auto-color' '
-       git -c color.ui=always tag $color_args >actual.raw &&
+ test_expect_success '--color overrides auto-color' '
+       git tag --color $color_args >actual.raw &&
        test_decode_color <actual.raw >actual &&
        test_cmp expect.color actual
  '
diff --combined t/t7006-pager.sh
index 9128ec5acda3b4b2f568dee50169046a333c4527,20caa3f0956adced544058933497ba868de3c297..f0f1abd1c23d4303a686310d7325cd523d6c921b
@@@ -134,86 -134,6 +134,86 @@@ test_expect_success TTY 'configuration 
        }
  '
  
 +test_expect_success TTY 'git tag -l defaults to paging' '
 +      rm -f paginated.out &&
 +      test_terminal git tag -l &&
 +      test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag -l respects pager.tag' '
 +      rm -f paginated.out &&
 +      test_terminal git -c pager.tag=false tag -l &&
 +      ! test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag -l respects --no-pager' '
 +      rm -f paginated.out &&
 +      test_terminal git -c pager.tag --no-pager tag -l &&
 +      ! test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag with no args defaults to paging' '
 +      # no args implies -l so this should page like -l
 +      rm -f paginated.out &&
 +      test_terminal git tag &&
 +      test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag with no args respects pager.tag' '
 +      # no args implies -l so this should page like -l
 +      rm -f paginated.out &&
 +      test_terminal git -c pager.tag=false tag &&
 +      ! test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag --contains defaults to paging' '
 +      # --contains implies -l so this should page like -l
 +      rm -f paginated.out &&
 +      test_terminal git tag --contains &&
 +      test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag --contains respects pager.tag' '
 +      # --contains implies -l so this should page like -l
 +      rm -f paginated.out &&
 +      test_terminal git -c pager.tag=false tag --contains &&
 +      ! test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag -a defaults to not paging' '
 +      test_when_finished "git tag -d newtag" &&
 +      rm -f paginated.out &&
 +      test_terminal git tag -am message newtag &&
 +      ! test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag -a ignores pager.tag' '
 +      test_when_finished "git tag -d newtag" &&
 +      rm -f paginated.out &&
 +      test_terminal git -c pager.tag tag -am message newtag &&
 +      ! test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag -a respects --paginate' '
 +      test_when_finished "git tag -d newtag" &&
 +      rm -f paginated.out &&
 +      test_terminal git --paginate tag -am message newtag &&
 +      test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag as alias ignores pager.tag with -a' '
 +      test_when_finished "git tag -d newtag" &&
 +      rm -f paginated.out &&
 +      test_terminal git -c pager.tag -c alias.t=tag t -am message newtag &&
 +      ! test -e paginated.out
 +'
 +
 +test_expect_success TTY 'git tag as alias respects pager.tag with -l' '
 +      rm -f paginated.out &&
 +      test_terminal git -c pager.tag=false -c alias.t=tag t -l &&
 +      ! test -e paginated.out
 +'
 +
  # A colored commit log will begin with an appropriate ANSI escape
  # for the first color; the text "commit" comes later.
  colorful() {
@@@ -239,7 -159,7 +239,7 @@@ test_expect_success 'no color when stdo
  test_expect_success TTY 'color when writing to a pager' '
        rm -f paginated.out &&
        test_config color.ui auto &&
-       test_terminal env TERM=vt100 git log &&
+       test_terminal git log &&
        colorful paginated.out
  '
  
@@@ -247,7 -167,7 +247,7 @@@ test_expect_success TTY 'colors are sup
        rm -f paginated.out &&
        test_config color.ui auto &&
        test_config color.pager false &&
-       test_terminal env TERM=vt100 git log &&
+       test_terminal git log &&
        ! colorful paginated.out
  '
  
@@@ -266,7 -186,7 +266,7 @@@ test_expect_success 'color when writin
  test_expect_success TTY 'colors are sent to pager for external commands' '
        test_config alias.externallog "!git log" &&
        test_config color.ui auto &&
-       test_terminal env TERM=vt100 git -p externallog &&
+       test_terminal git -p externallog &&
        colorful paginated.out
  '
  
index 39212dccd290957194e992883c070f31cd7d9999,3ae394e934d972d29286ecd25596eedd45bee902..1bf9789c8a3cfbb1cc8a6ea33e4a0b1a0da0a7cd
@@@ -3,7 -3,6 +3,7 @@@
  test_description='git clean -i basic tests'
  
  . ./test-lib.sh
 +. "$TEST_DIRECTORY"/lib-terminal.sh
  
  test_expect_success 'setup' '
  
@@@ -473,14 -472,4 +473,14 @@@ test_expect_success 'git clean -id wit
  
  '
  
-       test_terminal env TERM=vt100 git clean -i |
 +test_expect_success TTY 'git clean -i paints the header in HEADER color' '
 +      >a.out &&
 +      echo q |
++      test_terminal git clean -i |
 +      test_decode_color |
 +      head -n 1 >header &&
 +      # not i18ngrep
 +      grep "^<BOLD>" header
 +'
 +
  test_done
diff --combined t/t7508-status.sh
index 93f162a4f78cf9c54b12309a62f6a89b2ce4ddbb,a3d760e63ad5c8387c3b0c0a30ae72918a2736ce..50052e28727dab74037a115003b6083256d7f344
@@@ -6,6 -6,7 +6,7 @@@
  test_description='git status'
  
  . ./test-lib.sh
+ . "$TEST_DIRECTORY"/lib-terminal.sh
  
  test_expect_success 'status -h in broken repository' '
        git config --global advice.statusuoption false &&
@@@ -667,7 -668,7 +668,7 @@@ test_expect_success 'setup unique color
  
  '
  
- test_expect_success 'status with color.ui' '
+ test_expect_success TTY 'status with color.ui' '
        cat >expect <<\EOF &&
  On branch <GREEN>master<RESET>
  Your branch and '\''upstream'\'' have diverged,
@@@ -694,14 -695,14 +695,14 @@@ Untracked files
        <BLUE>untracked<RESET>
  
  EOF
-       test_config color.ui always &&
-       git status | test_decode_color >output &&
+       test_config color.ui auto &&
+       test_terminal git status | test_decode_color >output &&
        test_i18ncmp expect output
  '
  
- test_expect_success 'status with color.status' '
-       test_config color.status always &&
-       git status | test_decode_color >output &&
+ test_expect_success TTY 'status with color.status' '
+       test_config color.status auto &&
+       test_terminal git status | test_decode_color >output &&
        test_i18ncmp expect output
  '
  
@@@ -714,19 -715,19 +715,19 @@@ cat >expect <<\EO
  <BLUE>??<RESET> untracked
  EOF
  
- test_expect_success 'status -s with color.ui' '
+ test_expect_success TTY 'status -s with color.ui' '
  
-       git config color.ui always &&
-       git status -s | test_decode_color >output &&
+       git config color.ui auto &&
+       test_terminal git status -s | test_decode_color >output &&
        test_cmp expect output
  
  '
  
- test_expect_success 'status -s with color.status' '
+ test_expect_success TTY 'status -s with color.status' '
  
        git config --unset color.ui &&
-       git config color.status always &&
-       git status -s | test_decode_color >output &&
+       git config color.status auto &&
+       test_terminal git status -s | test_decode_color >output &&
        test_cmp expect output
  
  '
@@@ -741,9 -742,9 +742,9 @@@ cat >expect <<\EO
  <BLUE>??<RESET> untracked
  EOF
  
- test_expect_success 'status -s -b with color.status' '
+ test_expect_success TTY 'status -s -b with color.status' '
  
-       git status -s -b | test_decode_color >output &&
+       test_terminal git status -s -b | test_decode_color >output &&
        test_i18ncmp expect output
  
  '
@@@ -757,20 -758,20 +758,20 @@@ A  dir2/adde
  ?? untracked
  EOF
  
- test_expect_success 'status --porcelain ignores color.ui' '
+ test_expect_success TTY 'status --porcelain ignores color.ui' '
  
        git config --unset color.status &&
-       git config color.ui always &&
-       git status --porcelain | test_decode_color >output &&
+       git config color.ui auto &&
+       test_terminal git status --porcelain | test_decode_color >output &&
        test_cmp expect output
  
  '
  
- test_expect_success 'status --porcelain ignores color.status' '
+ test_expect_success TTY 'status --porcelain ignores color.status' '
  
        git config --unset color.ui &&
-       git config color.status always &&
-       git status --porcelain | test_decode_color >output &&
+       git config color.status auto &&
+       test_terminal git status --porcelain | test_decode_color >output &&
        test_cmp expect output
  
  '
@@@ -1670,14 -1671,4 +1671,14 @@@ test_expect_success '"Initial commit" s
        test_i18ngrep ! "Initial commit" output
  '
  
 +test_expect_success '--no-optional-locks prevents index update' '
 +      test-chmtime =1234567890 .git/index &&
 +      git --no-optional-locks status &&
 +      test-chmtime -v +0 .git/index >out &&
 +      grep ^1234567890 out &&
 +      git status &&
 +      test-chmtime -v +0 .git/index >out &&
 +      ! grep ^1234567890 out
 +'
 +
  test_done