Make it possible to set up libgit directly (instead of from the environment)
[gitweb.git] / perl / Git.pm
index 9ce9fcdd3ec95f08a7bf6c00bdd6da2931c01cde..9da15e9c8c208ffd6a51b524edc828c85dce5355 100644 (file)
@@ -98,6 +98,8 @@ =head1 DESCRIPTION
 
 }
 
+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.