Commit Graph

28 Commits (master)

Author SHA1 Message Date
John Keeping 4c520cefc9 global: use release_commit_memory()
Instead of calling two separate Git functions to free memory associated
with a commit object, use Git's wrapper which does this.  This also
counts as a potential future bug fix since release_commit_memory() also
resets the parsed state of the commit, meaning any attempt to use it in
the future will correctly fill out the fields again.

release_commit_memory() does not set parents to zero, so keep that for
additional safety in case CGit checks this without calling
parse_commit() again.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
1 year ago
Christian Hesse cef27b670a git: update to v2.30.0
Update to git version v2.30.0, this requires changes for these
upstream commits:

* 88894aaeeae92e8cb41143cc2e045f50289dc790
  blame: simplify 'setup_scoreboard' interface

* 1fbfdf556f2abc708183caca53ae4e2881b46ae2
  banned.h: mark non-reentrant gmtime, etc as banned

Signed-off-by: Christian Hesse <mail@eworm.de>
3 years ago
Christian Hesse 985fba80d0 git: update to v2.21.0
Update to git version v2.21.0. Required changes follow upstream commits:

* 6a7895fd8a3bd409f2b71ffc355d5142172cc2a0
  (commit: prepare free_commit_buffer and release_commit_memory for
  any repo)

* e092073d643b17c82d72cf692fbfaea9c9796f11
  (tree.c: make read_tree*() take 'struct repository *')

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
5 years ago
Jason A. Donenfeld c34e28835b forms: action should not be empty
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years ago
John Keeping bdcbe0922d ui-stats: cast pointer before checking for zero
We abuse the "void *util" field as a counter and recently started to
cast it to a uintptr_t to avoid risking nasal demons by performing
arithmetic on a void pointer.

However, compilers are also known to do "interesting" things if they
know that a pointer is or isn't NULL.  Make this safer by checking if
the counter (after casting) is non-zero rather than checking if the
pointer is non-null.

Signed-off-by: John Keeping <john@keeping.me.uk>
8 years ago
Jason A. Donenfeld a8b9ef8c1c ui-stats: if we're going to abuse void*, do it safely 8 years ago
John Keeping 892c5441f4 stats: move layout into page function
This also allows us to return proper HTTP error codes for invalid
requests.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
John Keeping bd9fb0324d ui-stats: make cgit_period definitions 'static const'
These definitions should not be modified (and never are) so we can move
them to .rodata.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
John Keeping 2eea471a78 ui-stats.c: set parent pointer to NULL after freeing it
We do this everywhere else, so we should be doing it here as well.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years ago
John Keeping 865afe0eb1 git: update to v2.0.3
This is slightly more involved than just bumping the version number
because it pulls in a change to convert the commit buffer to a slab,
removing the "buffer" field from "struct commit".  All sites that access
"commit->buffer" have been changed to use the new functions provided for
this purpose.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 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>
10 years ago
Lukas Fleischer e21da6c2a6 ui-stats.c: Remove unused macro
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
10 years ago
John Keeping ed5bd30ebe Convert cgit_print_error to a variadic function
This removes many uses of "fmt" which uses a fixed size static pool of
fixed size buffers.  Instead of relying on these, we now pass around
argument lists for as long as possible before using a strbuf to render
content of an arbitrary size.

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 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
John Keeping bfc14d067d Update git to v1.7.5.4
Some changes to diff options:

- no_merges has become the more general max_parents
- path restriction now uses struct pathspec

Signed-off-by: John Keeping <john@keeping.me.uk>
11 years ago
Lars Hjemli 9acd1cf137 ui-stats.c: fix invalid html
Found by http://validator.w3.org.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
13 years ago
Lars Hjemli 1b5c336cc9 ui-stats.c: create a control panel for stat options
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
13 years ago
Johan Herland 17596459fe ui-stats: Remove unnecessary #include
<string-list.h> is already #included from cgit.h

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Mark Lodato e4ddc8f72b fix errors in printf-style format strings
There were many places where the arguments to a printf-like function did
not match the format string.  Mostly, these were a missing 'l' flag, but
there were three exceptions:

- In ui-stats.c, a size_t argument must be printed.  C99 has the "%zu"
  flag for this purpose, but not all compilers support this.  Therefore,
  we mimic what git does - use a NO_C99_FORMAT Makefile variable.

- In ui-stats.c, cgit_print_error() was called with a pointer instead of
  a character.

- In ui-log.c, the "columns" argument was never used.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
14 years ago
Lars Hjemli 6d7552bc07 Use GIT-1.7.2.2
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Lars Hjemli b47b7bd1d0 Add and use cgit_find_stats_periodname() in print_repo()
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli b54ef9749c ui-stats.c: reuse cgit_add_hidden_formfields()
This makes sure that the currect branch and path is preserved when
changing the stats period or author count.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
16 years ago
Lars Hjemli fb2f3f6c29 ui-stats: replace 'enable-stats' setting with 'max-stats'
The new 'max-stats' and 'repo.max-stats' settings makes it possible to
define the maximum statistics period, both globally and per repo. Hence,
it is now feasible to allow statistics on repositories with a high commit
frequency, like linux-2.6, by setting repo.max-stats to e.g. 'month'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
16 years ago
Lars Hjemli c6a6aa2186 ui-stats: enable path-filtered stats
When a path is specified on the querystring the commit statistics will
now be filtered by this path.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
16 years ago
Lars Hjemli f86a23ff53 Add a 'stats' page to each repo
This new page, which is disabled by default, can be used to print some
statistics about the number of commits per period in the repository,
where period can be either weeks, months, quarters or years.

The function can be activated globally by setting 'enable-stats=1' in
cgitrc and disabled for individual repos by setting 'repo.enable-stats=0'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
16 years ago