aboutsummaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
Diffstat (limited to 'perl')
-rw-r--r--perl/Git.pm11
-rw-r--r--perl/Git.xs16
2 files changed, 21 insertions, 6 deletions
diff --git a/perl/Git.pm b/perl/Git.pm
index 9ce9fcdd3..9da15e9c8 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -98,6 +98,8 @@ XSLoader::load('Git', $VERSION);
}
+my $instance_id = 0;
+
=head1 CONSTRUCTORS
@@ -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.
diff --git a/perl/Git.xs b/perl/Git.xs
index 2bbec4365..6ed26a29b 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 *