{"thread":{"id":"36246","subject":"[PATCH] Rewritten fetch-pack.c:filter_refs() using starts_with() instead of memcmp()","startedAt":"2014-03-20T10:04:49Z","lastAt":"2014-03-21T06:27:05Z","messageCount":2,"participants":["MustafaOrkunAcar","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"237153","messageId":"1395309889-340-1-git-send-email-mustafaorkunacar@gmail.com","threadId":"36246","inReplyTo":null,"subject":"[PATCH] Rewritten fetch-pack.c:filter_refs() using starts_with() instead of memcmp()","fromName":"MustafaOrkunAcar","fromEmail":"mustafaorkunacar@gmail.com","sentAt":"2014-03-20T10:04:49Z","receivedAt":"2014-03-20T10:04:49Z","isPatch":true,"sender":{"key":"mustafaorkunacar@gmail.com","avatar":null},"body":"Hi, I have completed one of the microprojects -14th one: \"Change fetch-pack.c:filter_refs() to use starts_with() instead of memcmp().\" The only line in the function filter_refs() containing memcmp() is changed with starts_with(). I plan to apply for GSoC 2014. Any feedback is appreciated. Thanks. \nSigned-off-by: MustafaOrkunAcar <mustafaorkunacar@gmail.com>\n---\n fetch-pack.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex f061f1f..17823ab 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -506,7 +506,7 @@ static void filter_refs(struct fetch_pack_args *args,\n \t\tint keep = 0;\n \t\tnext = ref->next;\n \n-\t\tif (!memcmp(ref->name, \"refs/\", 5) &&\n+\t\tif (starts_with(ref->name, \"refs/\") &&\n \t\t    check_refname_format(ref->name, 0))\n \t\t\t; /* trash */\n \t\telse {\n-- \n1.9.1.286.g5172cb3\n"},{"id":"237266","messageId":"CAPig+cS+6Kg3S+mqLk_9dBdp96M_2L2fgyc1p29irrpmHuLNvA@mail.gmail.com","threadId":"36246","inReplyTo":"1395309889-340-1-git-send-email-mustafaorkunacar@gmail.com","subject":"Re: [PATCH] Rewritten fetch-pack.c:filter_refs() using starts_with() instead of memcmp()","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-03-21T06:27:05Z","receivedAt":"2014-03-21T06:27:05Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"Thanks for the submission. Comments below to give you a taste of the\nGit review process...\n\nOn Thu, Mar 20, 2014 at 6:04 AM, MustafaOrkunAcar\n<mustafaorkunacar@gmail.com> wrote:\n> Subject: Rewritten fetch-pack.c:filter_refs() using starts_with() instead of memcmp()\n\nUse imperative mood: \"Rewrite\" rather than \"Rewritten\". Mention the\nmodule or function you're touching at the start of the subject,\nfollowed by a colon and space. For example:\n\n    Subject: filter_refs: replace memcmp() with starts_with()\n\n> Hi, I have completed one of the microprojects -14th one: \"Change fetch-pack.c:filter_refs() to use starts_with() instead of memcmp().\" The only line in the function filter_refs() containing memcmp() is changed with starts_with(). I plan to apply for GSoC 2014. Any feedback is appreciated. Thanks.\n\nWrap text to 65-70 characters.\n\nThis area above your sign-off is where you should explain the purpose\nof the patch and justify the change. For a small one like this, you\nshouldn't need more than one or two simple sentences.\n\n> Signed-off-by: MustafaOrkunAcar <mustafaorkunacar@gmail.com>\n> ---\n\nThis area below the \"---\" line under your sign-off is for commentary\nwhich won't likely be relevant to someone looking at the patch in the\nproject history months or years from now. Everything you wrote above\nabout GSoC and only one instance of memcmp() belongs here.\n\nThe patch itself looks reasonable. As suggested by the microproject,\nwere you able to find any other places in the project which could\nbenefit likewise? If so, perhaps include a few of them when you\nresubmit.\n\n>  fetch-pack.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/fetch-pack.c b/fetch-pack.c\n> index f061f1f..17823ab 100644\n> --- a/fetch-pack.c\n> +++ b/fetch-pack.c\n> @@ -506,7 +506,7 @@ static void filter_refs(struct fetch_pack_args *args,\n>                 int keep = 0;\n>                 next = ref->next;\n>\n> -               if (!memcmp(ref->name, \"refs/\", 5) &&\n> +               if (starts_with(ref->name, \"refs/\") &&\n>                     check_refname_format(ref->name, 0))\n>                         ; /* trash */\n>                 else {\n> --\n> 1.9.1.286.g5172cb3\n"}]}