diff options
author | Junio C Hamano <junkio@cox.net> | 2006-01-11 14:02:38 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-01-15 00:04:23 -0800 |
commit | ebedc3195258a6382f58c8c6b54b21db922440af (patch) | |
tree | fc154c275c633b797b93cab997b8ec4110907d90 /show-branch.c | |
parent | 54f9734ec84a351395bfdd332fee3f0e7006c1da (diff) | |
download | git-ebedc3195258a6382f58c8c6b54b21db922440af.tar.gz |
show-branch: make the current branch and merge commits stand out.
This changes the character used to mark the commits that is on the
branch from '+' to '*' for the current branch, to make it stand out.
Also we show '-' for merge commits.
When you have a handful branches with relatively long diversion, it
is easier to see which one is the current branch this way.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'show-branch.c')
-rw-r--r-- | show-branch.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/show-branch.c b/show-branch.c index f1bce499ba..ea3d9e4c84 100644 --- a/show-branch.c +++ b/show-branch.c @@ -545,6 +545,7 @@ int main(int ac, char **av) int sha1_name = 0; int shown_merge_point = 0; int topo_order = 0; + int head_at = -1; git_config(git_show_branch_config); setup_git_directory(); @@ -675,6 +676,8 @@ int main(int ac, char **av) } /* header lines never need name */ show_one_commit(rev[i], 1); + if (is_head) + head_at = i; } if (0 <= extra) { for (i = 0; i < num_rev; i++) @@ -703,9 +706,19 @@ int main(int ac, char **av) shown_merge_point |= ((this_flag & all_revs) == all_revs); if (1 < num_rev) { - for (i = 0; i < num_rev; i++) - putchar((this_flag & (1u << (i + REV_SHIFT))) - ? '+' : ' '); + int is_merge = !!(commit->parents && commit->parents->next); + for (i = 0; i < num_rev; i++) { + int mark; + if (!(this_flag & (1u << (i + REV_SHIFT)))) + mark = ' '; + else if (is_merge) + mark = '-'; + else if (i == head_at) + mark = '*'; + else + mark = '+'; + putchar(mark); + } putchar(' '); } show_one_commit(commit, no_name); |