summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2015-06-11 15:43:41 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2015-06-11 15:43:41 -0700
commita1a4ec0547850f84ea192c530f9e8ac33b379d46 (patch)
treecd7ba4ffc8b28a0874a3b5b6304652e6a82de491
parent4edfec2e8f2b4a6583f6493978d9e79dd79e4c66 (diff)
downloadgitweb2cgit-a1a4ec0547850f84ea192c530f9e8ac33b379d46.tar.gz
gitweb2cgit-a1a4ec0547850f84ea192c530f9e8ac33b379d46.tar.xz
gitweb2cgit-a1a4ec0547850f84ea192c530f9e8ac33b379d46.zip
Improve handling of the log, heads, and snapshot commands
Improve handling of the log, heads, and snapshot commands, based mostly on feedback from Ady2.
-rwxr-xr-xgitweb2cgit.cgi39
1 files changed, 38 insertions, 1 deletions
diff --git a/gitweb2cgit.cgi b/gitweb2cgit.cgi
index 08dd749..32e41a8 100755
--- a/gitweb2cgit.cgi
+++ b/gitweb2cgit.cgi
@@ -95,11 +95,13 @@ my %actions = (
'blob_plain' => '/blob/',
'rss' => '/atom/',
'atom' => '/atom/',
+ 'heads' => '/refs/heads/',
+ 'snapshot' => '/snapshot/',
);
-
my $a = $parm{'a'};
my $action = $actions{$a};
delete $parm{'a'};
+$parm{'showmsg'} = '1' if ($a eq 'log');
# Head (ID)
my $h = $parm{'h'};
@@ -114,6 +116,41 @@ delete $parm{'hb'};
my $f = $parm{'f'};
delete $parm{'f'};
+# Sort order
+my %sorts = (
+ 'descr' => 'desc',
+ 'owner' => 'owner',
+ 'age' => 'idle'
+);
+my $s = $sorts{$parm{'o'}};
+$parm{'s'} = $s if (defined($s));
+delete $parm{'o'};
+
+# Snapshot handling
+my %snapform = (
+ 'tgz' => '.tar.gz',
+ 'gzip' => '.tar.gz',
+ 'tbz2' => '.tar.bz2',
+ 'bzip2' => '.tar.bz2',
+ 'txz' => '.tar.xz',
+ 'xz' => '.tar.xz',
+ 'zip' => '.zip',
+);
+
+if ($a eq 'snapshot') {
+ my $sf = $parm{'sf'};
+ $sf = $snapform{$sf} unless ( $sf =~ /^\./);
+ $sf = '.tar.gz' unless ( $sf =~ /^\./ );
+ delete $parm{'sf'};
+
+ $f = $h;
+ if ($h =~ /^([0-9a-f]{40}|HEAD|master)$/ &&
+ $p =~ m:^(|.*/)([^/]+)\.git$: ) {
+ $f = $2.'-'.$h;
+ }
+ $f .= $sf;
+}
+
# Build a new URI
my $uri = URI->new($cgit_base);