{"thread":{"id":"35992","subject":"[PATCH] branch.c: delete size check of newly tracked branch names","startedAt":"2014-02-28T11:09:04Z","lastAt":"2014-02-28T12:43:03Z","messageCount":5,"participants":["Jacopo Notarstefano","Duy Nguyen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"235592","messageId":"1393585744-2569-1-git-send-email-jacopo.notarstefano@gmail.com","threadId":"35992","inReplyTo":null,"subject":"[PATCH] branch.c: delete size check of newly tracked branch names","fromName":"Jacopo Notarstefano","fromEmail":"jacopo.notarstefano@gmail.com","sentAt":"2014-02-28T11:09:04Z","receivedAt":"2014-02-28T11:09:04Z","isPatch":true,"sender":{"key":"jacopo.notarstefano@gmail.com","avatar":"https://avatars.githubusercontent.com/u/381280?v=4"},"body":"Since commit 6f084a56 the length of a newly tracked branch name was limited\nto 1019 = 1024 - 7 - 7 - 1 characters, a bound derived by having to store\nthis name in a char[1024] called key with two strings of length at most 7\nand a '\\0' character.\n\nThis was no longer necessary as of commit a9f2c136, which uses a strbuf\n(documented in Documentation/technical/api-strbuf.txt) to store this value.\n\nThis patch removes this unneeded check and thus allows for branch names\nlonger than 1019 characters.\n\nSigned-off-by: Jacopo Notarstefano <jacopo.notarstefano@gmail.com>\n---\n\nSubmitted as GSoC microproject #3.\n\n branch.c | 4 ----\n 1 file changed, 4 deletions(-)\n\ndiff --git a/branch.c b/branch.c\nindex 723a36b..05feaff 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -114,10 +114,6 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,\n \tstruct tracking tracking;\n \tint config_flags = quiet ? 0 : BRANCH_CONFIG_VERBOSE;\n \n-\tif (strlen(new_ref) > 1024 - 7 - 7 - 1)\n-\t\treturn error(_(\"Tracking not set up: name too long: %s\"),\n-\t\t\t\tnew_ref);\n-\n \tmemset(&tracking, 0, sizeof(tracking));\n \ttracking.spec.dst = (char *)orig_ref;\n \tif (for_each_remote(find_tracked_branch, &tracking))\n-- \n1.9.0.1.g5abca64\n"},{"id":"235594","messageId":"CAL0uuq3fZby7SG4Q5B8R1h8wHOGOHBamT+9ZR8mbNms40if6nw@mail.gmail.com","threadId":"35992","inReplyTo":"1393585744-2569-1-git-send-email-jacopo.notarstefano@gmail.com","subject":"Re: [PATCH] branch.c: delete size check of newly tracked branch names","fromName":"Jacopo Notarstefano","fromEmail":"jacopo.notarstefano@gmail.com","sentAt":"2014-02-28T11:16:18Z","receivedAt":"2014-02-28T11:16:18Z","isPatch":true,"sender":{"key":"jacopo.notarstefano@gmail.com","avatar":"https://avatars.githubusercontent.com/u/381280?v=4"},"body":"> This patch removes this unneeded check and thus allows for branch names\n> longer than 1019 characters.\n>\n\nAch! I amended the commit in my local history to read \"Remove this\nunneded check and thus allow for branch names longer than 1019\ncharacters\", but for some reason git format-patch -1 --signoff isn't\nreflecting this change.\n"},{"id":"235595","messageId":"CACsJy8A7jVM1wdU2BK-NyQ5HJoY_19oKhSXCKqV_7qNN+OA+mw@mail.gmail.com","threadId":"35992","inReplyTo":"1393585744-2569-1-git-send-email-jacopo.notarstefano@gmail.com","subject":"Re: [PATCH] branch.c: delete size check of newly tracked branch names","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-02-28T11:41:05Z","receivedAt":"2014-02-28T11:41:05Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Feb 28, 2014 at 6:09 PM, Jacopo Notarstefano\n<jacopo.notarstefano@gmail.com> wrote:\n> Since commit 6f084a56 the length of a newly tracked branch name was limited\n> to 1019 = 1024 - 7 - 7 - 1 characters, a bound derived by having to store\n> this name in a char[1024] called key with two strings of length at most 7\n> and a '\\0' character.\n>\n> This was no longer necessary as of commit a9f2c136, which uses a strbuf\n> (documented in Documentation/technical/api-strbuf.txt) to store this value.\n>\n> This patch removes this unneeded check and thus allows for branch names\n> longer than 1019 characters.\n\nNice. new_ref is passed in install_branch_config() in latest code. I\nguess you already made sure this function did not make any assumption\nabout new_ref's length?\n\n>\n> Signed-off-by: Jacopo Notarstefano <jacopo.notarstefano@gmail.com>\n> ---\n>\n> Submitted as GSoC microproject #3.\n>\n>  branch.c | 4 ----\n>  1 file changed, 4 deletions(-)\n>\n> diff --git a/branch.c b/branch.c\n> index 723a36b..05feaff 100644\n> --- a/branch.c\n> +++ b/branch.c\n> @@ -114,10 +114,6 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,\n>         struct tracking tracking;\n>         int config_flags = quiet ? 0 : BRANCH_CONFIG_VERBOSE;\n>\n> -       if (strlen(new_ref) > 1024 - 7 - 7 - 1)\n> -               return error(_(\"Tracking not set up: name too long: %s\"),\n> -                               new_ref);\n> -\n>         memset(&tracking, 0, sizeof(tracking));\n>         tracking.spec.dst = (char *)orig_ref;\n>         if (for_each_remote(find_tracked_branch, &tracking))\n> --\n> 1.9.0.1.g5abca64\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n\n\n-- \nDuy\n"},{"id":"235597","messageId":"CAL0uuq263WEFWvZFDeqdN4=fAJGPUtux2wwFGOUQEMfzmDOweQ@mail.gmail.com","threadId":"35992","inReplyTo":"CACsJy8A7jVM1wdU2BK-NyQ5HJoY_19oKhSXCKqV_7qNN+OA+mw@mail.gmail.com","subject":"Re: [PATCH] branch.c: delete size check of newly tracked branch names","fromName":"Jacopo Notarstefano","fromEmail":"jacopo.notarstefano@gmail.com","sentAt":"2014-02-28T12:14:44Z","receivedAt":"2014-02-28T12:14:44Z","isPatch":true,"sender":{"key":"jacopo.notarstefano@gmail.com","avatar":"https://avatars.githubusercontent.com/u/381280?v=4"},"body":"> Nice. new_ref is passed in install_branch_config() in latest code. I\n> guess you already made sure this function did not make any assumption\n> about new_ref's length?\n>\n\nThe function install_branch_config uses the strbuf, as I wrote in the\ncommit message. The contents of this buffer are then fed to\ngit_config_set, which, after a few more function calls, parses the key\nwith git_config_parse_key. This function does not rely on any\nassumptions (as far as I can tell!) on the name's length, and\nallocates enough space for it in\nhttps://github.com/git/git/blob/master/config.c#L1462.\n"},{"id":"235602","messageId":"CACsJy8BaGL9EQW87MSC98sKTfN6V9tPbqWXPAtM+nvoxV_NShg@mail.gmail.com","threadId":"35992","inReplyTo":"CAL0uuq263WEFWvZFDeqdN4=fAJGPUtux2wwFGOUQEMfzmDOweQ@mail.gmail.com","subject":"Re: [PATCH] branch.c: delete size check of newly tracked branch names","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-02-28T12:43:03Z","receivedAt":"2014-02-28T12:43:03Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Feb 28, 2014 at 7:14 PM, Jacopo Notarstefano\n<jacopo.notarstefano@gmail.com> wrote:\n>> Nice. new_ref is passed in install_branch_config() in latest code. I\n>> guess you already made sure this function did not make any assumption\n>> about new_ref's length?\n>>\n>\n> The function install_branch_config uses the strbuf, as I wrote in the\n> commit message. The contents of this buffer are then fed to\n> git_config_set, which, after a few more function calls, parses the key\n> with git_config_parse_key. This function does not rely on any\n> assumptions (as far as I can tell!) on the name's length, and\n> allocates enough space for it in\n> https://github.com/git/git/blob/master/config.c#L1462.\n\nThanks for checking!\n-- \nDuy\n"}]}