git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Martin Koegler <mkoegler@auto.tuwien.ac.at>
Subject: [PATCH] guard config parser from value=NULL
Date: Sat,  9 Feb 2008 18:05:24 +0100	[thread overview]
Message-ID: <12025767241532-git-send-email-mkoegler@auto.tuwien.ac.at> (raw)

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
 config.c |   10 +++++-----
 setup.c  |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/config.c b/config.c
index 658a11c..b2ea263 100644
--- a/config.c
+++ b/config.c
@@ -416,7 +416,7 @@ int git_default_config(const char *var, const char *value)
 		return 0;
 	}
 
-	if (!strcmp(var, "user.name")) {
+	if (value && !strcmp(var, "user.name")) {
 		strlcpy(git_default_name, value, sizeof(git_default_name));
 		return 0;
 	}
@@ -426,12 +426,12 @@ int git_default_config(const char *var, const char *value)
 		return 0;
 	}
 
-	if (!strcmp(var, "i18n.commitencoding")) {
+	if (value && !strcmp(var, "i18n.commitencoding")) {
 		git_commit_encoding = xstrdup(value);
 		return 0;
 	}
 
-	if (!strcmp(var, "i18n.logoutputencoding")) {
+	if (value && !strcmp(var, "i18n.logoutputencoding")) {
 		git_log_output_encoding = xstrdup(value);
 		return 0;
 	}
@@ -442,12 +442,12 @@ int git_default_config(const char *var, const char *value)
 		return 0;
 	}
 
-	if (!strcmp(var, "core.pager")) {
+	if (value && !strcmp(var, "core.pager")) {
 		pager_program = xstrdup(value);
 		return 0;
 	}
 
-	if (!strcmp(var, "core.editor")) {
+	if (value && !strcmp(var, "core.editor")) {
 		editor_program = xstrdup(value);
 		return 0;
 	}
diff --git a/setup.c b/setup.c
index 23c9a11..8d792dc 100644
--- a/setup.c
+++ b/setup.c
@@ -445,7 +445,7 @@ int check_repository_format_version(const char *var, const char *value)
 		is_bare_repository_cfg = git_config_bool(var, value);
 		if (is_bare_repository_cfg == 1)
 			inside_work_tree = -1;
-	} else if (strcmp(var, "core.worktree") == 0) {
+	} else if (value && strcmp(var, "core.worktree") == 0) {
 		if (git_work_tree_cfg)
 			free(git_work_tree_cfg);
 		git_work_tree_cfg = xstrdup(value);
-- 
1.5.4.gbd71f

             reply	other threads:[~2008-02-09 17:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-09 17:05 Martin Koegler [this message]
2008-02-09 21:07 ` [PATCH] guard config parser from value=NULL Junio C Hamano
2008-02-10 17:08   ` Martin Koegler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12025767241532-git-send-email-mkoegler@auto.tuwien.ac.at \
    --to=mkoegler@auto.tuwien.ac.at \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).