about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJason A. Donenfeld2012-09-26 02:56:38 +0200
committerJason A. Donenfeld2012-09-27 03:35:25 +0200
commit055e092a330098f6b9177266facf43029dbe1883 (patch)
tree478515dce37fec72f6012a4187823d68a432c523
parentUpdate copyright headers to have latest dates. (diff)
downloadcgit-055e092a330098f6b9177266facf43029dbe1883.tar.gz
cgit-055e092a330098f6b9177266facf43029dbe1883.zip
ui-snapshot: pass -n to gzip, to suppress timestamp
Since cgit snapshots of tags are often used for releases, we don't
want the rarely used feature of the gzip compressor that includes
an embedded timestamp into the archive, since this makes each tarball
of the same (potentially signed) tag different.

This commit refactors the archive handling code a bit so that each
different format is able to run with an arbitrary argv for the filter.
-rw-r--r--ui-snapshot.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/ui-snapshot.c b/ui-snapshot.c index 07cc944..47432bd 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c
@@ -1,6 +1,7 @@
1/* ui-snapshot.c: generate snapshot of a commit 1/* ui-snapshot.c: generate snapshot of a commit
2 * 2 *
3 * Copyright (C) 2006 Lars Hjemli 3 * Copyright (C) 2006 Lars Hjemli
4 * Copyright (C) 2012 Jason A. Donenfeld <Jason@zx2c4.com>
4 * 5 *
5 * Licensed under GNU General Public License v2 6 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text) 7 * (see COPYING for full license text)
@@ -10,15 +11,13 @@
10#include "html.h" 11#include "html.h"
11#include "ui-shared.h" 12#include "ui-shared.h"
12 13
13static int write_compressed_tar_archive(struct archiver_args *args,const char *filter) 14static int write_compressed_tar_archive(struct archiver_args *args, char *filter_argv[])
14{ 15{
15 int rv; 16 int rv;
16 struct cgit_filter f; 17 struct cgit_filter f;
17 18
18 f.cmd = xstrdup(filter); 19 f.cmd = filter_argv[0];
19 f.argv = malloc(2 * sizeof(char *)); 20 f.argv = filter_argv;
20 f.argv[0] = f.cmd;
21 f.argv[1] = NULL;
22 cgit_open_filter(&f); 21 cgit_open_filter(&f);
23 rv = write_tar_archive(args); 22 rv = write_tar_archive(args);
24 cgit_close_filter(&f); 23 cgit_close_filter(&f);
@@ -27,17 +26,20 @@ static int write_compressed_tar_archive(struct archiver_args *args,const char *f
27 26
28static int write_tar_gzip_archive(struct archiver_args *args) 27static int write_tar_gzip_archive(struct archiver_args *args)
29{ 28{
30 return write_compressed_tar_archive(args,"gzip"); 29 char *argv[] = { "gzip", "-n", NULL };
30 return write_compressed_tar_archive(args, argv);
31} 31}
32 32
33static int write_tar_bzip2_archive(struct archiver_args *args) 33static int write_tar_bzip2_archive(struct archiver_args *args)
34{ 34{
35 return write_compressed_tar_archive(args,"bzip2"); 35 char *argv[] = { "bzip2", NULL };
36 return write_compressed_tar_archive(args, argv);
36} 37}
37 38
38static int write_tar_xz_archive(struct archiver_args *args) 39static int write_tar_xz_archive(struct archiver_args *args)
39{ 40{
40 return write_compressed_tar_archive(args,"xz"); 41 char *argv[] = { "xz", NULL };
42 return write_compressed_tar_archive(args, argv);
41} 43}
42 44
43const struct cgit_snapshot_format cgit_snapshot_formats[] = { 45const struct cgit_snapshot_format cgit_snapshot_formats[] = {