Set $ENV{GIT_DIR} before calling git-*

Apparently, git assumes that the repository is in pwd, unless
you set GIT_DIR. Here's a slightly mindless patch that sets it
anytime the $ENV{GIT_OBJECT_DIRECTORY} is set. I don't know if
$ENV{GIT_OBJECT_DIRECTORY} is needed any more, though...

It works for me.

-- 
The uneventful change to 2000 was nowhere more apparent than throughout
the system.
                  -- Office of Public Affairs, Henry Ford Health System
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Noel Maddy <[EMAIL PROTECTED]>
--- /tmp/gitweb.cgi.orig        2006-02-27 17:03:15.000000000 -0500
+++ ./gitweb.cgi        2006-02-27 17:04:15.000000000 -0500
@@ -88,6 +88,7 @@
        }
        $rss_link = "<link rel=\"alternate\" title=\"$project log\" 
href=\"$my_uri?p=$project;a=rss\" type=\"application/rss+xml\"/>";
        $ENV{'GIT_OBJECT_DIRECTORY'} = "$projectroot/$project/objects";
+       $ENV{'GIT_DIR'} = "$projectroot/$project";
 } else {
        git_project_list();
        exit;
@@ -725,6 +726,7 @@
                        next;
                }
                $ENV{'GIT_OBJECT_DIRECTORY'} = 
"$projectroot/$proj{'path'}/objects";
+               $ENV{'GIT_DIR'} = "$projectroot/$proj{'path'}";
                my %co = git_read_commit($head);
                if (!%co) {
                        next;
@@ -1273,6 +1275,7 @@
                        next;
                }
                $ENV{'GIT_OBJECT_DIRECTORY'} = 
"$projectroot/$proj{'path'}/objects";
+               $ENV{'GIT_DIR'} = "$projectroot/$proj{'path'}";
                my %co = git_read_commit($head);
                if (!%co) {
                        next;

Reply via email to