git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] config: simplify git_config_include()

From
René Scharfe <l.s.r@web.de>
Date
Aug 30, 2014, 16:07 UTC
Message-ID
<5401F6A9.2000104@web.de>

Instead of using skip_prefix() to check the first part of the string and then strcmp() to check the rest, simply use strcmp() to check the whole string.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 config.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/config.c b/config.c
index 058505c..c558a21 100644
--- a/config.c
+++ b/config.c
@@ -127,7 +127,6 @@ static int handle_path_include(const char *path, struct config_include_data *inc
 int git_config_include(const char *var, const char *value, void *data)
 {
 	struct config_include_data *inc = data;
-	const char *type;
 	int ret;
 
 	/*
@@ -138,10 +137,7 @@ int git_config_include(const char *var, const char *value, void *data)
 	if (ret < 0)
 		return ret;
 
-	if (!skip_prefix(var, "include.", &type))
-		return ret;
-
-	if (!strcmp(type, "path"))
+	if (!strcmp(var, "include.path"))
 		ret = handle_path_include(value, inc);
 	return ret;
 }
-- 
2.1.0
Message 1 of 1 in “config: simplify git_config_include()”
  1. config: simplify git_config_include()René Scharfe, Aug 30, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.