Lars Hjemli [Mon, 14 Apr 2008 08:17:33 +0000 (10:17 +0200)]
cgit.css: set form margins
According to the css2 spec, htmlforms have 1.12em top and bottom margins. That
doesn't play well with the placement of the search form, so lets force it to
use 0em margins.
Lars Hjemli [Sun, 13 Apr 2008 10:48:44 +0000 (12:48 +0200)]
Merge branch 'lh/layout'
* lh/layout:
Make repository search case insensitive
Remove 'patch' link from tab, add to commit view
Implement minimal freetext search in the repolist
More layout fixes
Minor fixup in tree-view css
Reintroduce the branch switcher
Add fixed link to index page from repo header
Include diff in commit view
Replace sidebar/logo
Lars Hjemli [Sun, 13 Apr 2008 10:20:00 +0000 (12:20 +0200)]
Remove 'patch' link from tab, add to commit view
It's a bit confusing to enter the patch view from the tab, since it has no
layout. And the commit view has always lacked showing the commit id. Both of
these warts are fixed by this commit, which adds a new header line in the
commit view which shows the commit id as a 'permalink' to the current commit
and also adds a link to the patch view of the current commit.
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.