summaryrefslogtreecommitdiff
path: root/builtin/show-branch.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/show-branch.c')
-rw-r--r--builtin/show-branch.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index e8719aa..facc63a 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -6,22 +6,12 @@
#include "parse-options.h"
static const char* show_branch_usage[] = {
- "git show-branch [-a|--all] [-r|--remotes] [--topo-order | --date-order] [--current] [--color[=<when>] | --no-color] [--sparse] [--more=<n> | --list | --independent | --merge-base] [--no-name | --sha1-name] [--topics] [<rev> | <glob>]...",
+ "git show-branch [-a|--all] [-r|--remotes] [--topo-order | --date-order] [--current] [--color[=<when>] | --no-color] [--sparse] [--more=<n> | --list | --independent | --merge-base] [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]",
"git show-branch (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]",
NULL
};
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_alloc;
@@ -37,7 +27,7 @@ static const char **default_arg;
static const char *get_color_code(int idx)
{
if (showbranch_use_color)
- return column_colors[idx];
+ return column_colors_ansi[idx % column_colors_ansi_max];
return "";
}
@@ -243,7 +233,7 @@ static void join_revs(struct commit_list **list_p,
if (mark_seen(p, seen_p) && !still_interesting)
extra--;
p->object.flags |= flags;
- insert_by_date(p, list_p);
+ commit_list_insert_by_date(p, list_p);
}
}
@@ -293,8 +283,7 @@ static void show_one_commit(struct commit *commit, int no_name)
struct commit_name *name = commit->util;
if (commit->object.parsed) {
- struct pretty_print_context ctx = {0};
- pretty_print_commit(CMIT_FMT_ONELINE, commit, &pretty, &ctx);
+ pp_commit_easy(CMIT_FMT_ONELINE, commit, &pretty);
pretty_str = pretty.buf;
}
if (!prefixcmp(pretty_str, "[PATCH] "))
@@ -859,7 +848,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
*/
commit->object.flags |= flag;
if (commit->object.flags == flag)
- insert_by_date(commit, &list);
+ commit_list_insert_by_date(commit, &list);
rev[num_rev] = commit;
}
for (i = 0; i < num_rev; i++)
@@ -868,7 +857,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
if (0 <= extra)
join_revs(&list, &seen, num_rev, extra);
- sort_by_date(&seen);
+ commit_list_sort_by_date(&seen);
if (merge_base)
return show_merge_base(seen, num_rev);
@@ -892,7 +881,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
for (j = 0; j < i; j++)
putchar(' ');
printf("%s%c%s [%s] ",
- get_color_code(i % COLUMN_COLORS_MAX),
+ get_color_code(i),
is_head ? '*' : '!',
get_color_reset_code(), ref_name[i]);
}
@@ -954,7 +943,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
else
mark = '+';
printf("%s%c%s",
- get_color_code(i % COLUMN_COLORS_MAX),
+ get_color_code(i),
mark, get_color_reset_code());
}
putchar(' ');