{"thread":{"id":"48947","subject":"[PATCH v1] config.c: fix msvc compile error","startedAt":"2018-07-24T15:30:25Z","lastAt":"2018-07-25T12:51:56Z","messageCount":9,"participants":["git@jeffhostetler.com","Junio C Hamano","Beat Bolli","Taylor Blau","Jeff Hostetler"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"353466","messageId":"20180724153010.6693-1-git@jeffhostetler.com","threadId":"48947","inReplyTo":null,"subject":"[PATCH v1] config.c: fix msvc compile error","fromName":"","fromEmail":"git@jeffhostetler.com","sentAt":"2018-07-24T15:30:10Z","receivedAt":"2018-07-24T15:30:25Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"From: Jeff Hostetler <jeffhost@microsoft.com>\n\nIn commit fb0dc3bac135e9f6243bd6d293e8c9293c73b9cd code was added\nto builtin/config.c to define a new function and a forward declaration\nfor an array of unknown size.  This causes a compile error under MSVC.\n\nReorder the code to forward declare the function instead of the array.\n\nSigned-off-by: Jeff Hostetler <jeffhost@microsoft.com>\n---\n builtin/config.c | 79 ++++++++++++++++++++++++++++----------------------------\n 1 file changed, 40 insertions(+), 39 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex b29d26d..564f18f 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -67,7 +67,46 @@ static int show_origin;\n \t{ OPTION_CALLBACK, (s), (l), (v), NULL, (h), PARSE_OPT_NOARG | \\\n \tPARSE_OPT_NONEG, option_parse_type, (i) }\n \n-static struct option builtin_config_options[];\n+static int option_parse_type(const struct option *opt, const char *arg,\n+\t\t\t     int unset);\n+\n+static struct option builtin_config_options[] = {\n+\tOPT_GROUP(N_(\"Config file location\")),\n+\tOPT_BOOL(0, \"global\", &use_global_config, N_(\"use global config file\")),\n+\tOPT_BOOL(0, \"system\", &use_system_config, N_(\"use system config file\")),\n+\tOPT_BOOL(0, \"local\", &use_local_config, N_(\"use repository config file\")),\n+\tOPT_STRING('f', \"file\", &given_config_source.file, N_(\"file\"), N_(\"use given config file\")),\n+\tOPT_STRING(0, \"blob\", &given_config_source.blob, N_(\"blob-id\"), N_(\"read config from given blob object\")),\n+\tOPT_GROUP(N_(\"Action\")),\n+\tOPT_BIT(0, \"get\", &actions, N_(\"get value: name [value-regex]\"), ACTION_GET),\n+\tOPT_BIT(0, \"get-all\", &actions, N_(\"get all values: key [value-regex]\"), ACTION_GET_ALL),\n+\tOPT_BIT(0, \"get-regexp\", &actions, N_(\"get values for regexp: name-regex [value-regex]\"), ACTION_GET_REGEXP),\n+\tOPT_BIT(0, \"get-urlmatch\", &actions, N_(\"get value specific for the URL: section[.var] URL\"), ACTION_GET_URLMATCH),\n+\tOPT_BIT(0, \"replace-all\", &actions, N_(\"replace all matching variables: name value [value_regex]\"), ACTION_REPLACE_ALL),\n+\tOPT_BIT(0, \"add\", &actions, N_(\"add a new variable: name value\"), ACTION_ADD),\n+\tOPT_BIT(0, \"unset\", &actions, N_(\"remove a variable: name [value-regex]\"), ACTION_UNSET),\n+\tOPT_BIT(0, \"unset-all\", &actions, N_(\"remove all matches: name [value-regex]\"), ACTION_UNSET_ALL),\n+\tOPT_BIT(0, \"rename-section\", &actions, N_(\"rename section: old-name new-name\"), ACTION_RENAME_SECTION),\n+\tOPT_BIT(0, \"remove-section\", &actions, N_(\"remove a section: name\"), ACTION_REMOVE_SECTION),\n+\tOPT_BIT('l', \"list\", &actions, N_(\"list all\"), ACTION_LIST),\n+\tOPT_BIT('e', \"edit\", &actions, N_(\"open an editor\"), ACTION_EDIT),\n+\tOPT_BIT(0, \"get-color\", &actions, N_(\"find the color configured: slot [default]\"), ACTION_GET_COLOR),\n+\tOPT_BIT(0, \"get-colorbool\", &actions, N_(\"find the color setting: slot [stdout-is-tty]\"), ACTION_GET_COLORBOOL),\n+\tOPT_GROUP(N_(\"Type\")),\n+\tOPT_CALLBACK('t', \"type\", &type, \"\", N_(\"value is given this type\"), option_parse_type),\n+\tOPT_CALLBACK_VALUE(0, \"bool\", &type, N_(\"value is \\\"true\\\" or \\\"false\\\"\"), TYPE_BOOL),\n+\tOPT_CALLBACK_VALUE(0, \"int\", &type, N_(\"value is decimal number\"), TYPE_INT),\n+\tOPT_CALLBACK_VALUE(0, \"bool-or-int\", &type, N_(\"value is --bool or --int\"), TYPE_BOOL_OR_INT),\n+\tOPT_CALLBACK_VALUE(0, \"path\", &type, N_(\"value is a path (file or directory name)\"), TYPE_PATH),\n+\tOPT_CALLBACK_VALUE(0, \"expiry-date\", &type, N_(\"value is an expiry date\"), TYPE_EXPIRY_DATE),\n+\tOPT_GROUP(N_(\"Other\")),\n+\tOPT_BOOL('z', \"null\", &end_null, N_(\"terminate values with NUL byte\")),\n+\tOPT_BOOL(0, \"name-only\", &omit_values, N_(\"show variable names only\")),\n+\tOPT_BOOL(0, \"includes\", &respect_includes_opt, N_(\"respect include directives on lookup\")),\n+\tOPT_BOOL(0, \"show-origin\", &show_origin, N_(\"show origin of config (file, standard input, blob, command line)\")),\n+\tOPT_STRING(0, \"default\", &default_value, N_(\"value\"), N_(\"with --get, use default value when missing entry\")),\n+\tOPT_END(),\n+};\n \n static int option_parse_type(const struct option *opt, const char *arg,\n \t\t\t     int unset)\n@@ -119,44 +158,6 @@ static int option_parse_type(const struct option *opt, const char *arg,\n \treturn 0;\n }\n \n-static struct option builtin_config_options[] = {\n-\tOPT_GROUP(N_(\"Config file location\")),\n-\tOPT_BOOL(0, \"global\", &use_global_config, N_(\"use global config file\")),\n-\tOPT_BOOL(0, \"system\", &use_system_config, N_(\"use system config file\")),\n-\tOPT_BOOL(0, \"local\", &use_local_config, N_(\"use repository config file\")),\n-\tOPT_STRING('f', \"file\", &given_config_source.file, N_(\"file\"), N_(\"use given config file\")),\n-\tOPT_STRING(0, \"blob\", &given_config_source.blob, N_(\"blob-id\"), N_(\"read config from given blob object\")),\n-\tOPT_GROUP(N_(\"Action\")),\n-\tOPT_BIT(0, \"get\", &actions, N_(\"get value: name [value-regex]\"), ACTION_GET),\n-\tOPT_BIT(0, \"get-all\", &actions, N_(\"get all values: key [value-regex]\"), ACTION_GET_ALL),\n-\tOPT_BIT(0, \"get-regexp\", &actions, N_(\"get values for regexp: name-regex [value-regex]\"), ACTION_GET_REGEXP),\n-\tOPT_BIT(0, \"get-urlmatch\", &actions, N_(\"get value specific for the URL: section[.var] URL\"), ACTION_GET_URLMATCH),\n-\tOPT_BIT(0, \"replace-all\", &actions, N_(\"replace all matching variables: name value [value_regex]\"), ACTION_REPLACE_ALL),\n-\tOPT_BIT(0, \"add\", &actions, N_(\"add a new variable: name value\"), ACTION_ADD),\n-\tOPT_BIT(0, \"unset\", &actions, N_(\"remove a variable: name [value-regex]\"), ACTION_UNSET),\n-\tOPT_BIT(0, \"unset-all\", &actions, N_(\"remove all matches: name [value-regex]\"), ACTION_UNSET_ALL),\n-\tOPT_BIT(0, \"rename-section\", &actions, N_(\"rename section: old-name new-name\"), ACTION_RENAME_SECTION),\n-\tOPT_BIT(0, \"remove-section\", &actions, N_(\"remove a section: name\"), ACTION_REMOVE_SECTION),\n-\tOPT_BIT('l', \"list\", &actions, N_(\"list all\"), ACTION_LIST),\n-\tOPT_BIT('e', \"edit\", &actions, N_(\"open an editor\"), ACTION_EDIT),\n-\tOPT_BIT(0, \"get-color\", &actions, N_(\"find the color configured: slot [default]\"), ACTION_GET_COLOR),\n-\tOPT_BIT(0, \"get-colorbool\", &actions, N_(\"find the color setting: slot [stdout-is-tty]\"), ACTION_GET_COLORBOOL),\n-\tOPT_GROUP(N_(\"Type\")),\n-\tOPT_CALLBACK('t', \"type\", &type, \"\", N_(\"value is given this type\"), option_parse_type),\n-\tOPT_CALLBACK_VALUE(0, \"bool\", &type, N_(\"value is \\\"true\\\" or \\\"false\\\"\"), TYPE_BOOL),\n-\tOPT_CALLBACK_VALUE(0, \"int\", &type, N_(\"value is decimal number\"), TYPE_INT),\n-\tOPT_CALLBACK_VALUE(0, \"bool-or-int\", &type, N_(\"value is --bool or --int\"), TYPE_BOOL_OR_INT),\n-\tOPT_CALLBACK_VALUE(0, \"path\", &type, N_(\"value is a path (file or directory name)\"), TYPE_PATH),\n-\tOPT_CALLBACK_VALUE(0, \"expiry-date\", &type, N_(\"value is an expiry date\"), TYPE_EXPIRY_DATE),\n-\tOPT_GROUP(N_(\"Other\")),\n-\tOPT_BOOL('z', \"null\", &end_null, N_(\"terminate values with NUL byte\")),\n-\tOPT_BOOL(0, \"name-only\", &omit_values, N_(\"show variable names only\")),\n-\tOPT_BOOL(0, \"includes\", &respect_includes_opt, N_(\"respect include directives on lookup\")),\n-\tOPT_BOOL(0, \"show-origin\", &show_origin, N_(\"show origin of config (file, standard input, blob, command line)\")),\n-\tOPT_STRING(0, \"default\", &default_value, N_(\"value\"), N_(\"with --get, use default value when missing entry\")),\n-\tOPT_END(),\n-};\n-\n static void check_argc(int argc, int min, int max) {\n \tif (argc >= min && argc <= max)\n \t\treturn;\n-- \n2.9.3\n\n"},{"id":"353502","messageId":"xmqq1sbszevf.fsf@gitster-ct.c.googlers.com","threadId":"48947","inReplyTo":"20180724153010.6693-1-git@jeffhostetler.com","subject":"Re: [PATCH v1] config.c: fix msvc compile error","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-07-24T18:07:48Z","receivedAt":"2018-07-24T18:07:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"git@jeffhostetler.com writes:\n\n> From: Jeff Hostetler <jeffhost@microsoft.com>\n>\n> In commit fb0dc3bac135e9f6243bd6d293e8c9293c73b9cd code was added\n> to builtin/config.c to define a new function and a forward declaration\n> for an array of unknown size.  This causes a compile error under MSVC.\n>\n> Reorder the code to forward declare the function instead of the array.\n>\n> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>\n> ---\n\nSomebody please tell me why I have a feeling that I've seen this\npatch, even though it is labeled as v1...  The problem and the\nsolution seem pretty obvious and I recall somebody saying that a\nsingle pass compiler wouldn't be able to grok the forward decl.\n\n\n\n>  builtin/config.c | 79 ++++++++++++++++++++++++++++----------------------------\n>  1 file changed, 40 insertions(+), 39 deletions(-)\n>\n> diff --git a/builtin/config.c b/builtin/config.c\n> index b29d26d..564f18f 100644\n> --- a/builtin/config.c\n> +++ b/builtin/config.c\n> @@ -67,7 +67,46 @@ static int show_origin;\n>  \t{ OPTION_CALLBACK, (s), (l), (v), NULL, (h), PARSE_OPT_NOARG | \\\n>  \tPARSE_OPT_NONEG, option_parse_type, (i) }\n>  \n> -static struct option builtin_config_options[];\n> +static int option_parse_type(const struct option *opt, const char *arg,\n> +\t\t\t     int unset);\n> +\n> +static struct option builtin_config_options[] = {\n> +\tOPT_GROUP(N_(\"Config file location\")),\n> +\tOPT_BOOL(0, \"global\", &use_global_config, N_(\"use global config file\")),\n> +\tOPT_BOOL(0, \"system\", &use_system_config, N_(\"use system config file\")),\n> +\tOPT_BOOL(0, \"local\", &use_local_config, N_(\"use repository config file\")),\n> +\tOPT_STRING('f', \"file\", &given_config_source.file, N_(\"file\"), N_(\"use given config file\")),\n> +\tOPT_STRING(0, \"blob\", &given_config_source.blob, N_(\"blob-id\"), N_(\"read config from given blob object\")),\n> +\tOPT_GROUP(N_(\"Action\")),\n> +\tOPT_BIT(0, \"get\", &actions, N_(\"get value: name [value-regex]\"), ACTION_GET),\n> +\tOPT_BIT(0, \"get-all\", &actions, N_(\"get all values: key [value-regex]\"), ACTION_GET_ALL),\n> +\tOPT_BIT(0, \"get-regexp\", &actions, N_(\"get values for regexp: name-regex [value-regex]\"), ACTION_GET_REGEXP),\n> +\tOPT_BIT(0, \"get-urlmatch\", &actions, N_(\"get value specific for the URL: section[.var] URL\"), ACTION_GET_URLMATCH),\n> +\tOPT_BIT(0, \"replace-all\", &actions, N_(\"replace all matching variables: name value [value_regex]\"), ACTION_REPLACE_ALL),\n> +\tOPT_BIT(0, \"add\", &actions, N_(\"add a new variable: name value\"), ACTION_ADD),\n> +\tOPT_BIT(0, \"unset\", &actions, N_(\"remove a variable: name [value-regex]\"), ACTION_UNSET),\n> +\tOPT_BIT(0, \"unset-all\", &actions, N_(\"remove all matches: name [value-regex]\"), ACTION_UNSET_ALL),\n> +\tOPT_BIT(0, \"rename-section\", &actions, N_(\"rename section: old-name new-name\"), ACTION_RENAME_SECTION),\n> +\tOPT_BIT(0, \"remove-section\", &actions, N_(\"remove a section: name\"), ACTION_REMOVE_SECTION),\n> +\tOPT_BIT('l', \"list\", &actions, N_(\"list all\"), ACTION_LIST),\n> +\tOPT_BIT('e', \"edit\", &actions, N_(\"open an editor\"), ACTION_EDIT),\n> +\tOPT_BIT(0, \"get-color\", &actions, N_(\"find the color configured: slot [default]\"), ACTION_GET_COLOR),\n> +\tOPT_BIT(0, \"get-colorbool\", &actions, N_(\"find the color setting: slot [stdout-is-tty]\"), ACTION_GET_COLORBOOL),\n> +\tOPT_GROUP(N_(\"Type\")),\n> +\tOPT_CALLBACK('t', \"type\", &type, \"\", N_(\"value is given this type\"), option_parse_type),\n> +\tOPT_CALLBACK_VALUE(0, \"bool\", &type, N_(\"value is \\\"true\\\" or \\\"false\\\"\"), TYPE_BOOL),\n> +\tOPT_CALLBACK_VALUE(0, \"int\", &type, N_(\"value is decimal number\"), TYPE_INT),\n> +\tOPT_CALLBACK_VALUE(0, \"bool-or-int\", &type, N_(\"value is --bool or --int\"), TYPE_BOOL_OR_INT),\n> +\tOPT_CALLBACK_VALUE(0, \"path\", &type, N_(\"value is a path (file or directory name)\"), TYPE_PATH),\n> +\tOPT_CALLBACK_VALUE(0, \"expiry-date\", &type, N_(\"value is an expiry date\"), TYPE_EXPIRY_DATE),\n> +\tOPT_GROUP(N_(\"Other\")),\n> +\tOPT_BOOL('z', \"null\", &end_null, N_(\"terminate values with NUL byte\")),\n> +\tOPT_BOOL(0, \"name-only\", &omit_values, N_(\"show variable names only\")),\n> +\tOPT_BOOL(0, \"includes\", &respect_includes_opt, N_(\"respect include directives on lookup\")),\n> +\tOPT_BOOL(0, \"show-origin\", &show_origin, N_(\"show origin of config (file, standard input, blob, command line)\")),\n> +\tOPT_STRING(0, \"default\", &default_value, N_(\"value\"), N_(\"with --get, use default value when missing entry\")),\n> +\tOPT_END(),\n> +};\n>  \n>  static int option_parse_type(const struct option *opt, const char *arg,\n>  \t\t\t     int unset)\n> @@ -119,44 +158,6 @@ static int option_parse_type(const struct option *opt, const char *arg,\n>  \treturn 0;\n>  }\n>  \n> -static struct option builtin_config_options[] = {\n> -\tOPT_GROUP(N_(\"Config file location\")),\n> -\tOPT_BOOL(0, \"global\", &use_global_config, N_(\"use global config file\")),\n> -\tOPT_BOOL(0, \"system\", &use_system_config, N_(\"use system config file\")),\n> -\tOPT_BOOL(0, \"local\", &use_local_config, N_(\"use repository config file\")),\n> -\tOPT_STRING('f', \"file\", &given_config_source.file, N_(\"file\"), N_(\"use given config file\")),\n> -\tOPT_STRING(0, \"blob\", &given_config_source.blob, N_(\"blob-id\"), N_(\"read config from given blob object\")),\n> -\tOPT_GROUP(N_(\"Action\")),\n> -\tOPT_BIT(0, \"get\", &actions, N_(\"get value: name [value-regex]\"), ACTION_GET),\n> -\tOPT_BIT(0, \"get-all\", &actions, N_(\"get all values: key [value-regex]\"), ACTION_GET_ALL),\n> -\tOPT_BIT(0, \"get-regexp\", &actions, N_(\"get values for regexp: name-regex [value-regex]\"), ACTION_GET_REGEXP),\n> -\tOPT_BIT(0, \"get-urlmatch\", &actions, N_(\"get value specific for the URL: section[.var] URL\"), ACTION_GET_URLMATCH),\n> -\tOPT_BIT(0, \"replace-all\", &actions, N_(\"replace all matching variables: name value [value_regex]\"), ACTION_REPLACE_ALL),\n> -\tOPT_BIT(0, \"add\", &actions, N_(\"add a new variable: name value\"), ACTION_ADD),\n> -\tOPT_BIT(0, \"unset\", &actions, N_(\"remove a variable: name [value-regex]\"), ACTION_UNSET),\n> -\tOPT_BIT(0, \"unset-all\", &actions, N_(\"remove all matches: name [value-regex]\"), ACTION_UNSET_ALL),\n> -\tOPT_BIT(0, \"rename-section\", &actions, N_(\"rename section: old-name new-name\"), ACTION_RENAME_SECTION),\n> -\tOPT_BIT(0, \"remove-section\", &actions, N_(\"remove a section: name\"), ACTION_REMOVE_SECTION),\n> -\tOPT_BIT('l', \"list\", &actions, N_(\"list all\"), ACTION_LIST),\n> -\tOPT_BIT('e', \"edit\", &actions, N_(\"open an editor\"), ACTION_EDIT),\n> -\tOPT_BIT(0, \"get-color\", &actions, N_(\"find the color configured: slot [default]\"), ACTION_GET_COLOR),\n> -\tOPT_BIT(0, \"get-colorbool\", &actions, N_(\"find the color setting: slot [stdout-is-tty]\"), ACTION_GET_COLORBOOL),\n> -\tOPT_GROUP(N_(\"Type\")),\n> -\tOPT_CALLBACK('t', \"type\", &type, \"\", N_(\"value is given this type\"), option_parse_type),\n> -\tOPT_CALLBACK_VALUE(0, \"bool\", &type, N_(\"value is \\\"true\\\" or \\\"false\\\"\"), TYPE_BOOL),\n> -\tOPT_CALLBACK_VALUE(0, \"int\", &type, N_(\"value is decimal number\"), TYPE_INT),\n> -\tOPT_CALLBACK_VALUE(0, \"bool-or-int\", &type, N_(\"value is --bool or --int\"), TYPE_BOOL_OR_INT),\n> -\tOPT_CALLBACK_VALUE(0, \"path\", &type, N_(\"value is a path (file or directory name)\"), TYPE_PATH),\n> -\tOPT_CALLBACK_VALUE(0, \"expiry-date\", &type, N_(\"value is an expiry date\"), TYPE_EXPIRY_DATE),\n> -\tOPT_GROUP(N_(\"Other\")),\n> -\tOPT_BOOL('z', \"null\", &end_null, N_(\"terminate values with NUL byte\")),\n> -\tOPT_BOOL(0, \"name-only\", &omit_values, N_(\"show variable names only\")),\n> -\tOPT_BOOL(0, \"includes\", &respect_includes_opt, N_(\"respect include directives on lookup\")),\n> -\tOPT_BOOL(0, \"show-origin\", &show_origin, N_(\"show origin of config (file, standard input, blob, command line)\")),\n> -\tOPT_STRING(0, \"default\", &default_value, N_(\"value\"), N_(\"with --get, use default value when missing entry\")),\n> -\tOPT_END(),\n> -};\n> -\n>  static void check_argc(int argc, int min, int max) {\n>  \tif (argc >= min && argc <= max)\n>  \t\treturn;\n"},{"id":"353504","messageId":"235ae68c-f764-ba3a-c641-ef5f99507564@drbeat.li","threadId":"48947","inReplyTo":"20180724153010.6693-1-git@jeffhostetler.com","subject":"Re: [PATCH v1] config.c: fix msvc compile error","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2018-07-24T18:16:45Z","receivedAt":"2018-07-24T18:16:59Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"Hi Jeff\n\nOn 24.07.18 17:30, git@jeffhostetler.com wrote:\n> From: Jeff Hostetler <jeffhost@microsoft.com>\n> \n> In commit fb0dc3bac135e9f6243bd6d293e8c9293c73b9cd code was added\n> to builtin/config.c to define a new function and a forward declaration\n> for an array of unknown size.  This causes a compile error under MSVC.\n> \n> Reorder the code to forward declare the function instead of the array.\n\nThis was already fixed (differently) in\n<20180705183445.30901-1-dev+git@drbeat.li>.\n\nCheers,\nBeat\n\n\n> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>\n> ---\n>  builtin/config.c | 79 ++++++++++++++++++++++++++++----------------------------\n>  1 file changed, 40 insertions(+), 39 deletions(-)\n> \n> diff --git a/builtin/config.c b/builtin/config.c\n> index b29d26d..564f18f 100644\n> --- a/builtin/config.c\n> +++ b/builtin/config.c\n> @@ -67,7 +67,46 @@ static int show_origin;\n>  \t{ OPTION_CALLBACK, (s), (l), (v), NULL, (h), PARSE_OPT_NOARG | \\\n>  \tPARSE_OPT_NONEG, option_parse_type, (i) }\n>  \n> -static struct option builtin_config_options[];\n> +static int option_parse_type(const struct option *opt, const char *arg,\n> +\t\t\t     int unset);\n> +\n> +static struct option builtin_config_options[] = {\n> +\tOPT_GROUP(N_(\"Config file location\")),\n> +\tOPT_BOOL(0, \"global\", &use_global_config, N_(\"use global config file\")),\n> +\tOPT_BOOL(0, \"system\", &use_system_config, N_(\"use system config file\")),\n> +\tOPT_BOOL(0, \"local\", &use_local_config, N_(\"use repository config file\")),\n> +\tOPT_STRING('f', \"file\", &given_config_source.file, N_(\"file\"), N_(\"use given config file\")),\n> +\tOPT_STRING(0, \"blob\", &given_config_source.blob, N_(\"blob-id\"), N_(\"read config from given blob object\")),\n> +\tOPT_GROUP(N_(\"Action\")),\n> +\tOPT_BIT(0, \"get\", &actions, N_(\"get value: name [value-regex]\"), ACTION_GET),\n> +\tOPT_BIT(0, \"get-all\", &actions, N_(\"get all values: key [value-regex]\"), ACTION_GET_ALL),\n> +\tOPT_BIT(0, \"get-regexp\", &actions, N_(\"get values for regexp: name-regex [value-regex]\"), ACTION_GET_REGEXP),\n> +\tOPT_BIT(0, \"get-urlmatch\", &actions, N_(\"get value specific for the URL: section[.var] URL\"), ACTION_GET_URLMATCH),\n> +\tOPT_BIT(0, \"replace-all\", &actions, N_(\"replace all matching variables: name value [value_regex]\"), ACTION_REPLACE_ALL),\n> +\tOPT_BIT(0, \"add\", &actions, N_(\"add a new variable: name value\"), ACTION_ADD),\n> +\tOPT_BIT(0, \"unset\", &actions, N_(\"remove a variable: name [value-regex]\"), ACTION_UNSET),\n> +\tOPT_BIT(0, \"unset-all\", &actions, N_(\"remove all matches: name [value-regex]\"), ACTION_UNSET_ALL),\n> +\tOPT_BIT(0, \"rename-section\", &actions, N_(\"rename section: old-name new-name\"), ACTION_RENAME_SECTION),\n> +\tOPT_BIT(0, \"remove-section\", &actions, N_(\"remove a section: name\"), ACTION_REMOVE_SECTION),\n> +\tOPT_BIT('l', \"list\", &actions, N_(\"list all\"), ACTION_LIST),\n> +\tOPT_BIT('e', \"edit\", &actions, N_(\"open an editor\"), ACTION_EDIT),\n> +\tOPT_BIT(0, \"get-color\", &actions, N_(\"find the color configured: slot [default]\"), ACTION_GET_COLOR),\n> +\tOPT_BIT(0, \"get-colorbool\", &actions, N_(\"find the color setting: slot [stdout-is-tty]\"), ACTION_GET_COLORBOOL),\n> +\tOPT_GROUP(N_(\"Type\")),\n> +\tOPT_CALLBACK('t', \"type\", &type, \"\", N_(\"value is given this type\"), option_parse_type),\n> +\tOPT_CALLBACK_VALUE(0, \"bool\", &type, N_(\"value is \\\"true\\\" or \\\"false\\\"\"), TYPE_BOOL),\n> +\tOPT_CALLBACK_VALUE(0, \"int\", &type, N_(\"value is decimal number\"), TYPE_INT),\n> +\tOPT_CALLBACK_VALUE(0, \"bool-or-int\", &type, N_(\"value is --bool or --int\"), TYPE_BOOL_OR_INT),\n> +\tOPT_CALLBACK_VALUE(0, \"path\", &type, N_(\"value is a path (file or directory name)\"), TYPE_PATH),\n> +\tOPT_CALLBACK_VALUE(0, \"expiry-date\", &type, N_(\"value is an expiry date\"), TYPE_EXPIRY_DATE),\n> +\tOPT_GROUP(N_(\"Other\")),\n> +\tOPT_BOOL('z', \"null\", &end_null, N_(\"terminate values with NUL byte\")),\n> +\tOPT_BOOL(0, \"name-only\", &omit_values, N_(\"show variable names only\")),\n> +\tOPT_BOOL(0, \"includes\", &respect_includes_opt, N_(\"respect include directives on lookup\")),\n> +\tOPT_BOOL(0, \"show-origin\", &show_origin, N_(\"show origin of config (file, standard input, blob, command line)\")),\n> +\tOPT_STRING(0, \"default\", &default_value, N_(\"value\"), N_(\"with --get, use default value when missing entry\")),\n> +\tOPT_END(),\n> +};\n>  \n>  static int option_parse_type(const struct option *opt, const char *arg,\n>  \t\t\t     int unset)\n> @@ -119,44 +158,6 @@ static int option_parse_type(const struct option *opt, const char *arg,\n>  \treturn 0;\n>  }\n>  \n> -static struct option builtin_config_options[] = {\n> -\tOPT_GROUP(N_(\"Config file location\")),\n> -\tOPT_BOOL(0, \"global\", &use_global_config, N_(\"use global config file\")),\n> -\tOPT_BOOL(0, \"system\", &use_system_config, N_(\"use system config file\")),\n> -\tOPT_BOOL(0, \"local\", &use_local_config, N_(\"use repository config file\")),\n> -\tOPT_STRING('f', \"file\", &given_config_source.file, N_(\"file\"), N_(\"use given config file\")),\n> -\tOPT_STRING(0, \"blob\", &given_config_source.blob, N_(\"blob-id\"), N_(\"read config from given blob object\")),\n> -\tOPT_GROUP(N_(\"Action\")),\n> -\tOPT_BIT(0, \"get\", &actions, N_(\"get value: name [value-regex]\"), ACTION_GET),\n> -\tOPT_BIT(0, \"get-all\", &actions, N_(\"get all values: key [value-regex]\"), ACTION_GET_ALL),\n> -\tOPT_BIT(0, \"get-regexp\", &actions, N_(\"get values for regexp: name-regex [value-regex]\"), ACTION_GET_REGEXP),\n> -\tOPT_BIT(0, \"get-urlmatch\", &actions, N_(\"get value specific for the URL: section[.var] URL\"), ACTION_GET_URLMATCH),\n> -\tOPT_BIT(0, \"replace-all\", &actions, N_(\"replace all matching variables: name value [value_regex]\"), ACTION_REPLACE_ALL),\n> -\tOPT_BIT(0, \"add\", &actions, N_(\"add a new variable: name value\"), ACTION_ADD),\n> -\tOPT_BIT(0, \"unset\", &actions, N_(\"remove a variable: name [value-regex]\"), ACTION_UNSET),\n> -\tOPT_BIT(0, \"unset-all\", &actions, N_(\"remove all matches: name [value-regex]\"), ACTION_UNSET_ALL),\n> -\tOPT_BIT(0, \"rename-section\", &actions, N_(\"rename section: old-name new-name\"), ACTION_RENAME_SECTION),\n> -\tOPT_BIT(0, \"remove-section\", &actions, N_(\"remove a section: name\"), ACTION_REMOVE_SECTION),\n> -\tOPT_BIT('l', \"list\", &actions, N_(\"list all\"), ACTION_LIST),\n> -\tOPT_BIT('e', \"edit\", &actions, N_(\"open an editor\"), ACTION_EDIT),\n> -\tOPT_BIT(0, \"get-color\", &actions, N_(\"find the color configured: slot [default]\"), ACTION_GET_COLOR),\n> -\tOPT_BIT(0, \"get-colorbool\", &actions, N_(\"find the color setting: slot [stdout-is-tty]\"), ACTION_GET_COLORBOOL),\n> -\tOPT_GROUP(N_(\"Type\")),\n> -\tOPT_CALLBACK('t', \"type\", &type, \"\", N_(\"value is given this type\"), option_parse_type),\n> -\tOPT_CALLBACK_VALUE(0, \"bool\", &type, N_(\"value is \\\"true\\\" or \\\"false\\\"\"), TYPE_BOOL),\n> -\tOPT_CALLBACK_VALUE(0, \"int\", &type, N_(\"value is decimal number\"), TYPE_INT),\n> -\tOPT_CALLBACK_VALUE(0, \"bool-or-int\", &type, N_(\"value is --bool or --int\"), TYPE_BOOL_OR_INT),\n> -\tOPT_CALLBACK_VALUE(0, \"path\", &type, N_(\"value is a path (file or directory name)\"), TYPE_PATH),\n> -\tOPT_CALLBACK_VALUE(0, \"expiry-date\", &type, N_(\"value is an expiry date\"), TYPE_EXPIRY_DATE),\n> -\tOPT_GROUP(N_(\"Other\")),\n> -\tOPT_BOOL('z', \"null\", &end_null, N_(\"terminate values with NUL byte\")),\n> -\tOPT_BOOL(0, \"name-only\", &omit_values, N_(\"show variable names only\")),\n> -\tOPT_BOOL(0, \"includes\", &respect_includes_opt, N_(\"respect include directives on lookup\")),\n> -\tOPT_BOOL(0, \"show-origin\", &show_origin, N_(\"show origin of config (file, standard input, blob, command line)\")),\n> -\tOPT_STRING(0, \"default\", &default_value, N_(\"value\"), N_(\"with --get, use default value when missing entry\")),\n> -\tOPT_END(),\n> -};\n> -\n>  static void check_argc(int argc, int min, int max) {\n>  \tif (argc >= min && argc <= max)\n>  \t\treturn;\n> \n\n"},{"id":"353506","messageId":"xmqqwotkxzn0.fsf@gitster-ct.c.googlers.com","threadId":"48947","inReplyTo":"235ae68c-f764-ba3a-c641-ef5f99507564@drbeat.li","subject":"Re: [PATCH v1] config.c: fix msvc compile error","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-07-24T18:22:11Z","receivedAt":"2018-07-24T18:22:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Beat Bolli <dev+git@drbeat.li> writes:\n\n> Hi Jeff\n>\n> On 24.07.18 17:30, git@jeffhostetler.com wrote:\n>> From: Jeff Hostetler <jeffhost@microsoft.com>\n>> \n>> In commit fb0dc3bac135e9f6243bd6d293e8c9293c73b9cd code was added\n>> to builtin/config.c to define a new function and a forward declaration\n>> for an array of unknown size.  This causes a compile error under MSVC.\n>> \n>> Reorder the code to forward declare the function instead of the array.\n>\n> This was already fixed (differently) in\n> <20180705183445.30901-1-dev+git@drbeat.li>.\n\nThanks for saving me from having to dig the list archive myself.\nYes, it is already applied to the tip of the topic that originally\ncaused the breakage.\n"},{"id":"353507","messageId":"8fd2fe53-ff42-5e21-a485-a38c97331b9c@drbeat.li","threadId":"48947","inReplyTo":"xmqqwotkxzn0.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v1] config.c: fix msvc compile error","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2018-07-24T18:26:50Z","receivedAt":"2018-07-24T18:27:03Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"On 24.07.18 20:22, Junio C Hamano wrote:\n> Beat Bolli <dev+git@drbeat.li> writes:\n> \n>> Hi Jeff\n>>\n>> On 24.07.18 17:30, git@jeffhostetler.com wrote:\n>>> From: Jeff Hostetler <jeffhost@microsoft.com>\n>>>\n>>> In commit fb0dc3bac135e9f6243bd6d293e8c9293c73b9cd code was added\n>>> to builtin/config.c to define a new function and a forward declaration\n>>> for an array of unknown size.  This causes a compile error under MSVC.\n>>>\n>>> Reorder the code to forward declare the function instead of the array.\n>>\n>> This was already fixed (differently) in\n>> <20180705183445.30901-1-dev+git@drbeat.li>.\n> \n> Thanks for saving me from having to dig the list archive myself.\n> Yes, it is already applied to the tip of the topic that originally\n> caused the breakage.\n> \nJust a general question:\n\nIs it OK to refer to patches on pu with the Message-ID, or would you\nprefer the commit hash? The hash changes whenever you recreate pu,\ndoesn't it?\n\nBeat\n"},{"id":"353509","messageId":"xmqqr2jsxybd.fsf@gitster-ct.c.googlers.com","threadId":"48947","inReplyTo":"8fd2fe53-ff42-5e21-a485-a38c97331b9c@drbeat.li","subject":"Re: [PATCH v1] config.c: fix msvc compile error","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-07-24T18:50:46Z","receivedAt":"2018-07-24T18:50:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Beat Bolli <dev+git@drbeat.li> writes:\n\n> On 24.07.18 20:22, Junio C Hamano wrote:\n>\n>>> This was already fixed (differently) in\n>>> <20180705183445.30901-1-dev+git@drbeat.li>.\n>> \n>> Thanks for saving me from having to dig the list archive myself.\n>> Yes, it is already applied to the tip of the topic that originally\n>> caused the breakage.\n>> \n> Just a general question:\n>\n> Is it OK to refer to patches on pu with the Message-ID, or would you\n> prefer the commit hash? The hash changes whenever you recreate pu,\n> doesn't it?\n\nEither is fine in practice.  The commits themselves on a topic\nbranch that is not yet in 'next' usually stay the same once the tip\nof 'pu' that contains them gets published.  Even though I often use\n\"git rebase -i\", \"git commit --amend\", etc. to fix up posted patches\nwhile turning them into commits on topic branches, I usually stop\ndoing so once I push out day's integration result.\n\nUntil a new version of the series is posted to replace them on the\ntopic branch, that is.  But at that point we are talking about new\npatches with different message-ids that got turned into different\ncommit objects, so either commit object name or message id that\nrefer to older iteration would still name the same old version, and\nnew names would refer to the same new version.\n\n"},{"id":"353513","messageId":"559fda9d-80b4-64db-e8a4-a886902f28c3@drbeat.li","threadId":"48947","inReplyTo":"xmqqr2jsxybd.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v1] config.c: fix msvc compile error","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2018-07-24T19:16:33Z","receivedAt":"2018-07-24T19:16:43Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"On 24.07.18 20:50, Junio C Hamano wrote:\n> Beat Bolli <dev+git@drbeat.li> writes:\n> \n>> On 24.07.18 20:22, Junio C Hamano wrote:\n>>\n>>>> This was already fixed (differently) in\n>>>> <20180705183445.30901-1-dev+git@drbeat.li>.\n>>>\n>>> Thanks for saving me from having to dig the list archive myself.\n>>> Yes, it is already applied to the tip of the topic that originally\n>>> caused the breakage.\n>>>\n>> Just a general question:\n>>\n>> Is it OK to refer to patches on pu with the Message-ID, or would you\n>> prefer the commit hash? The hash changes whenever you recreate pu,\n>> doesn't it?\n> \n> Either is fine in practice.  The commits themselves on a topic\n> branch that is not yet in 'next' usually stay the same once the tip\n> of 'pu' that contains them gets published.  Even though I often use\n> \"git rebase -i\", \"git commit --amend\", etc. to fix up posted patches\n> while turning them into commits on topic branches, I usually stop\n> doing so once I push out day's integration result.\n> \n> Until a new version of the series is posted to replace them on the\n> topic branch, that is.  But at that point we are talking about new\n> patches with different message-ids that got turned into different\n> commit objects, so either commit object name or message id that\n> refer to older iteration would still name the same old version, and\n> new names would refer to the same new version.\n> \n\nOk, thanks!\n\n"},{"id":"353521","messageId":"20180724195637.GA97109@syl.attlocal.net","threadId":"48947","inReplyTo":"20180724153010.6693-1-git@jeffhostetler.com","subject":"Re: [PATCH v1] config.c: fix msvc compile error","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2018-07-24T19:56:37Z","receivedAt":"2018-07-24T19:56:42Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Tue, Jul 24, 2018 at 03:30:10PM +0000, git@jeffhostetler.com wrote:\n> From: Jeff Hostetler <jeffhost@microsoft.com>\n>\n> In commit fb0dc3bac135e9f6243bd6d293e8c9293c73b9cd code was added\n> to builtin/config.c to define a new function and a forward declaration\n> for an array of unknown size.  This causes a compile error under MSVC.\n\nThanks for spending time fixing that. fb0dc3bac1 (builtin/config.c:\nsupport `--type=<type>` as preferred alias for `--<type>`, 2018-04-18)\nis from me, so I owe you an extra thanks for patching up mistakes :-).\n\nAs others have noted in this thread, another patch was sent into similar\neffect, which has already been queued, and I agree that we should prefer\nthat, since it's further along.\n\n\nThanks,\nTaylor\n"},{"id":"353563","messageId":"ca10e6f5-91be-e2a9-19a8-37b67217d134@jeffhostetler.com","threadId":"48947","inReplyTo":"20180724195637.GA97109@syl.attlocal.net","subject":"Re: [PATCH v1] config.c: fix msvc compile error","fromName":"Jeff Hostetler","fromEmail":"git@jeffhostetler.com","sentAt":"2018-07-25T12:51:52Z","receivedAt":"2018-07-25T12:51:56Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"\n\nOn 7/24/2018 3:56 PM, Taylor Blau wrote:\n> On Tue, Jul 24, 2018 at 03:30:10PM +0000, git@jeffhostetler.com wrote:\n>> From: Jeff Hostetler <jeffhost@microsoft.com>\n>>\n>> In commit fb0dc3bac135e9f6243bd6d293e8c9293c73b9cd code was added\n>> to builtin/config.c to define a new function and a forward declaration\n>> for an array of unknown size.  This causes a compile error under MSVC.\n> \n> Thanks for spending time fixing that. fb0dc3bac1 (builtin/config.c:\n> support `--type=<type>` as preferred alias for `--<type>`, 2018-04-18)\n> is from me, so I owe you an extra thanks for patching up mistakes :-).\n> \n> As others have noted in this thread, another patch was sent into similar\n> effect, which has already been queued, and I agree that we should prefer\n> that, since it's further along.\n> \n> \n> Thanks,\n> Taylor\n> \n\nYes, the other version is further along.  Let's take it.\nJeff\n"}]}