aboutsummaryrefslogtreecommitdiff
path: root/show-branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-08-22 23:16:46 -0700
committerJunio C Hamano <junkio@cox.net>2005-08-22 23:18:17 -0700
commitf5e375c9a99d731c05eef701f119da85d62fc158 (patch)
tree36e45b1ec1d2762bdc5b9a1c57eaab97b942d7a4 /show-branch.c
parentf76412ed6dbf2f9863115ee38f4198368dbaf7b1 (diff)
downloadgit-f5e375c9a99d731c05eef701f119da85d62fc158.tar.gz
git-f5e375c9a99d731c05eef701f119da85d62fc158.tar.xz
Clean-up output from "git show-branch" and document it.
When showing only one branch a lot of default output becomes redundant, so clean it up a bit, and document what is shown. Retire the earlier implementation "git-show-branches-script". Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'show-branch.c')
-rw-r--r--show-branch.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/show-branch.c b/show-branch.c
index c9a6fcebd..fc827ee49 100644
--- a/show-branch.c
+++ b/show-branch.c
@@ -223,6 +223,7 @@ int main(int ac, char **av)
int head_path_len;
unsigned char head_sha1[20];
int merge_base = 0;
+ char **label;
while (1 < ac && av[1][0] == '-') {
char *arg = av[1];
@@ -297,7 +298,8 @@ int main(int ac, char **av)
if (merge_base)
return show_merge_base(seen, num_rev);
- if (1 < num_rev)
+ /* Show list */
+ if (1 < num_rev) {
for (i = 0; i < num_rev; i++) {
int j;
int is_head = rev_is_head(head_path,
@@ -310,16 +312,28 @@ int main(int ac, char **av)
printf("%c [%s] ", is_head ? '*' : '!', ref_name[i]);
show_one_commit(rev[i], NULL);
}
+ for (i = 0; i < num_rev; i++)
+ putchar('-');
+ putchar('\n');
+ }
+
+ label = ref_name;
while (seen) {
struct commit *commit = pop_one_commit(&seen);
int this_flag = commit->object.flags;
+ static char *obvious[] = { "" };
+
if ((this_flag & UNINTERESTING) && (--extra < 0))
break;
- for (i = 0; i < num_rev; i++)
- putchar((this_flag & (1u << (i + REV_SHIFT)))
- ? '+' : ' ');
- putchar(' ');
- show_one_commit(commit, ref_name);
+ if (1 < num_rev) {
+ for (i = 0; i < num_rev; i++)
+ putchar((this_flag & (1u << (i + REV_SHIFT)))
+ ? '+' : ' ');
+ putchar(' ');
+ }
+ show_one_commit(commit, label);
+ if (num_rev == 1)
+ label = obvious;
}
return 0;
}