Commit Graph

25 次程式碼提交

作者 SHA1 備註 提交日期
Lars Hjemli
6fddad7251 ui-snapshot: avoid segfault when no filename is specified
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-03-15 08:57:33 +01:00
Lars Hjemli
aa60ae12cb Merge branch 'snapshot-fixes' 2009-01-11 12:22:46 +01:00
Natanael Copa
c4b45de334 return 404 if snapshot is not found
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-12-28 10:09:18 +01:00
Lars Hjemli
ed77b2e0bf ui-snapshot.c: change mime-type for tar.gz and tar.bz2
The updated mime-types seems to work better than the old ones with both
safari and firefox.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-12-26 11:33:59 +01:00
Lars Hjemli
4b4f8d1256 ui-snapshot: improve extraction of revision from snapshot name
The modified get_ref_from_filename() supports the following snapshot
formats:
* $REV.$EXT
* $REPO[-_]*v?$REV.$EXT

This implies that the following urls will retrieve the expected revision:
* http://hjemli.net/git/cgit/snapshot/v0.8.1.tar.gz
* http://hjemli.net/git/cgit/snapshot/0.8.1.tar.gz
* http://hjemli.net/git/cgit/snapshot/cgit-0.8.1.tar.gz
* http://hjemli.net/git/cgit/snapshot/cgit-140012d7a8.tar.gz

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-12-01 19:13:44 +01:00
Natanael Copa
314d9ea5a3 Set prefix in snapshots when using dwimmery
This patch sets the directory prefix in archives to be the filename,
excluding the suffix (.tar.gz, .tar.bz2 etc).

The patch also removes the prefix parameter in cgit_print_snapshot()
as the prefix might differ.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-11-30 13:39:53 +01:00
Lars Hjemli
ed7ff095ca ui-snapshot: add dwimmery
When downloading a snapshot, the snapshot name will often contain the repo
name combined with a tag. This patch tries to exploit this so that the
correct revision is downloaded even if no specific revision is specified.

PS: this only occurs if neither 'h' nor 'id' is specified in the query-
string.

PPS: this also fixes a bug which occurs when trying to download a filename
with an unsupported suffix: it used to try to print an error message to
the user but failed since it didn't prepare the output properly.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-10-11 20:09:42 +02:00
Lars Hjemli
204669ff4a ui-snapshot.c: specify archiver_args.baselen
The struct member was introduces in git commit d53fe8187c38, but the cgit
testsuite failed to detect that cgit always generated archives without
prefixes, i.e. the result from cgit_repobasename was ignored.

This fixes the bug and the testsuite.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-10-05 13:13:03 +02:00
Lars Hjemli
a4d1ca1dc6 Add ui-shared.h
This is finally a proper headerfile for the shared ui-functions which
used to reside in cgit.h

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-03-24 16:50:57 +01:00
Lars Hjemli
f34478cbe0 Refactor snapshot support
The snapshot support needs to be split between output- and config-related
functions to get the layering between shared.c and ui-*.c right. There
is also some codestyle-issues which needs fixing to make the snapshot
functions more similar to the rest of the cgit code.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-03-24 16:00:27 +01:00
Lars Hjemli
b608e88adb Remove obsolete cacheitem parameter to ui-functions
This parameter hasn't been used for a very long time...

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-03-24 01:01:28 +01:00
Lars Hjemli
f3c1a187fe Add struct cgit_page to cgit_context
This struct is used when generating http headers, and as such is another
small step towards the goal of the whole cleanup series; to invoke each
page/view function with a function pointer.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-03-24 00:51:19 +01:00
Lars Hjemli
b1f9b9c145 Introduce html.h
All html-functions can be quite easily separated from the rest of cgit, so
lets do it; the only issue was html_filemode which uses some git-defined
macros so the function is moved into ui-shared.c::cgit_print_filemode().

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2008-03-18 08:13:10 +01:00
Lars Hjemli
2216fd6472 Compare string lengths when parsing the snapshot mask
We used to rely on the result from strncmp() without comparing the length of
the strings involved. Even worse, any single-character format specifier would
enable zip-format due to the optional '.'-prefix since the length of the
mask then would become zero.

Noticed-by: Evan Martin <sys@neugierig.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2007-12-03 00:39:20 +01:00
Lars Hjemli
5b75064a81 Set commit date on snapshot contents
The testsuite revealed that cgit snapshots don't set any useful timestamp on
the files contained in the snapshot.

Cherry-picked-from: 2ff33a8a04
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2007-11-11 13:16:43 +01:00
Lars Hjemli
1221adbb58 ui-snapshot: whitespace/formatting cleanup
Introduce a #define for number of snapshot archive entries, move all decls
to function entrypoint, remove some trailing whitespace and reformat a few
lines.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2007-07-23 23:12:11 +02:00
Lars Hjemli
eb45342e73 cgit_print_snapshot_links: use url to specify snapshot name
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2007-07-23 00:27:32 +02:00
Michael Krelin
dc3c9b5bc4 allow selective enabling of snapshots
snapshot configuration parameter now can be a
 space/slash/comma/colon/semicolon/pipe-separated list of snaphot suffixes as
 listed in ui-snapshot.c

Signed-off-by: Michael Krelin <hacker@klever.net>
2007-07-21 18:00:53 +02:00
Michael Krelin
97c025ae8e shorten snapshot names to repo basename
Signed-off-by: Michael Krelin <hacker@klever.net>
2007-07-21 15:29:55 +02:00
Michael Krelin
0df096f6e1 added snapshot filename to the link
- changed cgit_pageurl into cgit_fileurl with the filename parameter
 - rewritten cgit_pageurl as a wrapper around cgit_fileurl

Signed-off-by: Michael Krelin <hacker@klever.net>
2007-07-21 13:13:40 +02:00
Michael Krelin
86ca02231f add plain uncompressed tar snapshort format
time to make available snapshots selectable

Signed-off-by: Michael Krelin <hacker@klever.net>
2007-07-21 02:14:35 +02:00
Michael Krelin
18a99bdf87 introduced .tar.bz2 snapshots
- reworked write_tar_gzip_archive to handle arbitrary filter as a
   write_compressed_tar_archive
 - reformatted whitespaces in the said function to adhere to common cgit
   standards
 - added wrappers around write_compressed_tar_archive for .tar.gz and .tar.bz2
 - added a hint for vim to use 8 characters shift width by default

Signed-off-by: Michael Krelin <hacker@klever.net>
2007-07-21 02:05:34 +02:00
Michael Krelin
4a92cbb7fd compress .tar.gz using gzip as a filter 2007-07-20 20:58:23 +02:00
Michael Krelin
f97c707a3b add support for snapshot tarballs
- reworked cgit_print_snapshot to use a list of supported archivers and pick
	one for the suffix supplied
- moved printing of snaphot links into ui-snapshot and make it iterate through
	the said list
2007-07-18 14:40:03 +02:00
Lars Hjemli
ab2ab95f09 Add support for snapshots
Make a link from the commit viewer to a snapshot of the corresponding tree.

Currently only zip-format is supported.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2007-02-08 13:58:58 +01:00