Commit Graph

70 Commits (master)

Author SHA1 Message Date
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>
16 years ago
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>
16 years ago
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>
16 years ago
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>
16 years ago
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>
16 years ago
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>
16 years ago
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>
16 years ago
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>
16 years ago
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>
17 years ago
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>
17 years ago
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>
17 years ago
Lars Hjemli eb45342e73 cgit_print_snapshot_links: use url to specify snapshot name
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
17 years ago
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>
17 years ago
Michael Krelin 97c025ae8e shorten snapshot names to repo basename
Signed-off-by: Michael Krelin <hacker@klever.net>
17 years ago
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>
17 years ago
Michael Krelin 86ca02231f add plain uncompressed tar snapshort format
time to make available snapshots selectable

Signed-off-by: Michael Krelin <hacker@klever.net>
17 years ago
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>
17 years ago
Michael Krelin 4a92cbb7fd compress .tar.gz using gzip as a filter 17 years ago
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
17 years ago
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>
18 years ago