Commit 2ea14da648fb87a0b2e756227b385091bf1b0550

Vicent Marti 2011-12-15T18:14:41

config: Return ENOTFOUND when a variable was deleted

diff --git a/src/config_file.c b/src/config_file.c
index 7a58652..45b43b7 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -391,17 +391,15 @@ static int config_set(git_config_file *cfg, const char *name, const char *value)
 static int config_get(git_config_file *cfg, const char *name, const char **out)
 {
 	cvar_t *var;
-	int error = GIT_SUCCESS;
 	diskfile_backend *b = (diskfile_backend *)cfg;
 
 	var = cvar_list_find(&b->var_list, name);
 
-	if (var == NULL)
+	if (var == NULL || var->value == NULL)
 		return git__throw(GIT_ENOTFOUND, "Variable '%s' not found", name);
 
 	*out = var->value;
-
-	return error == GIT_SUCCESS ? GIT_SUCCESS : git__rethrow(error, "Failed to get config value for %s", name);
+	return GIT_SUCCESS;
 }
 
 int git_config_file__ondisk(git_config_file **out, const char *path)