git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Atukunda <matlads@dsmagic.com>
To: git@vger.kernel.org
Cc: Martin Atukunda <matlads@dsmagic.com>
Subject: [PATCH 5/6] Allow Specification of the conf file to read for git_config operations
Date: Tue, 22 Nov 2005 03:28:13 +0300	[thread overview]
Message-ID: <11326192933767-git-send-email-matlads@dsmagic.com> (raw)
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

  parent reply	other threads:[~2005-11-22  0:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-22  0:28 Git Future Proofing Martin Atukunda
2005-11-22  0:28 ` [PATCH 2/6] Make init-db check repo format version if copying a config file Martin Atukunda
2005-11-22  0:28 ` [PATCH 3/6] Make get_git_dir take a flag that makes it re-read the env. variables Martin Atukunda
2005-11-22  0:28 ` [PATCH 1/6] Add GIT_REPO_VERSION, and repository_format_version Martin Atukunda
2005-11-22  0:28 ` Martin Atukunda [this message]
2005-11-22  0:28 ` [PATCH 6/6] Add check for downgrading of repo format version via init-db Martin Atukunda
2005-11-22  0:28 ` [PATCH 4/6] Add check_repo_format check for all major operations Martin Atukunda
2005-11-22  8:29   ` Junio C Hamano
2005-11-22 12:55     ` Martin Atukunda
2005-11-22 17:46       ` Junio C Hamano
2005-11-23  0:57         ` Junio C Hamano
2005-11-22  1:13 ` Git Future Proofing Junio C Hamano

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=11326192933767-git-send-email-matlads@dsmagic.com \
    --to=matlads@dsmagic.com \
    --cc=git@vger.kernel.org \
    /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).