Code

Merge branch 'jc/fetch-notags'
[git.git] / git-cvsserver.perl
index a33a876ff652fea5a0a8933b919982557a7093de..84520e7ad5c1745b14db2206189bb7d54c17dcc8 100755 (executable)
@@ -172,11 +172,11 @@ sub req_Root
        return 0;
     }
 
-    my @gitvars = `git-repo-config -l`;
+    my @gitvars = `git-config -l`;
     if ($?) {
-       print "E problems executing git-repo-config on the server -- this is not a git repository or the PATH is not set correctly.\n";
+       print "E problems executing git-config on the server -- this is not a git repository or the PATH is not set correctly.\n";
         print "E \n";
-        print "error 1 - problem executing git-repo-config\n";
+        print "error 1 - problem executing git-config\n";
        return 0;
     }
     foreach my $line ( @gitvars )
@@ -876,9 +876,9 @@ sub req_update
                 print "MT newline\n";
                next;
            }
-           elsif ( !defined($wrev) || $wrev == 0 )
+           elsif ( (!defined($wrev) || $wrev == 0) && (!defined($meta->{revision}) || $meta->{revision} == 0) )
            {
-               $log->info("Tell the client the file will be added");
+               $log->info("Tell the client the file is scheduled for addition");
                print "MT text A \n";
                 print "MT fname $filename\n";
                 print "MT newline\n";
@@ -886,7 +886,7 @@ sub req_update
 
            }
            else {
-                $log->info("Updating '$filename' $wrev");
+                $log->info("Updating '$filename' to ".$meta->{revision});
                 print "MT +updated\n";
                 print "MT text U \n";
                 print "MT fname $filename\n";
@@ -1171,6 +1171,21 @@ sub req_ci
         exit;
     }
 
+       # Check that this is allowed, just as we would with a receive-pack
+       my @cmd = ( $ENV{GIT_DIR}.'hooks/update', "refs/heads/$state->{module}",
+                       $parenthash, $commithash );
+       if( -x $cmd[0] ) {
+               unless( system( @cmd ) == 0 )
+               {
+                       $log->warn("Commit failed (update hook declined to update ref)");
+                       print "error 1 Commit failed (update hook declined)\n";
+                       close LOCKFILE;
+                       unlink($lockfile);
+                       chdir "/";
+                       exit;
+               }
+       }
+
     print LOCKFILE $commithash;
 
     $updater->update();