|
|
@ -12,16 +12,6 @@ static const char* show_branch_usage[] = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static int showbranch_use_color = -1; |
|
|
|
static int showbranch_use_color = -1; |
|
|
|
static char column_colors[][COLOR_MAXLEN] = { |
|
|
|
|
|
|
|
GIT_COLOR_RED, |
|
|
|
|
|
|
|
GIT_COLOR_GREEN, |
|
|
|
|
|
|
|
GIT_COLOR_YELLOW, |
|
|
|
|
|
|
|
GIT_COLOR_BLUE, |
|
|
|
|
|
|
|
GIT_COLOR_MAGENTA, |
|
|
|
|
|
|
|
GIT_COLOR_CYAN, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define COLUMN_COLORS_MAX (ARRAY_SIZE(column_colors)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int default_num; |
|
|
|
static int default_num; |
|
|
|
static int default_alloc; |
|
|
|
static int default_alloc; |
|
|
@ -37,7 +27,7 @@ static const char **default_arg; |
|
|
|
static const char *get_color_code(int idx) |
|
|
|
static const char *get_color_code(int idx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (showbranch_use_color) |
|
|
|
if (showbranch_use_color) |
|
|
|
return column_colors[idx]; |
|
|
|
return column_colors_ansi[idx % column_colors_ansi_max]; |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -892,7 +882,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) |
|
|
|
for (j = 0; j < i; j++) |
|
|
|
for (j = 0; j < i; j++) |
|
|
|
putchar(' '); |
|
|
|
putchar(' '); |
|
|
|
printf("%s%c%s [%s] ", |
|
|
|
printf("%s%c%s [%s] ", |
|
|
|
get_color_code(i % COLUMN_COLORS_MAX), |
|
|
|
get_color_code(i), |
|
|
|
is_head ? '*' : '!', |
|
|
|
is_head ? '*' : '!', |
|
|
|
get_color_reset_code(), ref_name[i]); |
|
|
|
get_color_reset_code(), ref_name[i]); |
|
|
|
} |
|
|
|
} |
|
|
@ -954,7 +944,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) |
|
|
|
else |
|
|
|
else |
|
|
|
mark = '+'; |
|
|
|
mark = '+'; |
|
|
|
printf("%s%c%s", |
|
|
|
printf("%s%c%s", |
|
|
|
get_color_code(i % COLUMN_COLORS_MAX), |
|
|
|
get_color_code(i), |
|
|
|
mark, get_color_reset_code()); |
|
|
|
mark, get_color_reset_code()); |
|
|
|
} |
|
|
|
} |
|
|
|
putchar(' '); |
|
|
|
putchar(' '); |
|
|
|