}else{
$hash = substr(shell_exec("git --git-dir=/home/git/".$_GET['build']." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"), 0, 7);
}
- if(file_exists("/usr/share/gitweb/dl/".$name."-".$hash.".tar.gz")) {
- header("Content-Type: application/x-gzip");
- header("Content-Disposition: attachment; filename=".$name."-".$hash.".tar.gz");
- readfile("/usr/share/gitweb/dl/".$name."-".$hash.".tar.gz");
- unlink("/usr/share/gitweb/dl/".$name."-".$hash.".tar.gz");
- }else{
- $b = shell_exec("cd /usr/share/gitweb/dl/; git clone git://git.nexus-irc.de/".$_GET['build']);
- $c = shell_exec("cd /usr/share/gitweb/dl/".$name."/; git reset ".$_GET['h']);
- $con= shell_exec('git --git-dir=/home/git/'.$_GET['build'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"');
- if($_GET['build'] != "gitweb.git") {
- scandir_replace("/usr/share/gitweb/dl/".$name,"git-".substr($con, 0, -1)."-".$hash);
- }
- $c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$name."-".$hash.".tar.gz ".$name);
- $d = shell_exec("rm -r /usr/share/gitweb/dl/".$name);
- header("Content-Type: application/x-gzip");
- header("Content-Disposition: attachment; filename=".$name."-".$hash.".tar.gz");
- readfile("/usr/share/gitweb/dl/".$name."-".$hash.".tar.gz");
- unlink("/usr/share/gitweb/dl/".$name."-".$hash.".tar.gz");
+ $id = sha1(time());
+ $b = shell_exec("cd /usr/share/gitweb/dl/; git clone git://git.nexus-irc.de/".$_GET['build']);
+ $c = shell_exec("cd /usr/share/gitweb/dl/".$name."/; git reset ".$_GET['h']);
+ $con= shell_exec('git --git-dir=/home/git/'.$_GET['build'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"');
+ if($_GET['build'] != "gitweb.git") {
+ scandir_replace("/usr/share/gitweb/dl/".$name,"git-".substr($con, 0, -1)."-".$hash);
}
+ $c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$id." ".$name);
+ $d = shell_exec("rm -r /usr/share/gitweb/dl/".$name);
+ header("Content-Type: application/x-gzip");
+ header("Content-Disposition: attachment; filename=".$name."-".$hash.".tar.gz");
+ readfile("/usr/share/gitweb/dl/".$id);
+ unlink("/usr/share/gitweb/dl/".$id);
+
}else{
echo "unknown project";
}