Make it possible to set up libgit directly (instead of from the environment)
[gitweb.git] / perl / Git.xs
index 2bbec4365f9c244a7a905df702393bca591d9d67..6ed26a29b89ab1959ef2e62917fb72c137bab39f 100644 (file)
@@ -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 *