From 0270083ded143fd49841e3d3d0cac5eb06081d2a Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Mon, 3 Jul 2006 22:48:03 +0200 Subject: Make it possible to set up libgit directly (instead of from the environment) This introduces a setup_git() function which is essentialy a (public) backend for setup_git_env() which lets anyone specify custom sources for the various paths instead of environment variables. Since the repositories may get switched on the fly, this also updates code that caches paths to invalidate them properly; I hope neither of those is a sweet spot. It is used by Git.xs' xs__call_gate() to set up per-repository data for libgit's consumption. No code actually takes advantage of it yet but get_object() will in the next patches. Signed-off-by: Petr Baudis Signed-off-by: Junio C Hamano --- perl/Git.xs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'perl/Git.xs') diff --git a/perl/Git.xs b/perl/Git.xs index 2bbec4365f..6ed26a29b8 100644 --- a/perl/Git.xs +++ b/perl/Git.xs @@ -52,7 +52,21 @@ BOOT: } -# /* TODO: xs_call_gate(). See Git.pm. */ +void +xs__call_gate(repoid, git_dir) + long repoid; + char *git_dir; +CODE: +{ + static long last_repoid; + if (repoid != last_repoid) { + setup_git(git_dir, + getenv(DB_ENVIRONMENT), + getenv(INDEX_ENVIRONMENT), + getenv(GRAFT_ENVIRONMENT)); + last_repoid = repoid; + } +} char * -- cgit v1.2.3