fclose($fp);
}
}
-
+function gen_id($len = 6)
+{
+ $r = '';
+ for($i=0; $i<$len; $i++) {
+ $r .= chr(rand(0, 25) + ord('a'));
+ }
+ return $r;
+}
if(isset($_GET['p'])){
if(file_exists("/home/git/".$_GET['p'])){
$hash = shell_exec("git --git-dir=/home/git/".$_GET["p"]." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'");
}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);
}
- $id = sha1(time());
+ $id = sha1(gen_id());
$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"');
$cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") . " | " .
$cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") . " | " .
$cgi->a({-href => href(action=>"tree", hash=>$commit, hash_base=>$commit)}, "tree"). " | " .
- "<a title='in format: tar.gz' href='http://git.nexus-irc.de/git_download.php?build2=".$project.";h=".$commit."'>snapshot</a>";
+ "<a title='in format: tar.gz' href='http://git.nexus-irc.de/git_download.php?build=".$project.";h=".$commit."'>snapshot</a>";
print "</td>\n" .
"</tr>\n";
my $snapshot_links = "1";
if (defined $snapshot_links) {
# FIXME: Should be available when we have no hash base as well.
- push @views_nav, "<a title='in format: tar.gz' href='http://git.nexus-irc.de/git_download.php?build2=".$project.";h=".$hash."'>snapshot</a>";
+ push @views_nav, "<a title='in format: tar.gz' href='http://git.nexus-irc.de/git_download.php?build=".$project.";h=".$hash."'>snapshot</a>";
}
git_print_page_nav('tree','', $hash_base, undef, undef,
join(' | ', @views_nav));
"tree");
my $snapshot_links = "1";
if (defined $snapshot_links) {
- print " | " . "<a title='in format: tar.gz' href='http://git.nexus-irc.de/git_download.php?build2=".$project.";h=".$hash."'>snapshot</a>";
+ print " | " . "<a title='in format: tar.gz' href='http://git.nexus-irc.de/git_download.php?build=".$project.";h=".$hash."'>snapshot</a>";
}
print "</td>" .
"</tr>\n";