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

[PATCH 5/6] Allow Specification of the conf file to read for git_config operations

From
MAMartin Atukunda <matlads@dsmagic.com>
Date
Nov 22, 2005, 00:28 UTC
Message-ID
<11326192933767-git-send-email-matlads@dsmagic.com>
In-Reply-To
<11326192921291-git-send-email-matlads@dsmagic.com>

This patch adds a git_config_from_file which allows us to specify the config file to use for git_config operations.

Signed-Off-By: Martin Atukunda <matlads@dsmagic.com>
---
 cache.h  |    1 +
 config.c |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

applies-to: d6c3faa0566795b1c74e693ecc004439c116e6c6 39e4ab307abb445115f3c9ee0e09ed1812568247

diff --git a/cache.h b/cache.h
index a455373..48018ab 100644
--- a/cache.h
+++ b/cache.h
@@ -388,6 +388,7 @@ extern int gitfakemunmap(void *start, si
 
 typedef int (*config_fn_t)(const char *, const char *);
 extern int git_default_config(const char *, const char *);
+extern int git_config_from_file(const char *, config_fn_t fn);
 extern int git_config(config_fn_t fn);
 extern int git_config_int(const char *, const char *);
 extern int git_config_bool(const char *, const char *);
diff --git a/config.c b/config.c
index 5d237c8..c5a5312 100644
--- a/config.c
+++ b/config.c
@@ -245,11 +245,10 @@ int git_default_config(const char *var, 
 	return 0;
 }
 
-int git_config(config_fn_t fn)
+int git_config_from_file(const char *confpath, config_fn_t fn)
 {
 	int ret;
-	FILE *f = fopen(git_path("config"), "r");
-
+	FILE *f = fopen(confpath, "r");
 	ret = -1;
 	if (f) {
 		config_file = f;
@@ -260,6 +259,11 @@ int git_config(config_fn_t fn)
 	return ret;
 }
 
+int git_config(config_fn_t fn)
+{
+	return git_config_from_file(git_path("config"), fn);
+}
+
 /*
  * Find all the stuff for git_config_set() below.
  */
---
0.99.9.GIT
Previous: Junio C HamanoNext: Martin Atukunda
Message 10 of 12 in “Git Future Proofing”
  1. Martin AtukundaNov 22, 2005
  2. 2/6 Make init-db check repo format version if copying a config file.Martin Atukunda, Nov 22, 2005
  3. 3/6 Make get_git_dir take a flag that makes it re-read the env. variablesMartin Atukunda, Nov 22, 2005
  4. 1/6 Add GIT_REPO_VERSION, and repository_format_versionMartin Atukunda, Nov 22, 2005
  5. 4/6 Add check_repo_format check for all major operations.Martin Atukunda, Nov 22, 2005
  6. Junio C HamanoNov 22, 2005
  7. Martin AtukundaNov 22, 2005
  8. Junio C HamanoNov 22, 2005
  9. Junio C HamanoNov 23, 2005
  10. 5/6 Allow Specification of the conf file to read for git_config operationsMartin Atukunda, Nov 22, 2005
  11. 6/6 Add check for downgrading of repo format version via init-dbMartin Atukunda, Nov 22, 2005
  12. Junio C HamanoNov 22, 2005

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.