path: root/perl/
diff options
authorPetr Baudis <>2006-07-03 20:48:03 (GMT)
committerJunio C Hamano <>2006-07-09 08:20:01 (GMT)
commit0270083ded143fd49841e3d3d0cac5eb06081d2a (patch)
tree960e1b85a2b18225a466bbf4aff040b27c581594 /perl/
parent998c4daaf4a921fb03d478b50d6e06223326d7ef (diff)
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 <>
Diffstat (limited to 'perl/')
1 files changed, 6 insertions, 5 deletions
diff --git a/perl/ b/perl/
index 9ce9fcd..9da15e9 100644
--- a/perl/
+++ b/perl/
@@ -98,6 +98,8 @@ XSLoader::load('Git', $VERSION);
+my $instance_id = 0;
@@ -215,7 +217,7 @@ sub repository {
delete $opts{Directory};
- $self = { opts => \%opts };
+ $self = { opts => \%opts, id => $instance_id++ };
bless $self, $class;
@@ -833,11 +835,10 @@ sub _call_gate {
if (defined $self) {
# XXX: We ignore the WorkingCopy! To properly support
# that will require heavy changes in libgit.
+ # For now, when we will need to do it we could temporarily
+ # chdir() there and then chdir() back after the call is done.
- # XXX: And we ignore everything else as well. libgit
- # at least needs to be extended to let us specify
- # the $GIT_DIR instead of looking it up in environment.
- #xs_call_gate($self->{opts}->{Repository});
+ xs__call_gate($self->{id}, $self->repo_path());
# Having to call throw from the C code is a sure path to insanity.