{"thread":{"id":"31132","subject":"[PATCH v2 1/3] remove unnecessary parameter from get_patch_ids()","startedAt":"2012-07-29T23:25:33Z","lastAt":"2012-07-29T23:25:36Z","messageCount":4,"participants":["Martin von Zweigbergk"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"196090","messageId":"1343604336-7966-1-git-send-email-martin.von.zweigbergk@gmail.com","threadId":"31132","inReplyTo":null,"subject":"[PATCH v2 0/3] Small log simplifications","fromName":"Martin von Zweigbergk","fromEmail":"martin.von.zweigbergk@gmail.com","sentAt":"2012-07-29T23:25:33Z","receivedAt":"2012-07-29T23:25:33Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Separated out the removal of the unused diff options into patch 2/3\nand added the necessary max_parents=1 in patch 3/3.\n\nMartin von Zweigbergk (3):\n  remove unnecessary parameter from get_patch_ids()\n  cherry: don't set ignored rev_info options\n  log: remove redundant check for merge commit\n\n builtin/log.c | 22 ++++++----------------\n 1 file changed, 6 insertions(+), 16 deletions(-)\n\n-- \n1.7.11.1.104.ge7b44f1\n"},{"id":"196087","messageId":"1343604336-7966-2-git-send-email-martin.von.zweigbergk@gmail.com","threadId":"31132","inReplyTo":"1343604336-7966-1-git-send-email-martin.von.zweigbergk@gmail.com","subject":"[PATCH v2 1/3] remove unnecessary parameter from get_patch_ids()","fromName":"Martin von Zweigbergk","fromEmail":"martin.von.zweigbergk@gmail.com","sentAt":"2012-07-29T23:25:34Z","receivedAt":"2012-07-29T23:25:34Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"get_patch_ids() takes an already initialized rev_info and a\nprefix. The prefix is used when initalizing a second rev_info. Since\nthe initialized rev_info already has a prefix and the prefix never\nchanges, we can used the prefix from the initialized rev_info to\ninitialize the second rev_info.\n\nSigned-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>\n---\n builtin/log.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex ecc2793..7a92e3f 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -696,7 +696,7 @@ static int reopen_stdout(struct commit *commit, const char *subject,\n \treturn 0;\n }\n \n-static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const char *prefix)\n+static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)\n {\n \tstruct rev_info check_rev;\n \tstruct commit *commit;\n@@ -717,7 +717,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha\n \tinit_patch_ids(ids);\n \n \t/* given a range a..b get all patch ids for b..a */\n-\tinit_revisions(&check_rev, prefix);\n+\tinit_revisions(&check_rev, rev->prefix);\n \to1->flags ^= UNINTERESTING;\n \to2->flags ^= UNINTERESTING;\n \tadd_pending_object(&check_rev, o1, \"o1\");\n@@ -1306,7 +1306,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t\tif (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0)\n \t\t\t\treturn 0;\n \t\t}\n-\t\tget_patch_ids(&rev, &ids, prefix);\n+\t\tget_patch_ids(&rev, &ids);\n \t}\n \n \tif (!use_stdout)\n@@ -1525,7 +1525,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)\n \t\t\treturn 0;\n \t}\n \n-\tget_patch_ids(&revs, &ids, prefix);\n+\tget_patch_ids(&revs, &ids);\n \n \tif (limit && add_pending_commit(limit, &revs, UNINTERESTING))\n \t\tdie(_(\"Unknown commit %s\"), limit);\n-- \n1.7.11.1.104.ge7b44f1\n"},{"id":"196089","messageId":"1343604336-7966-3-git-send-email-martin.von.zweigbergk@gmail.com","threadId":"31132","inReplyTo":"1343604336-7966-1-git-send-email-martin.von.zweigbergk@gmail.com","subject":"[PATCH v2 2/3] cherry: don't set ignored rev_info options","fromName":"Martin von Zweigbergk","fromEmail":"martin.von.zweigbergk@gmail.com","sentAt":"2012-07-29T23:25:35Z","receivedAt":"2012-07-29T23:25:35Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"Ever since cherry was built-in in e827633 (Built-in cherry,\n2006-10-24), it has set a bunch of options on the the rev_info that\nare only used while outputting a patch. But since the built-in cherry\ncommand never needs to output any patch (it uses add_commit_patch_id\nand has_commit_patch_id instead), these options are just distractions,\nso remove them.\n\nSigned-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>\n---\n builtin/log.c | 4 ----\n 1 file changed, 4 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 7a92e3f..8cea1e5 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1508,10 +1508,6 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)\n \t}\n \n \tinit_revisions(&revs, prefix);\n-\trevs.diff = 1;\n-\trevs.combine_merges = 0;\n-\trevs.ignore_merges = 1;\n-\tDIFF_OPT_SET(&revs.diffopt, RECURSIVE);\n \n \tif (add_pending_commit(head, &revs, 0))\n \t\tdie(_(\"Unknown commit %s\"), head);\n-- \n1.7.11.1.104.ge7b44f1\n"},{"id":"196088","messageId":"1343604336-7966-4-git-send-email-martin.von.zweigbergk@gmail.com","threadId":"31132","inReplyTo":"1343604336-7966-1-git-send-email-martin.von.zweigbergk@gmail.com","subject":"[PATCH v2 3/3] log: remove redundant check for merge commit","fromName":"Martin von Zweigbergk","fromEmail":"martin.von.zweigbergk@gmail.com","sentAt":"2012-07-29T23:25:36Z","receivedAt":"2012-07-29T23:25:36Z","isPatch":true,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"While walking the revision list in get_patch_ids and cmd_cherry, we\ncheck for each commit if there is more than one parent and ignore the\ncommit if that is the case. Instead, set rev_info.max_parents to 1 and\nlet the revision traversal code handle it for us.\n\nSigned-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>\n---\n builtin/log.c | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 8cea1e5..3423d11 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -718,6 +718,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)\n \n \t/* given a range a..b get all patch ids for b..a */\n \tinit_revisions(&check_rev, rev->prefix);\n+\tcheck_rev.max_parents = 1;\n \to1->flags ^= UNINTERESTING;\n \to2->flags ^= UNINTERESTING;\n \tadd_pending_object(&check_rev, o1, \"o1\");\n@@ -726,10 +727,6 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)\n \t\tdie(_(\"revision walk setup failed\"));\n \n \twhile ((commit = get_revision(&check_rev)) != NULL) {\n-\t\t/* ignore merges */\n-\t\tif (commit->parents && commit->parents->next)\n-\t\t\tcontinue;\n-\n \t\tadd_commit_patch_id(commit, ids);\n \t}\n \n@@ -1508,6 +1505,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)\n \t}\n \n \tinit_revisions(&revs, prefix);\n+\trevs.max_parents = 1;\n \n \tif (add_pending_commit(head, &revs, 0))\n \t\tdie(_(\"Unknown commit %s\"), head);\n@@ -1530,10 +1528,6 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)\n \tif (prepare_revision_walk(&revs))\n \t\tdie(_(\"revision walk setup failed\"));\n \twhile ((commit = get_revision(&revs)) != NULL) {\n-\t\t/* ignore merges */\n-\t\tif (commit->parents && commit->parents->next)\n-\t\t\tcontinue;\n-\n \t\tcommit_list_insert(commit, &list);\n \t}\n \n-- \n1.7.11.1.104.ge7b44f1\n"}]}