Lars Hjemli [Tue, 25 Mar 2008 01:43:51 +0000 (02:43 +0100)]
Don't specify mimetype in ui-blob.c
But be sure to specify correct filename. This way, the client can hopefully
guess a sensible mimetype based on the filename suffix, and cgit can ignore
the issue altogether.
Lars Hjemli [Tue, 8 Apr 2008 19:29:21 +0000 (21:29 +0200)]
Merge branch 'lh/cleanup'
* lh/cleanup: (21 commits)
Reset ctx.repo to NULL when the config parser is finished
Move cgit_parse_query() from parsing.c to html.c as http_parse_querystring()
Move function for configfile parsing into configfile.[ch]
Add cache.h
Remove global and obsolete cgit_cmd
Makefile: copy the QUIET constructs from the Makefile in git.git
Move cgit_version from shared.c to cgit.c
Makefile: autobuild dependency rules
Initial Makefile cleanup
Move non-generic functions from shared.c to cgit.c
Add ui-shared.h
Add separate header-files for each page/view
Refactor snapshot support
Add command dispatcher
Remove obsolete cacheitem parameter to ui-functions
Add struct cgit_page to cgit_context
Introduce html.h
Improve initialization of git directory
Move cgit_repo into cgit_context
Add all config variables into struct cgit_context
...
Lars Hjemli [Tue, 8 Apr 2008 19:27:12 +0000 (21:27 +0200)]
Reset ctx.repo to NULL when the config parser is finished
This global variable is used by the config parsing callback to keep track
of the currently configured repository. If it is not reset to NULL when
the config parser is finished, and neither `url` or `r` is specified on the
querystring, cgit will wrongly consider the last configured repo as
selected.
Lars Hjemli [Mon, 24 Mar 2008 22:01:44 +0000 (23:01 +0100)]
Makefile: autobuild dependency rules
This uses gcc to generate dependency rules for each `.o` file, based on the
corresponding `.c` file, into a new set of `.d` files (which are also defined
to depend on the same set of source files as their `.o` files).
Result:
* all objectfile dependencies are correctly calculated
* only the necessary dependencies are recalculated when a sourcefile is updated
Inspiration for the build rules:
* http://www.gnu.org/software/make/manual/make.html#Automatic-Prerequisites
* http://make.paulandlesley.org/autodep.html
Lars Hjemli [Mon, 24 Mar 2008 15:00:27 +0000 (16:00 +0100)]
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.
Lars Hjemli [Sun, 23 Mar 2008 23:51:19 +0000 (00:51 +0100)]
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.
Lars Hjemli [Sat, 23 Feb 2008 21:45:33 +0000 (22:45 +0100)]
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().
Lars Hjemli [Sun, 24 Feb 2008 14:35:52 +0000 (15:35 +0100)]
Brown paper bag: don't use `grep -v`
For some inexplicable reason I'd gotten the semantics of `grep -v` totally
backwards, thinking it somehow would make the exitcode from grep indicate
the non-match of the specified pattern.
This fixes the broken tests and gives me a valuable lession about shell
programming at the same time.
Lars Hjemli [Sun, 24 Feb 2008 14:27:33 +0000 (15:27 +0100)]
Add regression-test for description-less repos
The segfault fixed in commit eacde43d7184452e1fdc90b982b531f1f5239923 was
triggered when the html-functions manipulated string literals. One callpatch
which could trigger the bug is in ui-repolist.c when repo descriptions are
passed to html_ntxt(): if a repo is lacking a description, the literal
string "[no description]" is used.
This patch changes test/setup.sh such that the first repo has no description,
and adds tests for both "[no description]" and "the bar repo" (description
of the other repo) to tests/t0101-index.sh, which should be enought to catch
regressions in these functions.
Noticed-by: Hiroki Hattori <seagull.kamome@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Lars Hjemli [Sat, 16 Feb 2008 12:56:09 +0000 (13:56 +0100)]
Move cgit_repo into cgit_context
This removes the global variable which is used to keep track of the
currently selected repository, and adds a new variable in the cgit_context
structure.
Lars Hjemli [Sat, 16 Feb 2008 12:07:13 +0000 (13:07 +0100)]
Add all config variables into struct cgit_context
This removes another big set of global variables, and introduces the
cgit_prepare_context() function which populates a context-variable with
compile-time default values.
Lars Hjemli [Sun, 2 Dec 2007 23:39:20 +0000 (00:39 +0100)]
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>
Lars Hjemli [Thu, 8 Nov 2007 11:20:05 +0000 (12:20 +0100)]
Support "/" as virtual-root
When the virtual-root was a single "/", it would be normalized to NULL due
to removal of trailing slashes, which in turn would fool us to belive that
we shouldn't generate virtual urls.
This makes the "/" normalize to "", effectively allowing virtual urls like
http://example.com/projectname to be generated without specifying the
full domain name as the virtual root.
Lars Hjemli [Mon, 5 Nov 2007 23:38:18 +0000 (00:38 +0100)]
Merge branch 'iconv-rebased' of http://x2a.org/pub/git/cgit
* 'iconv-rebased' of http://x2a.org/pub/git/cgit:
Use utf8::reencode_string from git
Convert subject and message with iconv_msg.
Add iconv_msg function.
Set msg_encoding according to the header.
Add commit->msg_encoding, allocate msg dynamicly.
Lars Hjemli [Sun, 28 Oct 2007 14:36:18 +0000 (15:36 +0100)]
Make print_branch() handle refs not pointing at commits
The master branch of stable/linux-2.6.20 currently references a tag
object, which makes print_branch() die with a segfault. This teaches
print_branch() to handle such cases more gracefully.
Lars Hjemli [Sat, 27 Oct 2007 08:55:10 +0000 (10:55 +0200)]
Merge branch 'filter-refs'
* filter-refs:
Add links to the new refs page from summary page
Add support for refs view
Make cgit_print_branches()/cgit_print_tags() external
Add descriptions of summary-branches and summary-tags to cgitrc
Add support for config param summary-branches
Move logic for age comparision from cmp_tag_age into cmp_age()
Add support for config param summary-tags
Sort tags by age
Use reflist to print tag info
Use reflist to print branch info
Add functions and types for ref lists
Lars Hjemli [Sat, 27 Oct 2007 08:13:42 +0000 (10:13 +0200)]
Add support for config param summary-branches
This parameter can be used to specify max number of branches to show
on the summary page (if not all branches will be displayed, the "most
idle" branches are the ones to be pruned). The default value for this
parameter is 0, which disables the pruning.