From 0c0738da22a2f6a7cb1d0e4ed262c8fb080d68c0 Mon Sep 17 00:00:00 2001 From: Stricted Date: Fri, 7 Sep 2012 22:22:32 +0200 Subject: [PATCH] apply changes on index.cgi --- git_download.php | 43 ++++++++++++++++++++++++++++++++++++++----- index.cgi | 35 ++++++++++++++--------------------- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/git_download.php b/git_download.php index df0852b..64f16ae 100644 --- a/git_download.php +++ b/git_download.php @@ -4,13 +4,30 @@ if(isset($_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]*$'"); $con= shell_exec('git --git-dir=/home/git/'.$_GET["p"].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"'); if(!$hash){ - echo "

".$_GET["p"].": No Download available

"; + echo "No Download available"; }else{ $name=substr($_GET["p"],0,strlen($_GET["p"])-4); if(file_exists("/usr/share/gitweb/dl/".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz")) { - echo "

".$_GET["p"].": Download git-".substr($con, 0, -1)."-".substr($hash, 0, -1)."

"; + echo "git-".substr($con, 0, -1)."-".substr($hash, 0, -1)." (tar.gz)"; } else { - echo "

".$_GET["p"].": No Download available (Build snapshot)

"; + echo "No Download available (Build snapshot)"; + } + } + }else{ + echo "unknown project"; + } +}elseif(isset($_GET['git'])){ + if(file_exists("/home/git/".$_GET['git'])){ + $hash = shell_exec("git --git-dir=/home/git/".$_GET["git"]." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"); + $con= shell_exec('git --git-dir=/home/git/'.$_GET["git"].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"'); + if(!$hash){ + echo "

".$_GET["git"].": No Download available

"; + }else{ + $name=substr($_GET["git"],0,strlen($_GET["git"])-4); + if(file_exists("/usr/share/gitweb/dl/".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz")) { + echo "

git-".substr($con, 0, -1)."-".substr($hash, 0, -1)." (tar.gz)

"; + } else { + echo "

No Download available (Build snapshot)

"; } } }else{ @@ -36,14 +53,30 @@ if(isset($_GET['p'])){ if(file_exists("/home/git/".$_GET['build2'])){ $name=substr($_GET['build2'],0,strlen($_GET['build2'])-4); if(file_exists("/usr/share/gitweb/dl/".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz")) { - echo ' '; + echo ' '; }else{ $hash = shell_exec("git --git-dir=/home/git/".$_GET['build2']." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"); $con= shell_exec('git --git-dir=/home/git/'.$_GET['build2'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"'); $b = shell_exec("cd /usr/share/gitweb/dl/; git clone git://git.nexus-irc.de/".$_GET['build2']); $c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz ".$name); $d = shell_exec("rm -r /usr/share/gitweb/dl/".$name); - echo ' '; + echo ' '; + } + }else{ + echo "unknown project"; + } +}elseif(isset($_GET['build3'])){ + if(file_exists("/home/git/".$_GET['build3'])){ + $name=substr($_GET['build3'],0,strlen($_GET['build3'])-4); + if(file_exists("/usr/share/gitweb/dl/".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz")) { + echo ' '; + }else{ + $hash = shell_exec("git --git-dir=/home/git/".$_GET['build3']." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"); + $con= shell_exec('git --git-dir=/home/git/'.$_GET['build3'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"'); + $b = shell_exec("cd /usr/share/gitweb/dl/; git clone git://git.nexus-irc.de/".$_GET['build3']); + $c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz ".$name); + $d = shell_exec("rm -r /usr/share/gitweb/dl/".$name); + echo ' '; } }else{ echo "unknown project"; diff --git a/index.cgi b/index.cgi index 4a45d83..ed6a910 100644 --- a/index.cgi +++ b/index.cgi @@ -695,7 +695,6 @@ our %actions = ( "project_index" => \&git_project_index, "project_index2" => \&git_project_index2, "download" => \&git_download, - "downloads" => \&git_downloads, "bugtracker" => \&git_project_bugtracker, ); @@ -1025,7 +1024,7 @@ sub dispatch { if (!defined($actions{$action})) { die_error(400, "Unknown action"); } - if ($action !~ m/^(?:opml|project_list|project_index2|project_index|downloads)$/ && + if ($action !~ m/^(?:opml|project_list|project_index2|project_index|download)$/ && !$project) { die_error(400, "Project needed"); } @@ -3584,7 +3583,7 @@ sub git_footer_html { -class => $feed_class}, "OPML") . " "; print $cgi->a({-href => href(project=>undef, action=>"project_index"), -class => $feed_class}, "TXT") . " "; - print $cgi->a({-href => href(project=>undef, action=>"downloads"), + print $cgi->a({-href => href(project=>undef, action=>"download"), -class => $feed_class2}, "Downloads") . "\n"; } print "\n"; # class="page_footer" @@ -3675,7 +3674,7 @@ sub git_print_page_nav { my ($current, $suppress, $head, $treehead, $treebase, $extra) = @_; $extra = '' if !defined $extra; # pager or formats - my @navs = qw(summary bugtracker shortlog log commit commitdiff tree download); + my @navs = qw(summary bugtracker shortlog log commit commitdiff tree); if ($suppress) { @navs = grep { $_ ne $suppress } @navs; } @@ -4714,8 +4713,7 @@ sub git_project_list_body { #$cgi->a({-href => href(project=>$pr->{'path'}, action=>"bugtrack")}, "bugtrack") . " | " . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"shortlog")}, "shortlog") . " | " . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"log")}, "log") . " | " . - $cgi->a({-href => href(project=>$pr->{'path'}, action=>"tree")}, "tree") . " | " . - $cgi->a({-href => href(project=>$pr->{'path'}, action=>"download")}, "download") . + $cgi->a({-href => href(project=>$pr->{'path'}, action=>"tree")}, "tree") . ($pr->{'forks'} ? " | " . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"forks")}, "forks") : '') . "\n" . "\n"; @@ -4781,18 +4779,22 @@ sub git_shortlog_body { print "\n"; my $alternate = 1; my $head = git_get_head_hash($project); + my $graph_hash; if (defined $allrefs && $allrefs == 1) { - $hash = "all"; + $graph_hash = "all"; } if (!defined $hash) { $hash = $head; } + if(!defined $graph_hash) { + $graph_hash = $hash; + } if (!defined $page) { $page = 0; } my $graph_rand = int(rand(99999)); print "\n"; - print "\n"; + print "\n"; print "\n"; print "\n"; print "\n"; @@ -4809,7 +4811,7 @@ sub git_shortlog_body { } $alternate ^= 1; # git_summary() used print "\n" . - print ""; + print ""; print "\n" . format_author_html('td', \%co, 10) . "\n"; + print "\n"; # Tag cloud my $show_ctags = gitweb_check_feature('ctags'); if ($show_ctags) { -- 2.20.1
AuthorCommit$co{'age_string'}$co{'age_string_date'}"; print format_subject_html($co{'title'}, $co{'title_short'}, @@ -5149,7 +5151,7 @@ sub git_project_index2 { print "$path\n"; } } -sub git_downloads { +sub git_download { my $dl = get("http://git.nexus-irc.de/git_download.php"); git_header_html(); print "
Downloads
\n"; @@ -5157,17 +5159,6 @@ sub git_downloads { git_footer_html(); } -sub git_download { - my $dl1 = get("http://git.nexus-irc.de/git_download.php?p=".$project); - my %co = parse_commit("HEAD"); - my $head = $co{'id'}; - git_header_html(); - git_print_page_nav('download','', $head); - print "
Download
\n"; - print $dl1; - git_footer_html(); -} - sub git_project_bugtracker { my $descr = git_get_project_description($project) || "none"; my $bugtrack = get("http://git.nexus-irc.de/git_bugtrack.php?p=".$project); @@ -5209,6 +5200,7 @@ sub git_summary { my $owner = git_get_project_owner($project); my $version = get("http://git.nexus-irc.de/git_version.php?git=".$project); + my $download = get("http://git.nexus-irc.de/git_download.php?p=".$project); my $refs = git_get_references(); # These get_*_list functions return one more to allow us to see if @@ -5243,6 +5235,7 @@ sub git_summary { $url_tag = ""; } print "
version" . esc_html($version) . "
download" . $download . "