Merge branch 'jk/color-parse'
* jk/color-parse: Optimize color_parse_mem expand --pretty=format color options color: make it easier for non-config to parse color specs
This commit is contained in:
12
pretty.c
12
pretty.c
@ -6,6 +6,7 @@
|
||||
#include "string-list.h"
|
||||
#include "mailmap.h"
|
||||
#include "log-tree.h"
|
||||
#include "color.h"
|
||||
|
||||
static char *user_format;
|
||||
|
||||
@ -554,6 +555,17 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
|
||||
/* these are independent of the commit */
|
||||
switch (placeholder[0]) {
|
||||
case 'C':
|
||||
if (placeholder[1] == '(') {
|
||||
const char *end = strchr(placeholder + 2, ')');
|
||||
char color[COLOR_MAXLEN];
|
||||
if (!end)
|
||||
return 0;
|
||||
color_parse_mem(placeholder + 2,
|
||||
end - (placeholder + 2),
|
||||
"--pretty format", color);
|
||||
strbuf_addstr(sb, color);
|
||||
return end - placeholder + 1;
|
||||
}
|
||||
if (!prefixcmp(placeholder + 1, "red")) {
|
||||
strbuf_addstr(sb, "\033[31m");
|
||||
return 4;
|
||||
|
Reference in New Issue
Block a user