git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] branch: add show-tracking option
@ 2013-05-16  7:48 Felipe Contreras
  2013-05-16  7:51 ` Felipe Contreras
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Felipe Contreras @ 2013-05-16  7:48 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Michael J Gruber,
	Nguyễn Thái Ngọc Duy, Felipe Contreras

Showing the tracking information for all the branches takes significant
amount of time. The user might not want that. The --no-show-tracking
option allows that.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-branch.txt | 5 ++++-
 builtin/branch.c             | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index b7cb625..1db04cd 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git branch' [--color[=<when>] | --no-color] [-r | -a]
-	[--list] [-v [--abbrev=<length> | --no-abbrev]]
+	[--list] [-v [--abbrev=<length> | --no-abbrev] --show-tracking]
 	[--column[=<options>] | --no-column]
 	[(--merged | --no-merged | --contains) [<commit>]] [<pattern>...]
 'git branch' [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>]
@@ -154,6 +154,9 @@ This option is only applicable in non-verbose mode.
 --no-abbrev::
 	Display the full sha1s in the output listing rather than abbreviating them.
 
+--show-tracking::
+	Display the tracking information when using --verbose, or not.
+
 -t::
 --track::
 	When creating a new branch, set up configuration to mark the
diff --git a/builtin/branch.c b/builtin/branch.c
index 0836890..2b586ea 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -33,6 +33,7 @@ static const char * const builtin_branch_usage[] = {
 
 static const char *head;
 static unsigned char head_sha1[20];
+static int show_tracking = 1;
 
 static int branch_use_color = -1;
 static char branch_colors[][COLOR_MAXLEN] = {
@@ -424,7 +425,7 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
 	struct branch *branch = branch_get(branch_name);
 	struct strbuf fancy = STRBUF_INIT;
 
-	if (!stat_tracking_info(branch, &ours, &theirs)) {
+	if (!(show_tracking && stat_tracking_info(branch, &ours, &theirs))) {
 		if (branch && branch->merge && branch->merge[0]->dst &&
 		    show_upstream_ref) {
 			ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
@@ -840,6 +841,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 			opt_parse_merge_filter, (intptr_t) "HEAD",
 		},
 		OPT_COLUMN(0, "column", &colopts, N_("list branches in columns")),
+		OPT_BOOL(0, "show-tracking", &show_tracking, N_("show tracking information")),
 		OPT_END(),
 	};
 
-- 
1.8.3.rc1.579.g184e698

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-05-16 16:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-16  7:48 [PATCH] branch: add show-tracking option Felipe Contreras
2013-05-16  7:51 ` Felipe Contreras
2013-05-16  7:54 ` Duy Nguyen
2013-05-16  7:57   ` Felipe Contreras
2013-05-16  8:00 ` Michael J Gruber
2013-05-16  8:09   ` Felipe Contreras
2013-05-16  8:23     ` Michael J Gruber
2013-05-16  8:23   ` Duy Nguyen
2013-05-16  8:40     ` Michael J Gruber
2013-05-16  8:56       ` Duy Nguyen
2013-05-16 16:17         ` Junio C Hamano
2013-05-16 16:28           ` Felipe Contreras
2013-05-16 16:31             ` Junio C Hamano
2013-05-16 16:33             ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).