Message ID | b40480f03a5643761bd06d4b9c495a99b98a1ac8.1578565001.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | config: allow user to know scope of config options | expand |
"Matthew Rogers via GitGitGadget" <gitgitgadget@gmail.com> writes: > From: Matthew Rogers <mattr94@gmail.com> > > In git config use of the end_null variable to determine if we should be > null terminating our output. While it is correct to say a string is > "null terminated" the character is actually the "nul" character, so this > malapropism is being fixed. > > Signed-off-by: Matthew Rogers <mattr94@gmail.com> > --- > builtin/config.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) Obviously correct. Malapropism is a new word in "git log" output in our history ;-) > diff --git a/builtin/config.c b/builtin/config.c > index 98d65bc0ad..52a904cfb1 100644 > --- a/builtin/config.c > +++ b/builtin/config.c > @@ -29,7 +29,7 @@ static int use_worktree_config; > static struct git_config_source given_config_source; > static int actions, type; > static char *default_value; > -static int end_null; > +static int end_nul; > static int respect_includes_opt = -1; > static struct config_options config_options; > static int show_origin; > @@ -151,7 +151,7 @@ static struct option builtin_config_options[] = { > OPT_CALLBACK_VALUE(0, "path", &type, N_("value is a path (file or directory name)"), TYPE_PATH), > OPT_CALLBACK_VALUE(0, "expiry-date", &type, N_("value is an expiry date"), TYPE_EXPIRY_DATE), > OPT_GROUP(N_("Other")), > - OPT_BOOL('z', "null", &end_null, N_("terminate values with NUL byte")), > + OPT_BOOL('z', "null", &end_nul, N_("terminate values with NUL byte")), > OPT_BOOL(0, "name-only", &omit_values, N_("show variable names only")), > OPT_BOOL(0, "includes", &respect_includes_opt, N_("respect include directives on lookup")), > OPT_BOOL(0, "show-origin", &show_origin, N_("show origin of config (file, standard input, blob, command line)")), > @@ -178,11 +178,11 @@ static void check_argc(int argc, int min, int max) > > static void show_config_origin(struct strbuf *buf) > { > - const char term = end_null ? '\0' : '\t'; > + const char term = end_nul ? '\0' : '\t'; > > strbuf_addstr(buf, current_config_origin_type()); > strbuf_addch(buf, ':'); > - if (end_null) > + if (end_nul) > strbuf_addstr(buf, current_config_name()); > else > quote_c_style(current_config_name(), buf, NULL, 0); > @@ -678,7 +678,7 @@ int cmd_config(int argc, const char **argv, const char *prefix) > config_options.git_dir = get_git_dir(); > } > > - if (end_null) { > + if (end_nul) { > term = '\0'; > delim = '\n'; > key_delim = '\n';
> > Malapropism is a new word in "git log" output in our history ;-) > Yeah, I remember my coworker saying that to me the day I wrote the message and it was just stuck in my head
On Thu, Jan 09, 2020 at 10:16:38AM +0000, Matthew Rogers via GitGitGadget wrote: > - OPT_BOOL('z', "null", &end_null, N_("terminate values with NUL byte")), > + OPT_BOOL('z', "null", &end_nul, N_("terminate values with NUL byte")), The user-facing option is still spelled "null". Obviously we can't just change that, but if we are trying to prefer "nul", should we offer both? I think we actually _do_ allow "--nul" because of parse-option's willingness to accept a partial name. But if we wanted to advertise one over the other in "-h", then we'd have to set up the alias ourselves. Interestingly, "xargs" (and GNU grep) spells it as "--null", so perhaps that's an argument to keep it as-is. Likewise if we accept that "null termination" is a correct name, I suppose. -Peff
diff --git a/builtin/config.c b/builtin/config.c index 98d65bc0ad..52a904cfb1 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -29,7 +29,7 @@ static int use_worktree_config; static struct git_config_source given_config_source; static int actions, type; static char *default_value; -static int end_null; +static int end_nul; static int respect_includes_opt = -1; static struct config_options config_options; static int show_origin; @@ -151,7 +151,7 @@ static struct option builtin_config_options[] = { OPT_CALLBACK_VALUE(0, "path", &type, N_("value is a path (file or directory name)"), TYPE_PATH), OPT_CALLBACK_VALUE(0, "expiry-date", &type, N_("value is an expiry date"), TYPE_EXPIRY_DATE), OPT_GROUP(N_("Other")), - OPT_BOOL('z', "null", &end_null, N_("terminate values with NUL byte")), + OPT_BOOL('z', "null", &end_nul, N_("terminate values with NUL byte")), OPT_BOOL(0, "name-only", &omit_values, N_("show variable names only")), OPT_BOOL(0, "includes", &respect_includes_opt, N_("respect include directives on lookup")), OPT_BOOL(0, "show-origin", &show_origin, N_("show origin of config (file, standard input, blob, command line)")), @@ -178,11 +178,11 @@ static void check_argc(int argc, int min, int max) static void show_config_origin(struct strbuf *buf) { - const char term = end_null ? '\0' : '\t'; + const char term = end_nul ? '\0' : '\t'; strbuf_addstr(buf, current_config_origin_type()); strbuf_addch(buf, ':'); - if (end_null) + if (end_nul) strbuf_addstr(buf, current_config_name()); else quote_c_style(current_config_name(), buf, NULL, 0); @@ -678,7 +678,7 @@ int cmd_config(int argc, const char **argv, const char *prefix) config_options.git_dir = get_git_dir(); } - if (end_null) { + if (end_nul) { term = '\0'; delim = '\n'; key_delim = '\n';