{"thread":{"id":"26825","subject":"[PATCH/RFC] rev-list --count: separate count for --cherry-mark","startedAt":"2011-03-22T12:41:06Z","lastAt":"2011-03-22T12:41:06Z","messageCount":1,"participants":["Michael J Gruber"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"164040","messageId":"df0c562ed0e2255a3cfe581698298a6fe48900ca.1300797575.git.git@drmicha.warpmail.net","threadId":"26825","inReplyTo":null,"subject":"[PATCH/RFC] rev-list --count: separate count for --cherry-mark","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-03-22T12:41:06Z","receivedAt":"2011-03-22T12:41:06Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"When --count is used with --cherry-mark, omit the patch equivalent\ncommits from the count for left and right commits and print the count of\nequivalent commits separately.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nI noticed this in passing. It does not break anything and can be done\neasily. I would feel strongly positive about it if rev-list --cherry\nwas faster. Then it would be useful for gitprompt, branch -vv and the like.\n\n Documentation/rev-list-options.txt |    5 ++++-\n builtin/rev-list.c                 |   10 ++++++++--\n revision.h                         |    1 +\n 3 files changed, 13 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\nindex 5c6850f..e092a7c 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -715,7 +715,10 @@ ifdef::git-rev-list[]\n \tPrint a number stating how many commits would have been\n \tlisted, and suppress all other output.  When used together\n \twith '--left-right', instead print the counts for left and\n-\tright commits, separated by a tab.\n+\tright commits, separated by a tab. When used together with\n+\t'--cherry-mark', omit patch equivalent commits from these\n+\tcounts and print the count for equivalent commits separated\n+\tby a tab.\n endif::git-rev-list[]\n \n \ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex f458cb7..8761e9a 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -51,7 +51,9 @@ static void show_commit(struct commit *commit, void *data)\n \tgraph_show_commit(revs->graph);\n \n \tif (revs->count) {\n-\t\tif (commit->object.flags & SYMMETRIC_LEFT)\n+\t\tif (commit->object.flags & PATCHSAME)\n+\t\t\trevs->count_same++;\n+\t\telse if (commit->object.flags & SYMMETRIC_LEFT)\n \t\t\trevs->count_left++;\n \t\telse\n \t\t\trevs->count_right++;\n@@ -402,8 +404,12 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\t\t     &info);\n \n \tif (revs.count) {\n-\t\tif (revs.left_right)\n+\t\tif (revs.left_right && revs.cherry_mark)\n+\t\t\tprintf(\"%d\\t%d\\t%d\\n\", revs.count_left, revs.count_right, revs.count_same);\n+\t\telse if (revs.left_right)\n \t\t\tprintf(\"%d\\t%d\\n\", revs.count_left, revs.count_right);\n+\t\telse if (revs.cherry_mark)\n+\t\t\tprintf(\"%d\\t%d\\n\", revs.count_left + revs.count_right, revs.count_same);\n \t\telse\n \t\t\tprintf(\"%d\\n\", revs.count_left + revs.count_right);\n \t}\ndiff --git a/revision.h b/revision.h\nindex ae94860..08900b3 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -141,6 +141,7 @@ struct rev_info {\n \t/* commit counts */\n \tint count_left;\n \tint count_right;\n+\tint count_same;\n };\n \n #define REV_TREE_SAME\t\t0\n-- \n1.7.4.1.511.g72e46\n"}]}