{"thread":{"id":"34812","subject":"[PATCH 0/2] branch: improve verbose option","startedAt":"2013-08-30T22:59:41Z","lastAt":"2013-08-31T17:24:18Z","messageCount":5,"participants":["Felipe Contreras","Philip Oakley"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"226380","messageId":"1377903583-3550-1-git-send-email-felipe.contreras@gmail.com","threadId":"34812","inReplyTo":null,"subject":"[PATCH 0/2] branch: improve verbose option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T22:59:41Z","receivedAt":"2013-08-30T22:59:41Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Hi,\n\nThis has been discussed before:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/224489\n\nbut in the spirit of the perfect being the enemy of the good, nothing got done.\n\nThis series makes 'git branch -v' much faster, and gives us the most important\ninformation; the configured upstream tracking branch. Showing ahead/behind is\nnot as important, specially considering that currently 'git branch -v' doesn't\nshow the branch we are comparing the ahead/behind to.\n\nStrictly speaking it's a regression, but nobody would complain, and if somebody\ndoes, it should be easy to revert if needed.\n\nFelipe Contreras (2):\n  branch: trivial cleanup\n  branch: reorganize verbose options\n\n builtin/branch.c         | 33 +++++++++++++++------------------\n t/t6040-tracking-info.sh |  8 ++++----\n 2 files changed, 19 insertions(+), 22 deletions(-)\n\n-- \n1.8.4-fc\n"},{"id":"226381","messageId":"1377903583-3550-2-git-send-email-felipe.contreras@gmail.com","threadId":"34812","inReplyTo":"1377903583-3550-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 1/2] branch: trivial cleanup","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T22:59:42Z","receivedAt":"2013-08-30T22:59:42Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"No functional changes.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n builtin/branch.c | 19 +++++++++----------\n 1 file changed, 9 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 0836890..ac17b18 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -425,16 +425,15 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,\n \tstruct strbuf fancy = STRBUF_INIT;\n \n \tif (!stat_tracking_info(branch, &ours, &theirs)) {\n-\t\tif (branch && branch->merge && branch->merge[0]->dst &&\n-\t\t    show_upstream_ref) {\n-\t\t\tref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);\n-\t\t\tif (want_color(branch_use_color))\n-\t\t\t\tstrbuf_addf(stat, \"[%s%s%s] \",\n-\t\t\t\t\t\tbranch_get_color(BRANCH_COLOR_UPSTREAM),\n-\t\t\t\t\t\tref, branch_get_color(BRANCH_COLOR_RESET));\n-\t\t\telse\n-\t\t\t\tstrbuf_addf(stat, \"[%s] \", ref);\n-\t\t}\n+\t\tif (!branch || !branch->merge || !branch->merge[0]->dst || !show_upstream_ref)\n+\t\t\treturn;\n+\t\tref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);\n+\t\tif (want_color(branch_use_color))\n+\t\t\tstrbuf_addf(stat, \"[%s%s%s] \",\n+\t\t\t\t\tbranch_get_color(BRANCH_COLOR_UPSTREAM),\n+\t\t\t\t\tref, branch_get_color(BRANCH_COLOR_RESET));\n+\t\telse\n+\t\t\tstrbuf_addf(stat, \"[%s] \", ref);\n \t\treturn;\n \t}\n \n-- \n1.8.4-fc\n"},{"id":"226382","messageId":"1377903583-3550-3-git-send-email-felipe.contreras@gmail.com","threadId":"34812","inReplyTo":"1377903583-3550-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 2/2] branch: reorganize verbose options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-30T22:59:43Z","receivedAt":"2013-08-30T22:59:43Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Showing the upstream tracking branch is more important than how many\ncommits are ahead/behind, so now 'git branch -v' shows the upstream, but\nnot the tracking info, and 'git branch -vv' shows all information (as\nbefore).\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n builtin/branch.c         | 22 ++++++++++------------\n t/t6040-tracking-info.sh |  8 ++++----\n 2 files changed, 14 insertions(+), 16 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex ac17b18..baa1d31 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -417,15 +417,15 @@ static int ref_cmp(const void *r1, const void *r2)\n }\n \n static void fill_tracking_info(struct strbuf *stat, const char *branch_name,\n-\t\tint show_upstream_ref)\n+\t\tint show_tracking)\n {\n \tint ours, theirs;\n \tchar *ref = NULL;\n \tstruct branch *branch = branch_get(branch_name);\n \tstruct strbuf fancy = STRBUF_INIT;\n \n-\tif (!stat_tracking_info(branch, &ours, &theirs)) {\n-\t\tif (!branch || !branch->merge || !branch->merge[0]->dst || !show_upstream_ref)\n+\tif (!show_tracking || !stat_tracking_info(branch, &ours, &theirs)) {\n+\t\tif (!branch || !branch->merge || !branch->merge[0]->dst)\n \t\t\treturn;\n \t\tref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);\n \t\tif (want_color(branch_use_color))\n@@ -437,15 +437,13 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,\n \t\treturn;\n \t}\n \n-\tif (show_upstream_ref) {\n-\t\tref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);\n-\t\tif (want_color(branch_use_color))\n-\t\t\tstrbuf_addf(&fancy, \"%s%s%s\",\n-\t\t\t\t\tbranch_get_color(BRANCH_COLOR_UPSTREAM),\n-\t\t\t\t\tref, branch_get_color(BRANCH_COLOR_RESET));\n-\t\telse\n-\t\t\tstrbuf_addstr(&fancy, ref);\n-\t}\n+\tref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);\n+\tif (want_color(branch_use_color))\n+\t\tstrbuf_addf(&fancy, \"%s%s%s\",\n+\t\t\t\tbranch_get_color(BRANCH_COLOR_UPSTREAM),\n+\t\t\t\tref, branch_get_color(BRANCH_COLOR_RESET));\n+\telse\n+\t\tstrbuf_addstr(&fancy, ref);\n \n \tif (!ours) {\n \t\tif (ref)\ndiff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh\nindex ec2b516..86e80eb 100755\n--- a/t/t6040-tracking-info.sh\n+++ b/t/t6040-tracking-info.sh\n@@ -36,10 +36,10 @@ test_expect_success setup '\n \n script='s/^..\\(b.\\)[\t 0-9a-f]*\\[\\([^]]*\\)\\].*/\\1 \\2/p'\n cat >expect <<\\EOF\n-b1 ahead 1, behind 1\n-b2 ahead 1, behind 1\n-b3 behind 1\n-b4 ahead 2\n+b1 origin/master\n+b2 origin/master\n+b3 origin/master\n+b4 origin/master\n EOF\n \n test_expect_success 'branch -v' '\n-- \n1.8.4-fc\n"},{"id":"226418","messageId":"CD323DA08A0540A89D9BFB28F541AFB4@PhilipOakley","threadId":"34812","inReplyTo":"1377903583-3550-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH 0/2] branch: improve verbose option","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-08-31T14:41:02Z","receivedAt":"2013-08-31T14:41:02Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Felipe Contreras\" <felipe.contreras@gmail.com>\nSent: Friday, August 30, 2013 11:59 PM\n> Hi,\n>\n> This has been discussed before:\n>\n> http://thread.gmane.org/gmane.comp.version-control.git/224489\n>\n> but in the spirit of the perfect being the enemy of the good, nothing \n> got done.\n>\n> This series makes 'git branch -v' much faster, and gives us the most \n> important\n> information; the configured upstream tracking branch.\n\nYes, It's someting I often want reminding of (which origin server, which \nmaster?, ..etc.) always appear to start here.\n\n>        Showing ahead/behind is\n> not as important,\n\nI still find this useful - if it's up to date I don't need reminding of \nwhich remote / upstream tracking branch it's configured against ;-)\n\nThese two bits of information, while related are separate. If anything I \nthink I'd prefer both, but then again optimisations are still good.\n\nBikeshedding ends.\n\nPhilip\n\n>    specially considering that currently 'git branch -v' doesn't\n> show the branch we are comparing the ahead/behind to.\n>\n> Strictly speaking it's a regression, but nobody would complain, and if \n> somebody\n> does, it should be easy to revert if needed.\n>\n> Felipe Contreras (2):\n>  branch: trivial cleanup\n>  branch: reorganize verbose options\n>\n> builtin/branch.c         | 33 +++++++++++++++------------------\n> t/t6040-tracking-info.sh |  8 ++++----\n> 2 files changed, 19 insertions(+), 22 deletions(-)\n>\n> -- \n"},{"id":"226425","messageId":"CAMP44s00qUjqR6Daiy_3_hONuSBkxY99xaxCdbKyBM-t84Q0=w@mail.gmail.com","threadId":"34812","inReplyTo":"CD323DA08A0540A89D9BFB28F541AFB4@PhilipOakley","subject":"Re: [PATCH 0/2] branch: improve verbose option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-08-31T17:24:18Z","receivedAt":"2013-08-31T17:24:18Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sat, Aug 31, 2013 at 9:41 AM, Philip Oakley <philipoakley@iee.org> wrote:\n> From: \"Felipe Contreras\" <felipe.contreras@gmail.com>\n\n>>        Showing ahead/behind is\n>> not as important,\n>\n>\n> I still find this useful - if it's up to date I don't need reminding of\n> which remote / upstream tracking branch it's configured against ;-)\n\nWhether or not it's up to date depends on which is the upstream\ntracking branch. What if you see \"ahead 1\", and you think it's not up\nto date, but it turns out it's tracking the wrong branch?\n\n> These two bits of information, while related are separate. If anything I\n> think I'd prefer both, but then again optimisations are still good.\n\nSo you can keep using 'git branch -vv'.\n\n-- \nFelipe Contreras\n"}]}