* [PATCH try2 0/2] branch: improve verbose option
@ 2013-10-12 7:00 Felipe Contreras
2013-10-12 7:00 ` [PATCH try2 1/2] branch: trivial cleanup Felipe Contreras
2013-10-12 7:00 ` [PATCH try2 2/2] branch: reorganize verbose options Felipe Contreras
0 siblings, 2 replies; 3+ messages in thread
From: Felipe Contreras @ 2013-10-12 7:00 UTC (permalink / raw)
To: git
Cc: Nguyễn Thái Ngọc Duy, Jeff King,
Michael J Gruber, Felipe Contreras
This has been discussed before:
http://thread.gmane.org/gmane.comp.version-control.git/224489
but in the spirit of the perfect being the enemy of the good, nothing got done.
This series makes 'git branch -v' much faster, and gives us the most important
information; the configured upstream tracking branch. Showing ahead/behind is
not as important, specially considering that currently 'git branch -v' doesn't
show the branch we are comparing the ahead/behind to.
Strictly speaking it's a regression, but nobody would complain, and if somebody
does, it should be easy to revert if needed.
Felipe Contreras (2):
branch: trivial cleanup
branch: reorganize verbose options
builtin/branch.c | 33 +++++++++++++++------------------
t/t6040-tracking-info.sh | 8 ++++----
2 files changed, 19 insertions(+), 22 deletions(-)
--
1.8.4-fc
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH try2 1/2] branch: trivial cleanup
2013-10-12 7:00 [PATCH try2 0/2] branch: improve verbose option Felipe Contreras
@ 2013-10-12 7:00 ` Felipe Contreras
2013-10-12 7:00 ` [PATCH try2 2/2] branch: reorganize verbose options Felipe Contreras
1 sibling, 0 replies; 3+ messages in thread
From: Felipe Contreras @ 2013-10-12 7:00 UTC (permalink / raw)
To: git
Cc: Nguyễn Thái Ngọc Duy, Jeff King,
Michael J Gruber, Felipe Contreras
No functional changes.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
builtin/branch.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 0836890..ac17b18 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -425,16 +425,15 @@ static void fill_tracking_info(struct strbuf *stat, const char *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) {
- ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
- if (want_color(branch_use_color))
- strbuf_addf(stat, "[%s%s%s] ",
- branch_get_color(BRANCH_COLOR_UPSTREAM),
- ref, branch_get_color(BRANCH_COLOR_RESET));
- else
- strbuf_addf(stat, "[%s] ", ref);
- }
+ if (!branch || !branch->merge || !branch->merge[0]->dst || !show_upstream_ref)
+ return;
+ ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
+ if (want_color(branch_use_color))
+ strbuf_addf(stat, "[%s%s%s] ",
+ branch_get_color(BRANCH_COLOR_UPSTREAM),
+ ref, branch_get_color(BRANCH_COLOR_RESET));
+ else
+ strbuf_addf(stat, "[%s] ", ref);
return;
}
--
1.8.4-fc
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH try2 2/2] branch: reorganize verbose options
2013-10-12 7:00 [PATCH try2 0/2] branch: improve verbose option Felipe Contreras
2013-10-12 7:00 ` [PATCH try2 1/2] branch: trivial cleanup Felipe Contreras
@ 2013-10-12 7:00 ` Felipe Contreras
1 sibling, 0 replies; 3+ messages in thread
From: Felipe Contreras @ 2013-10-12 7:00 UTC (permalink / raw)
To: git
Cc: Nguyễn Thái Ngọc Duy, Jeff King,
Michael J Gruber, Felipe Contreras
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-12 7:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-12 7:00 [PATCH try2 0/2] branch: improve verbose option Felipe Contreras
2013-10-12 7:00 ` [PATCH try2 1/2] branch: trivial cleanup Felipe Contreras
2013-10-12 7:00 ` [PATCH try2 2/2] branch: reorganize verbose options Felipe Contreras
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).