From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Matthieu Moy <matthieu.moy@imag.fr>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH try2 2/8] branch: reorganize verbose options
Date: Sat, 12 Oct 2013 02:05:58 -0500 [thread overview]
Message-ID: <1381561561-20459-6-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1381561561-20459-1-git-send-email-felipe.contreras@gmail.com>
Showing the upstream tracking branch is more important than how many
commits are ahead/behind, so now 'git branch -v' shows the upstream, but
not the tracking info, and 'git branch -vv' shows all information (as
before).
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
builtin/branch.c | 22 ++++++++++------------
t/t6040-tracking-info.sh | 8 ++++----
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index ac17b18..baa1d31 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -417,15 +417,15 @@ static int ref_cmp(const void *r1, const void *r2)
}
static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
- int show_upstream_ref)
+ int show_tracking)
{
int ours, theirs;
char *ref = NULL;
struct branch *branch = branch_get(branch_name);
struct strbuf fancy = STRBUF_INIT;
- if (!stat_tracking_info(branch, &ours, &theirs)) {
- if (!branch || !branch->merge || !branch->merge[0]->dst || !show_upstream_ref)
+ if (!show_tracking || !stat_tracking_info(branch, &ours, &theirs)) {
+ if (!branch || !branch->merge || !branch->merge[0]->dst)
return;
ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
if (want_color(branch_use_color))
@@ -437,15 +437,13 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
return;
}
- if (show_upstream_ref) {
- ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
- if (want_color(branch_use_color))
- strbuf_addf(&fancy, "%s%s%s",
- branch_get_color(BRANCH_COLOR_UPSTREAM),
- ref, branch_get_color(BRANCH_COLOR_RESET));
- else
- strbuf_addstr(&fancy, ref);
- }
+ ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
+ if (want_color(branch_use_color))
+ strbuf_addf(&fancy, "%s%s%s",
+ branch_get_color(BRANCH_COLOR_UPSTREAM),
+ ref, branch_get_color(BRANCH_COLOR_RESET));
+ else
+ strbuf_addstr(&fancy, ref);
if (!ours) {
if (ref)
diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
index ec2b516..86e80eb 100755
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
@@ -36,10 +36,10 @@ test_expect_success setup '
script='s/^..\(b.\)[ 0-9a-f]*\[\([^]]*\)\].*/\1 \2/p'
cat >expect <<\EOF
-b1 ahead 1, behind 1
-b2 ahead 1, behind 1
-b3 behind 1
-b4 ahead 2
+b1 origin/master
+b2 origin/master
+b3 origin/master
+b4 origin/master
EOF
test_expect_success 'branch -v' '
--
1.8.4-fc
next prev parent reply other threads:[~2013-10-12 7:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-12 7:05 [PATCH try2 0/8] Introduce publish tracking branch Felipe Contreras
2013-10-12 7:05 ` [PATCH try2 7/8] push: add --set-publish option Felipe Contreras
2013-10-13 10:03 ` Eric Sunshine
2013-10-13 10:15 ` Felipe Contreras
2013-10-12 7:05 ` [PATCH try2 6/8] t: branch add publish branch tests Felipe Contreras
2013-10-12 7:05 ` [PATCH try2 4/8] Add concept of 'publish' branch Felipe Contreras
2013-10-12 7:05 ` [PATCH try2 1/8] branch: trivial cleanup Felipe Contreras
2013-10-12 7:05 ` Felipe Contreras [this message]
2013-10-12 7:05 ` [PATCH try2 3/8] push: trivial reorganization Felipe Contreras
2013-10-12 7:06 ` [PATCH try2 8/8] branch: display publish branch Felipe Contreras
2013-10-12 7:06 ` [PATCH try2 5/8] branch: allow configuring the " Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381561561-20459-6-git-send-email-felipe.contreras@gmail.com \
--to=felipe.contreras@gmail.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=matthieu.moy@imag.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).