summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e663674)
raw | patch | inline | side by side (parent: e663674)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Wed, 1 Aug 2007 00:29:38 +0000 (01:29 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 1 Aug 2007 07:38:31 +0000 (00:38 -0700) |
With the function set_git_dir() you can reset the path that will
be used for git_path(), git_dir() and friends.
The responsibility to close files and throw away information from the
old git_dir lies with the caller.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
be used for git_path(), git_dir() and friends.
The responsibility to close files and throw away information from the
old git_dir lies with the caller.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h | patch | blob | history | |
environment.c | patch | blob | history |
index 98af53040d1e0274895237fdf6a3699b91bdb20f..e1f94cbade4574d496f965694f2a2e3e5c21027b 100644 (file)
--- a/cache.h
+++ b/cache.h
extern char *get_refs_directory(void);
extern char *get_index_file(void);
extern char *get_graft_file(void);
+extern int set_git_dir(const char *path);
#define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
diff --git a/environment.c b/environment.c
index f83fb9e44806c03cde06eede7888a4dcb901c5c3..a571fae607d56fedc5353c5e8e0206fdc4e59c06 100644 (file)
--- a/environment.c
+++ b/environment.c
setup_git_env();
return git_graft_file;
}
+
+int set_git_dir(const char *path)
+{
+ if (setenv(GIT_DIR_ENVIRONMENT, path, 1))
+ return error("Could not set GIT_DIR to '%s'", path);
+ setup_git_env();
+ return 0;
+}