Commit Graph

96 Commits (e3d3fffdd447cdb4551549faae65bae5353a2cab)

Author SHA1 Message Date
John Keeping e3d3fffdd4 Avoid non-ANSI function declarations
Sparse says things like:

	warning: non-ANSI function declaration of function 'calc_ttl'

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
Jason A. Donenfeld 2e4a41e840 Make root handling sane again. 9 years ago
Jason A. Donenfeld 6bcda2f73d ui-shared: Add current url helper function. 9 years ago
Jason A. Donenfeld c3473e8a5d ui-repolist: use ctx.qry.url instead of rooturl, in case we're filtering 9 years ago
Jason A. Donenfeld e14eee9ea5 ui-repolist: use correct owner query link 9 years ago
Lukas Fleischer c58cec9dff Add repo.hide and repo.ignore
These options can be used to hide a repository from the index or
completely ignore a repository, respectively. They are particularly
useful when used in combination with scan-path.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
9 years ago
Chris Burroughs 96ceb9a95a repolist: add owner-filter
This allows custom links to be used for repository owners by
configuring a filter to be applied in the "Owner" column in the
repository list.
10 years ago
Christian Hesse 17838ec630 git: update to v2.2.1
Update to git version v2.2.1, including API changes.

Signed-off-by: Christian Hesse <mail@eworm.de>
10 years ago
Christian Hesse 79c985e13c git: update for git 2.0
prefixcmp() and suffixcmp() have been remove, functionality is now
provided by starts_with() and ends_with(). Retrurn values have been
changed, so instead of just renaming we have to fix logic.
Everything else looks just fine.
10 years ago
Jason A. Donenfeld a2b6b37175 repolist: make owner clickable to search
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years ago
Lukas Fleischer f60ffa143c Switch to exclusively using global ctx
Drop the context parameter from the following functions (and all static
helpers used by them) and use the global context instead:

* cgit_print_http_headers()
* cgit_print_docstart()
* cgit_print_pageheader()

Remove context parameter from all commands

Drop the context parameter from the following functions (and all static
helpers used by them) and use the global context instead:

* cgit_get_cmd()
* All cgit command functions.
* cgit_clone_info()
* cgit_clone_objects()
* cgit_clone_head()
* cgit_print_plain()
* cgit_show_stats()

In initialization routines, use the global context variable instead of
passing a pointer around locally.

Remove callback data parameter for cache slots

This is no longer needed since the context is always read from the
global context variable.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years ago
Jason A. Donenfeld 800380dde7 filter: return on null filter from open and close
So that we don't have to include the if(filter) open_filter(filter)
block everywhere, we introduce the guard in the function itself. This
should simplify quite a bit of code.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years ago
John Keeping 1de6591159 ui-repolist: HTML-escape cgit_rooturl() response
This is for consistency with other callers.  The value returned from
cgit_rooturl is not guaranteed to be HTML-safe.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years ago
John Keeping 3d8a6507ca filter: pass extra arguments via cgit_open_filter
This avoids poking into the filter data structure at various points in
the code.  We rely on the fact that the number of arguments is fixed
based on the filter type (set in cgit_new_filter) and that the call
sites all know which filter type they're using.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years ago
Lukas Fleischer f7f26f8875 Update copyright information
* Name "cgit Development Team" as copyright holder to avoid listing
  every single developer.

* Update copyright ranges.

Signed-off-by: Lukas Fleischer <cgit@crytocrack.de>
11 years ago
Jason A. Donenfeld c0dfaf1c28 ui-summary: Pass filename to about-filter
This gives the about-filter API the same semantics as source-filter,
where the filter receives the filename so it can decide what to do next
with it.

While we're at it, plug a memory leak.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years ago
John Keeping fb3655df3b use struct strbuf instead of static buffers
Use "struct strbuf" from Git to remove the limit on file path length.

Notes on scan-tree:
This is slightly involved since I decided to pass the strbuf into
add_repo() and modify if whenever a new file name is required, which
should avoid any extra allocations within that function.  The pattern
there is to append the filename, use it and then reset the buffer to its
original length (retaining a trailing '/').

Notes on ui-snapshot:
Since write_archive modifies the argv array passed to it we
copy the argv_array values into a new array of char* and then free the
original argv_array structure and the new array without worrying about
what the values now look like.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years ago
John Keeping 8f20879431 Always #include corresponding .h in .c files
While doing this, remove declarations from header files where the
corresponding definition is declared "static" in order to avoid build
errors.

Also re-order existing headers in ui-*.c so that the file-specific
header always comes immediately after "cgit.h", helping with future
consistency.

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years ago
Lukas Fleischer b60e6bff75 Convert pager navigation into a unordered list
It is common practice and semantically appropriate to use unordered
lists for long navigation lists.

This also fixes the layout of very long pager navigations in
Webkit-based browsers.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years ago
Lukas Fleischer bafab423f2 Mark several functions/variables static
Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years ago
Jason A. Donenfeld bdae1d8a8d White space around control verbs.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years ago
Lukas Fleischer 53bc747d31 Fix several whitespace errors
* Remove whitespace at the end of lines.
* Replace space indentation by tabs.
* Add whitespace before/after several operators ("+", "-", "*", ...)
* Add whitespace to assignments ("foo = bar;").
* Fix whitespace in parameter lists ("foobar(foo, bar, 42)").

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
11 years ago
Florian Pritz b1e172acca Make "owner" column on index page configurable
This is not really needed for personal sites where all repos belong to
the same person. Since it is pretty useful for shared sites however, it
should be configurable.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11 years ago
Tobias Bieniek 7a4e7c8ffb ui-repolist: Add "section-sort" flag to control section sorting.
Flag which, when set to "1", will sort the sections on the repository
listing by name. Set this flag to "0" if the order in the cgitrc file
should be preserved. Default value: "1".

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
12 years ago
William Bell c366bd6fa8 ui: Remember to print ampersand as proper html entities. 12 years ago
Jason A. Donenfeld fdfb6a6d80 ui-repolist: Rename section-sort to repository-sort.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
12 years ago
Ferry Huberts e52a5226b8 ui-repolist: do not use agefile if it's date could not be parsed
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
12 years ago
Jamie Couture 4675b91211 ui-repolist: Bold the currently viewed page.
Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
12 years ago
Jason A. Donenfeld 7f08e03941 Update copyright headers to have latest dates. 12 years ago
Jason A. Donenfeld 184c5655b2 ui-repolist: Case insensitive sorting and age sort
Add two options, one for doing the ordinary name sorts in a
case-insensitive manner, and another for choosing to sort repos in each
section by age instead of by name.
12 years ago
Lars Hjemli 181b6e789b Merge branch 'jp/defbranch' 12 years ago
Lars Hjemli 04254fa903 Merge branch 'stable' 13 years ago
Tobias Grimm 7530d94f05 Add sort parameter to pager of repo list
When the repolist is paged, the page-links are missing the sort parameter,
causing the initial page to be custom sorted, but any clicked page will
then be with the default sort order again.
13 years ago
Lars Hjemli 5293c8b799 ui-repolist.c: fallback to "master" if no default branch is specified
When looking for the modtime of a repo we used to rely on repo.defbranch
having a value. This is no longer true so this patch provides a default
value when needed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
13 years ago
Lars Hjemli 3ec6b30950 cgit.c: always setup cgit repo environment variables
When cgit learned to setup environment variables for certain repo
settings before invoking a filter process, the setup occurred inside
cgit_open_filter().

This patch moves the setup out of cgit_open_filter() and into
prepare_repo_cmd() to prepare for additional uses of these variables.

Reviewed-by: Ferry Huberts <mailings@hupie.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
13 years ago
Ferry Huberts 21e0e0bfac ui_repolist: get modtime from packed-refs as fallback
When no modtime could be determined then as a final
fallback try to get it from the packed-refs.

This will show an idle time when a repository has been packed
with all refs in the packed-refs.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
13 years ago
Lars Hjemli ab350a77b1 Merge branch 'fh/filter-api'
Conflicts:
	cgit.c
13 years ago
Lars Hjemli c8ea73caab ui-repolist.c: do not return random/stale data from read_agefile
When git/date.c:parse_date() cannot parse its input it returns -1. But
read_agefile() checks if the result is different from zero, essentialy
returning random data from the date buffer when parsing fails. This
patch fixes the issue by verifying that the result from parse_date()
is positive.

Noticed-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
13 years ago
Ferry Huberts d87bba846d cgit_open_filter: also take the repo as a parameter
To prepare for handing repo configuration to the
filter script that is executed.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
13 years ago
Mark Lodato 25e8ba1996 ui-repolist: fix redefinition of _XOPEN_SOURCE
Previously, ui-repolist.c set _GNU_SOURCE and then included a standard
library before including <git-compat-util.h>.  This was a problem,
because <git-compat-util.h> redefined _XOPEN_SOURCE, which is set
automatically by glibc when _GNU_SOURCE is set.  However,
<git-compat-util.h> already sets _GNU_SOURCE and includes both
<string.h> and <time.h>, so there is no need to define _GNU_SOURCE or
include either header within ui-repolist.c.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
14 years ago
Geoff Johnstone 9735835c0e Fix repolist search links with virtual root
Signed-off-by: Geoff Johnstone <geoff.johnstone@googlemail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli e01229cf80 ui-repolist: handle empty sections similar to NULL sections
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli 63816ec597 ui-repolist.c: sort by section name, repo name as default
When no sorting is requested by the client, cgit will now sort by
section name followed by repo name. This allows repos to be registered/
discovered independently of their display order.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli e7af002d5c Introduce 'section' as canonical spelling for 'repo.group'
The 'repo.' prefix should be reserved for repo-specific options, but
the option 'repo.group' must still be honored to stay backwards
compatible.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli e16f178334 Add and use a common readfile() function
This function is used to read the full content of a textfile into a
newly allocated buffer (with zerotermination).

It replaces the earlier readfile() in scan-tree.c (which was rather
error-prone[1]), and is reused by read_agefile() in ui-repolist.c.

1: No checks for EINTR and EAGAIN, fixed-size buffer

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli 523c133e2e Merge branch 'stable' 15 years ago
Simon Arlott 011f2e9bdd truncate buffer before reading empty files
If readfile() reads an empty file, fgets() won't truncate the buffer
and it'll still contain the contents of the previously read file.

[lh: fixed similar issue in ui-repolist.c]

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli 537c05f138 Add 'about-filter' and 'repo.about-filter' options
These options can be used to execute a filter command on each about-page,
both top-level and for each repository (repo.about-filter can be used
to override the current about-filter).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli 3c32fe0771 Merge branch 'full-log'
Conflicts:
	cgit.c
	cgit.h
16 years ago
Lars Hjemli 9c8be943f7 Merge branch 'lh/sort-repolist' 16 years ago