summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: edde7a8)
raw | patch | inline | side by side (parent: edde7a8)
author | Sven Verdoolaege <skimo@kotnet.org> | |
Mon, 26 Sep 2005 20:54:01 +0000 (22:54 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 27 Sep 2005 07:16:39 +0000 (00:16 -0700) |
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
cache.h | patch | blob | history | |
fsck-objects.c | patch | blob | history | |
path.c | patch | blob | history | |
sha1_file.c | patch | blob | history |
index 6f3d39da73a2340857474fe57482897cea7ceee8..52a45f9c9a3f487ca7ba773d72109c3daca0685d 100644 (file)
--- a/cache.h
+++ b/cache.h
#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
#define GRAFT_ENVIRONMENT "GIT_GRAFT_FILE"
+extern char *get_git_dir(void);
extern char *get_object_directory(void);
extern char *get_refs_directory(void);
extern char *get_index_file(void);
diff --git a/fsck-objects.c b/fsck-objects.c
index 6cb0f29be8a1eed5c22c90894560e399aa537f56..b82685fd718b0269bee4153badd391e9218a2b29 100644 (file)
--- a/fsck-objects.c
+++ b/fsck-objects.c
char hex[40];
unsigned char sha1[20];
static char path[PATH_MAX], link[PATH_MAX];
- const char *git_dir;
-
- git_dir = getenv(GIT_DIR_ENVIRONMENT);
- if (!git_dir) git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
+ const char *git_dir = get_git_dir();
snprintf(path, sizeof(path), "%s/HEAD", git_dir);
if (readlink(path, link, sizeof(link)) < 0)
index f788028a63dbd9b34563d2589697f4b5d65b8648..495d17ca4ca371f4b5bdb6f1f3de9a6a9d84280b 100644 (file)
--- a/path.c
+++ b/path.c
char *git_path(const char *fmt, ...)
{
- const char *git_dir;
+ const char *git_dir = get_git_dir();
va_list args;
unsigned len;
- git_dir = getenv(GIT_DIR_ENVIRONMENT);
- if (!git_dir) git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
len = strlen(git_dir);
if (len > PATH_MAX-100)
return bad_path;
diff --git a/sha1_file.c b/sha1_file.c
index 66382027816e8ec3a97c40f6849c62454f2ad0f2..fe374c6132a74641959e201f8c03dd9952e9acee 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
git_graft_file = strdup(git_path("info/grafts"));
}
+char *get_git_dir(void)
+{
+ if (!git_dir)
+ setup_git_env();
+ return git_dir;
+}
+
char *get_object_directory(void)
{
if (!git_object_dir)