{"thread":{"id":"39961","subject":"[PATCH 2/4] get_remote_group(): rename local variable \"space\" to \"wordlen\"","startedAt":"2015-07-28T21:08:17Z","lastAt":"2015-07-31T15:01:58Z","messageCount":7,"participants":["Michael Haggerty","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"267000","messageId":"cover.1438117334.git.mhagger@alum.mit.edu","threadId":"39961","inReplyTo":null,"subject":"[PATCH 0/4] Fix handling of remotes with single-character names","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2015-07-28T21:08:17Z","receivedAt":"2015-07-28T21:08:17Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"The parsing of `remotes.<groupname>` was broken if any of the remotes\nin the group has a name consisting of a single character.\n\nThe first patch fixes the bug; the others are general refactoring to\nmake the function a little bit clearer.\n\nThis series is based on maint, which I just noticed is still v2.4.7,\nbut it also rebases cleanly to master. It might make sense to apply\nonly the first patch to maint and the others only to master.\n\nThese patches are also available from my GitHub repository [1] as\nbranch \"single-character-remotes\".\n\nMichael\n\n[1] https://github.com/mhagger/git\n\nMichael Haggerty (4):\n  get_remote_group(): handle remotes with single-character names\n  get_remote_group(): rename local variable \"space\" to \"wordlen\"\n  get_remote_group(): eliminate superfluous call to strcspn()\n  get_remote_group(): use skip_prefix()\n\n builtin/fetch.c | 14 ++++++--------\n 1 file changed, 6 insertions(+), 8 deletions(-)\n\n-- \n2.4.6\n"},{"id":"266998","messageId":"9607497fedac5b69b76f6f47886b533553857ddb.1438117334.git.mhagger@alum.mit.edu","threadId":"39961","inReplyTo":"cover.1438117334.git.mhagger@alum.mit.edu","subject":"[PATCH 1/4] get_remote_group(): handle remotes with single-character names","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2015-07-28T21:08:18Z","receivedAt":"2015-07-28T21:08:18Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"The code for splitting a whitespace-separated list of values in\n\"remotes.<name>\" had an off-by-one error that caused it to skip over\nremotes whose names consist of a single character.\n\nAlso remove unnecessary braces.\n\nSigned-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\n builtin/fetch.c | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex f951265..98f9048 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -980,10 +980,9 @@ static int get_remote_group(const char *key, const char *value, void *priv)\n \t\t/* split list by white space */\n \t\tint space = strcspn(value, \" \\t\\n\");\n \t\twhile (*value) {\n-\t\t\tif (space > 1) {\n+\t\t\tif (space >= 1)\n \t\t\t\tstring_list_append(g->list,\n \t\t\t\t\t\t   xstrndup(value, space));\n-\t\t\t}\n \t\t\tvalue += space + (value[space] != '\\0');\n \t\t\tspace = strcspn(value, \" \\t\\n\");\n \t\t}\n-- \n2.4.6\n"},{"id":"266997","messageId":"3cb456d351a8af61a3ba894ba47aa5d7f32ed246.1438117334.git.mhagger@alum.mit.edu","threadId":"39961","inReplyTo":"cover.1438117334.git.mhagger@alum.mit.edu","subject":"[PATCH 2/4] get_remote_group(): rename local variable \"space\" to \"wordlen\"","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2015-07-28T21:08:19Z","receivedAt":"2015-07-28T21:08:19Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\n builtin/fetch.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 98f9048..d0d267b 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -978,13 +978,13 @@ static int get_remote_group(const char *key, const char *value, void *priv)\n \tif (starts_with(key, \"remotes.\") &&\n \t\t\t!strcmp(key + 8, g->name)) {\n \t\t/* split list by white space */\n-\t\tint space = strcspn(value, \" \\t\\n\");\n+\t\tsize_t wordlen = strcspn(value, \" \\t\\n\");\n \t\twhile (*value) {\n-\t\t\tif (space >= 1)\n+\t\t\tif (wordlen >= 1)\n \t\t\t\tstring_list_append(g->list,\n-\t\t\t\t\t\t   xstrndup(value, space));\n-\t\t\tvalue += space + (value[space] != '\\0');\n-\t\t\tspace = strcspn(value, \" \\t\\n\");\n+\t\t\t\t\t\t   xstrndup(value, wordlen));\n+\t\t\tvalue += wordlen + (value[wordlen] != '\\0');\n+\t\t\twordlen = strcspn(value, \" \\t\\n\");\n \t\t}\n \t}\n \n-- \n2.4.6\n"},{"id":"267001","messageId":"441622b3d894ab73de159d55176f485d7c56b147.1438117334.git.mhagger@alum.mit.edu","threadId":"39961","inReplyTo":"cover.1438117334.git.mhagger@alum.mit.edu","subject":"[PATCH 3/4] get_remote_group(): eliminate superfluous call to strcspn()","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2015-07-28T21:08:20Z","receivedAt":"2015-07-28T21:08:20Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"There is no need to call it if value is the empty string. This also\neliminates code duplication.\n\nSigned-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\n builtin/fetch.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex d0d267b..bd945d0 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -978,13 +978,13 @@ static int get_remote_group(const char *key, const char *value, void *priv)\n \tif (starts_with(key, \"remotes.\") &&\n \t\t\t!strcmp(key + 8, g->name)) {\n \t\t/* split list by white space */\n-\t\tsize_t wordlen = strcspn(value, \" \\t\\n\");\n \t\twhile (*value) {\n+\t\t\tsize_t wordlen = strcspn(value, \" \\t\\n\");\n+\n \t\t\tif (wordlen >= 1)\n \t\t\t\tstring_list_append(g->list,\n \t\t\t\t\t\t   xstrndup(value, wordlen));\n \t\t\tvalue += wordlen + (value[wordlen] != '\\0');\n-\t\t\twordlen = strcspn(value, \" \\t\\n\");\n \t\t}\n \t}\n \n-- \n2.4.6\n"},{"id":"266999","messageId":"c688744efacd01a6d85f2af983a743c15e484ab4.1438117334.git.mhagger@alum.mit.edu","threadId":"39961","inReplyTo":"cover.1438117334.git.mhagger@alum.mit.edu","subject":"[PATCH 4/4] get_remote_group(): use skip_prefix()","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2015-07-28T21:08:21Z","receivedAt":"2015-07-28T21:08:21Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\n builtin/fetch.c | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex bd945d0..76ca100 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -975,8 +975,7 @@ static int get_remote_group(const char *key, const char *value, void *priv)\n {\n \tstruct remote_group_data *g = priv;\n \n-\tif (starts_with(key, \"remotes.\") &&\n-\t\t\t!strcmp(key + 8, g->name)) {\n+\tif (skip_prefix(key, \"remotes.\", &key) && !strcmp(key, g->name)) {\n \t\t/* split list by white space */\n \t\twhile (*value) {\n \t\t\tsize_t wordlen = strcspn(value, \" \\t\\n\");\n-- \n2.4.6\n"},{"id":"267179","messageId":"xmqq4mkl70st.fsf@gitster.dls.corp.google.com","threadId":"39961","inReplyTo":"cover.1438117334.git.mhagger@alum.mit.edu","subject":"Re: [PATCH 0/4] Fix handling of remotes with single-character names","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-30T22:12:02Z","receivedAt":"2015-07-30T22:12:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks, queued.\n\nBy the way, do you plan to revisit two rather large-ish stalled\ntopics of yours queued on 'pu' any time soon?\n"},{"id":"267199","messageId":"55BB8DE6.9030401@alum.mit.edu","threadId":"39961","inReplyTo":"xmqq4mkl70st.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 0/4] Fix handling of remotes with single-character names","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2015-07-31T15:01:58Z","receivedAt":"2015-07-31T15:01:58Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"On 07/31/2015 12:12 AM, Junio C Hamano wrote:\n> Thanks, queued.\n> \n> By the way, do you plan to revisit two rather large-ish stalled\n> topics of yours queued on 'pu' any time soon?\n\nI hope to revive the \"tempfile\" and \"numparse\" topics earlyish in this\nrelease cycle if at all possible.\n\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\n"}]}