[PATCH 3/9] Suppress warnings from "git var -l"
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:47:42
Subsystem:
the rest · Maintainer:
Linus Torvalds
For scripts using "git var -l" to read all logical variables at once, not all per-variable warnings will be relevant. So suppress them. Signed-off-by: Jonathan Nieder <redacted> --- This is a separate issue that might even deserve to be ejected from the series. Changes from jn/editor-pager: unsquashed from the next patch, added back comment-changing hunk. Of course, there’s no harm in omitting the comment change, but it describes a change in reality: before this patch, that code gets run multiple times by "git var -l"; afterwards, by no one (except possible out-of-tree users). ident.c | 2 +- var.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ident.c b/ident.c
index 99f1c85..26409b2 100644
--- a/ident.c
+++ b/ident.c@@ -205,7 +205,7 @@ const char *fmt_ident(const char *name, const char *email, if ((warn_on_no_name || error_on_no_name) && name == git_default_name && env_hint) { fprintf(stderr, env_hint, au_env, co_env); - env_hint = NULL; /* warn only once, for "git var -l" */ + env_hint = NULL; /* warn only once */ } if (error_on_no_name) die("empty ident %s <%s> not allowed", name, email);
diff --git a/var.c b/var.c
index 125c0d1..dacbaab 100644
--- a/var.c
+++ b/var.c@@ -22,7 +22,7 @@ static void list_vars(void) { struct git_var *ptr; for (ptr = git_vars; ptr->read; ptr++) - printf("%s=%s\n", ptr->name, ptr->read(IDENT_WARN_ON_NO_NAME)); + printf("%s=%s\n", ptr->name, ptr->read(0)); } static const char *read_var(const char *var)
--
1.6.5.2