]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/ref-filter-colors'
authorJunio C Hamano <gitster@pobox.com>
Fri, 11 Aug 2017 20:26:58 +0000 (13:26 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 11 Aug 2017 20:26:58 +0000 (13:26 -0700)
"%C(color name)" in the pretty print format always produced ANSI
color escape codes, which was an early design mistake.  They now
honor the configuration (e.g. "color.ui = never") and also tty-ness
of the output medium.

* jk/ref-filter-colors:
  ref-filter: consult want_color() before emitting colors
  pretty: respect color settings for %C placeholders
  rev-list: pass diffopt->use_colors through to pretty-print
  for-each-ref: load config earlier
  color: check color.ui in git_default_config()
  ref-filter: pass ref_format struct to atom parsers
  ref-filter: factor out the parsing of sorting atoms
  ref-filter: make parse_ref_filter_atom a private function
  ref-filter: provide a function for parsing sort options
  ref-filter: move need_color_reset_at_eol into ref_format
  ref-filter: abstract ref format into its own struct
  ref-filter: simplify automatic color reset
  t: use test_decode_color rather than literal ANSI codes
  docs/for-each-ref: update pointer to color syntax
  check return value of verify_ref_format()

1  2 
builtin/grep.c
builtin/show-branch.c
builtin/tag.c
builtin/verify-tag.c
config.c
t/test-lib-functions.sh

diff --cc builtin/grep.c
Simple merge
Simple merge
diff --cc builtin/tag.c
index b25bf8daa289d75af023fd5f14034eccdb2a9d37,66e35b823b6e0a3e732fb84e402dd0af6830a471..e8a30e6110f9782d72a4fd2592bd82af9842ef19
@@@ -105,17 -107,17 +107,17 @@@ static int verify_tag(const char *name
                      const struct object_id *oid, const void *cb_data)
  {
        int flags;
-       const char *fmt_pretty = cb_data;
+       const struct ref_format *format = cb_data;
        flags = GPG_VERIFY_VERBOSE;
  
-       if (fmt_pretty)
+       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 (fmt_pretty)
-               pretty_print_ref(name, oid->hash, fmt_pretty);
+       if (format->format)
+               pretty_print_ref(name, oid->hash, format);
  
        return 0;
  }
index ed8329340f73482c18b295a2733fcb11c4198859,87d73e856a13e4abaa67ee8cad3e520f1bd9f779..ad7b79fa5cd718daf3be5f1a46a1fbb2bed41ad5
@@@ -69,8 -70,8 +71,8 @@@ int cmd_verify_tag(int argc, const cha
                        continue;
                }
  
-               if (fmt_pretty)
-                       pretty_print_ref(name, oid.hash, fmt_pretty);
+               if (format.format)
 -                      pretty_print_ref(name, sha1, &format);
++                      pretty_print_ref(name, oid.hash, &format);
        }
        return had_error;
  }
diff --cc config.c
Simple merge
Simple merge