{"thread":{"id":"23050","subject":"[PATCH] branch: only print upstream relationship with -v -v","startedAt":"2010-03-17T15:05:44Z","lastAt":"2010-03-18T00:06:41Z","messageCount":4,"participants":["Nguyễn Thái Ngọc Duy","Michael J Gruber","Junio C Hamano","Nguyen Thai Ngoc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"137020","messageId":"1268838344-8581-1-git-send-email-pclouds@gmail.com","threadId":"23050","inReplyTo":null,"subject":"[PATCH] branch: only print upstream relationship with -v -v","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-03-17T15:05:44Z","receivedAt":"2010-03-17T15:05:44Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\"git branch -v\" is unusable for me because it's too slow. After this\npatch:\n\npclouds@do ~/w/git $ time ./git branch -v > /dev/null\nreal    0m0.016s\nuser    0m0.011s\nsys     0m0.004s\n\npclouds@do ~/w/git $ time ./git branch -v -v > /dev/null\nreal    0m8.960s\nuser    0m8.854s\nsys     0m0.029s\n\nThis is on a repository with ~30 branches, some are hundreds of\npatches behind upstream.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Maybe it's just me, with my old branches...\n\n Documentation/git-branch.txt |    6 +++---\n builtin/branch.c             |    4 ++--\n 2 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 903a690..4380846 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -101,9 +101,9 @@ OPTIONS\n \n -v::\n --verbose::\n-\tShow sha1 and commit subject line for each head, along with\n-\trelationship to upstream branch (if any). If given twice, print\n-\tthe name of the upstream branch, as well.\n+\tShow sha1 and commit subject line for each head. If given twice,\n+\talso the relationship to upstream branch (if any). If given\n+\tthree times, print the name of the upstream branch, as well.\n \n --abbrev=<length>::\n \tAlter the sha1's minimum display length in the output listing.\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 6cf7e72..eb407f0 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -439,8 +439,8 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,\n \t\t\tsub = subject.buf;\n \t\t}\n \n-\t\tif (item->kind == REF_LOCAL_BRANCH)\n-\t\t\tfill_tracking_info(&stat, item->name, verbose > 1);\n+\t\tif (item->kind == REF_LOCAL_BRANCH && verbose > 1)\n+\t\t\tfill_tracking_info(&stat, item->name, verbose > 2);\n \n \t\tstrbuf_addf(&out, \" %s %s%s\",\n \t\t\tfind_unique_abbrev(item->commit->object.sha1, abbrev),\n-- \n1.7.0.1.390.g67bca\n"},{"id":"137034","messageId":"4BA1017E.1010404@drmicha.warpmail.net","threadId":"23050","inReplyTo":"1268838344-8581-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH] branch: only print upstream relationship with -v -v","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-03-17T16:21:18Z","receivedAt":"2010-03-17T16:21:18Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Nguyễn Thái Ngọc Duy venit, vidit, dixit 17.03.2010 16:05:\n> \"git branch -v\" is unusable for me because it's too slow. After this\n> patch:\n> \n> pclouds@do ~/w/git $ time ./git branch -v > /dev/null\n> real    0m0.016s\n> user    0m0.011s\n> sys     0m0.004s\n> \n> pclouds@do ~/w/git $ time ./git branch -v -v > /dev/null\n> real    0m8.960s\n> user    0m8.854s\n> sys     0m0.029s\n> \n\nWell, but also, after your patch the old output format of \"git branch\n-v\" is not available any more at all! I mean, what is wrong with\n\ngit log --oneline --no-walk --branches --decorate\n\nor\n\ngit rev-list --oneline --no-walk --branches\n\ndepending on what it is that you're really after? (Not to mention\nfor-each-ref.)\n\nMichael\n"},{"id":"137036","messageId":"7vwrxavqig.fsf@alter.siamese.dyndns.org","threadId":"23050","inReplyTo":"1268838344-8581-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH] branch: only print upstream relationship with -v -v","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-17T16:53:27Z","receivedAt":"2010-03-17T16:53:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n\n> \"git branch -v\" is unusable for me because it's too slow.\n> ...\n> This is on a repository with ~30 branches, some are hundreds of\n> patches behind upstream.\n\nPerhaps you have an overeager branch.autosetupmerge configuration?\n\nI dunno.  I seem to have a lot more branches than you do (currently\n56), but most of them are topics that, once they forked from a\nparticular commit, never merge other random commits, only because they\nhave new commits that are unrelated to the objective of the topic, so\nmost of my branches do not have \"upstream\" in that sense.\n"},{"id":"137065","messageId":"fcaeb9bf1003171706s31870438kc69606389495876d@mail.gmail.com","threadId":"23050","inReplyTo":"7vwrxavqig.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] branch: only print upstream relationship with -v -v","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-03-18T00:06:41Z","receivedAt":"2010-03-18T00:06:41Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On 3/17/10, Junio C Hamano <gitster@pobox.com> wrote:\n> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n>\n>  > \"git branch -v\" is unusable for me because it's too slow.\n>\n> > ...\n>\n> > This is on a repository with ~30 branches, some are hundreds of\n>  > patches behind upstream.\n>\n>\n> Perhaps you have an overeager branch.autosetupmerge configuration?\n\nNo. Never heard of it.\n\n>  I dunno.  I seem to have a lot more branches than you do (currently\n>  56), but most of them are topics that, once they forked from a\n>  particular commit, never merge other random commits, only because they\n>  have new commits that are unrelated to the objective of the topic, so\n>  most of my branches do not have \"upstream\" in that sense.\n\nI did sysprof and it seems half the time was spent inside\nmerge_bases_many(). Being a complete ignorant about merging stuff, I\nput \"return NULL;\" at the beginning of that function, \"git branch -v\"\nnow goes down to 2 seconds. Don't know if that could tell anything.\n-- \nDuy\n"}]}