-rw-r--r-- | ui-snapshot.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/ui-snapshot.c b/ui-snapshot.c index 4449803..c741469 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c | |||
@@ -48,50 +48,49 @@ static int write_compressed_tar_archive(struct archiver_args *args,const char *f | |||
48 | static int write_tar_gzip_archive(struct archiver_args *args) | 48 | static int write_tar_gzip_archive(struct archiver_args *args) |
49 | { | 49 | { |
50 | return write_compressed_tar_archive(args,"gzip"); | 50 | return write_compressed_tar_archive(args,"gzip"); |
51 | } | 51 | } |
52 | 52 | ||
53 | static int write_tar_bzip2_archive(struct archiver_args *args) | 53 | static int write_tar_bzip2_archive(struct archiver_args *args) |
54 | { | 54 | { |
55 | return write_compressed_tar_archive(args,"bzip2"); | 55 | return write_compressed_tar_archive(args,"bzip2"); |
56 | } | 56 | } |
57 | 57 | ||
58 | static const struct snapshot_archive_t { | 58 | static const struct snapshot_archive_t { |
59 | const char *suffix; | 59 | const char *suffix; |
60 | const char *mimetype; | 60 | const char *mimetype; |
61 | write_archive_fn_t write_func; | 61 | write_archive_fn_t write_func; |
62 | int bit; | 62 | int bit; |
63 | }snapshot_archives[] = { | 63 | }snapshot_archives[] = { |
64 | { ".zip", "application/x-zip", write_zip_archive, 0x1 }, | 64 | { ".zip", "application/x-zip", write_zip_archive, 0x1 }, |
65 | { ".tar.gz", "application/x-tar", write_tar_gzip_archive, 0x2 }, | 65 | { ".tar.gz", "application/x-tar", write_tar_gzip_archive, 0x2 }, |
66 | { ".tar.bz2", "application/x-tar", write_tar_bzip2_archive, 0x4 }, | 66 | { ".tar.bz2", "application/x-tar", write_tar_bzip2_archive, 0x4 }, |
67 | { ".tar", "application/x-tar", write_tar_archive, 0x8 } | 67 | { ".tar", "application/x-tar", write_tar_archive, 0x8 } |
68 | }; | 68 | }; |
69 | 69 | ||
70 | #define snapshot_archives_len (sizeof(snapshot_archives) / sizeof(*snapshot_archives)) | 70 | #define snapshot_archives_len (sizeof(snapshot_archives) / sizeof(*snapshot_archives)) |
71 | 71 | ||
72 | void cgit_print_snapshot(struct cacheitem *item, const char *head, | 72 | void cgit_print_snapshot(const char *head, const char *hex, const char *prefix, |
73 | const char *hex, const char *prefix, | ||
74 | const char *filename, int snapshots) | 73 | const char *filename, int snapshots) |
75 | { | 74 | { |
76 | const struct snapshot_archive_t* sat; | 75 | const struct snapshot_archive_t* sat; |
77 | struct archiver_args args; | 76 | struct archiver_args args; |
78 | struct commit *commit; | 77 | struct commit *commit; |
79 | unsigned char sha1[20]; | 78 | unsigned char sha1[20]; |
80 | int f, sl, fnl = strlen(filename); | 79 | int f, sl, fnl = strlen(filename); |
81 | 80 | ||
82 | for(f=0; f<snapshot_archives_len; f++) { | 81 | for(f=0; f<snapshot_archives_len; f++) { |
83 | sat = &snapshot_archives[f]; | 82 | sat = &snapshot_archives[f]; |
84 | if(!(snapshots & sat->bit)) | 83 | if(!(snapshots & sat->bit)) |
85 | continue; | 84 | continue; |
86 | sl = strlen(sat->suffix); | 85 | sl = strlen(sat->suffix); |
87 | if(fnl<sl || strcmp(&filename[fnl-sl],sat->suffix)) | 86 | if(fnl<sl || strcmp(&filename[fnl-sl],sat->suffix)) |
88 | continue; | 87 | continue; |
89 | if (!hex) | 88 | if (!hex) |
90 | hex = head; | 89 | hex = head; |
91 | if(get_sha1(hex, sha1)) { | 90 | if(get_sha1(hex, sha1)) { |
92 | cgit_print_error(fmt("Bad object id: %s", hex)); | 91 | cgit_print_error(fmt("Bad object id: %s", hex)); |
93 | return; | 92 | return; |
94 | } | 93 | } |
95 | commit = lookup_commit_reference(sha1); | 94 | commit = lookup_commit_reference(sha1); |
96 | if(!commit) { | 95 | if(!commit) { |
97 | cgit_print_error(fmt("Not a commit reference: %s", hex)); | 96 | cgit_print_error(fmt("Not a commit reference: %s", hex)); |