aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/parsing.c
Commit message (Collapse)AuthorAge
* parsing.c: enable builds with NO_ICONV definedLars Hjemli2008-12-05
| | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* parsing.c: be prepared
#!/bin/sh

test_description='Check content on log page'
. ./setup.sh

test_expect_success 'generate foo/log' 'cgit_url "foo/log" >tmp'
test_expect_success 'find commit 1' 'grep "commit 1" tmp'
test_expect_success 'find commit 5' 'grep "commit 5" tmp'

test_expect_success 'generate bar/log' 'cgit_url "bar/log" >tmp'
test_expect_success 'find commit 1' 'grep "commit 1" tmp'
test_expect_success 'find commit 50' 'grep "commit 50" tmp'

test_expect_success 'generate "with%20space/log?qt=grep&q=commit+1"' '
	cgit_url "with+space/log&qt=grep&q=commit+1" >tmp
'
test_expect_success 'find commit 1' 'grep "commit 1" tmp'
test_expect_success 'find link with %20 in path' 'grep "/with%20space/log/?qt=grep" tmp'
test_expect_success 'find link with + in arg' 'grep "/log/?qt=grep&amp;q=commit+1" tmp'
test_expect_success 'no links with space in path' '! grep "href=./with space/" tmp'
test_expect_success 'no links with space in arg' '! grep "q=commit 1" tmp'
test_expect_success 'commit 2 is not visible' '! grep "commit 2" tmp'

test_done
/diff" && cgit_url "bar/patch" && ls cache >output && test_line_count = 0 output ' test_expect_success 'verify cache-size=1' ' rm -f cache/* && sed -e "s/cache-size=0$/cache-size=1/" cgitrc >cgitrc.tmp && mv -f cgitrc.tmp cgitrc && cgit_url "" && cgit_url "foo" && cgit_url "foo/refs" && cgit_url "foo/tree" && cgit_url "foo/log" && cgit_url "foo/diff" && cgit_url "foo/patch" && cgit_url "bar" && cgit_url "bar/refs" && cgit_url "bar/tree" && cgit_url "bar/log" && cgit_url "bar/diff" && cgit_url "bar/patch" && ls cache >output && test_line_count = 1 output ' test_expect_success 'verify cache-size=1021' ' rm -f cache/* && sed -e "s/cache-size=1$/cache-size=1021/" cgitrc >cgitrc.tmp && mv -f cgitrc.tmp cgitrc && cgit_url "" && cgit_url "foo" && cgit_url "foo/refs" && cgit_url "foo/tree" && cgit_url "foo/log" && cgit_url "foo/diff" && cgit_url "foo/patch" && cgit_url "bar" && cgit_url "bar/refs" && cgit_url "bar/tree" && cgit_url "bar/log" && cgit_url "bar/diff" && cgit_url "bar/patch" && ls cache >output && test_line_count = 13 output && cgit_url "foo/ls_cache" >output.full && strip_headers <output.full >output && test_line_count = 13 output && # Check that ls_cache output is cached correctly cgit_url "foo/ls_cache" >output.second && test_cmp output.full output.second ' test_done 07-06-26 | | | | | | | | The new function removes all trailing instances of an arbitrary character from a copy of the supplied char array. This is then used to remove any trailing slashes from cgit_query_path. Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Check for NULL commit buffer in cgit_parse_commit()Ondrej Jirman2007-05-31 | | | | | | This can be NULL, so try not to segfault. Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Handle single-line and empty commit subjectsOndrej Jirman2007-05-31 | | | | | | | | | | If commit object ends with \0 after subject line, then info->subject was not set. This commit fixes this and also sets subject to ** empty ** if it would otherwise be empty, so that there is something to click on. Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Don't be fooled by trailing '/' in url-parameterLars Hjemli2007-05-18 | | | | | | | | cgit_parse_url() didn't check if the path-part of urls contained a real path or just a trailing slash. This made the log-page die since the path filtering supplied an invalid path argument. This fixes it. Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Enable url=value querystring parameterLars Hjemli2007-05-18 | | | | | | | This makes is possible to use repo-urls like '/pub/scm/git/git.git' and even add path specifications, like '/pub/scm/git/git.git/log/documentation'. Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Restrict deep nesting of configfilesLars Hjemli2007-05-15 | | | | | | | | | | | | There is no point in restricting the number of included config- files, but there is a point in restricting the nestinglevel of configfiles: to avoid recursive inclusions. This is easily achieved by decrementing the static nesting-variable upon exit from cgit_read_config(). Also fix some whitespace breakage. Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Add include-parameter to config filesLars Hjemli2007-05-14 | | | | | | | | | This parameter can be used to include another config-file, like a standalone repository listing. Suggested in a patch by Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Update to libgit 1.5.2-rc2Lars Hjemli2007-05-08 | | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Do not die if tag has no messageLars Hjemli2007-02-04 | | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Add function cgit_parse_tag()Lars Hjemli2007-01-17 | | | | | | Teach cgit how to extract author info from a tag. Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Handle empty/malformed commit messagesLars Hjemli2007-01-16 | | | | | | | An empty commit message would trigger a segfault in the current cgit_parse_commit(). Also, make sure that all char-pointers are properly initialized. * Handle %xx encoding in querystringLars Hjemli2007-01-04 | | | | | | | Convert valid %xx expressions in querystring to ascii, ignore invalid expressions (i.e. eat the three characters %xx). Signed-off-by: Lars Hjemli <larsh@hal-2004.(none)> * Handle '+' in querystringLars Hjemli2006-12-28 | | | | | | Translate '+' to ' ' in querystring parser (still doesn't handle %xx) Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Teach commit parser about author/committer email + timestampLars Hjemli2006-12-16 | | | | | | | | | | | We want all four of these when showing a commit, so save them in the commitinfo struct. Btw: There's probably no good reason to save committer timestamp since it's already available in commit->date. But it doesn't hurt us either, and it makes the parser look more complete, so we just do it. Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Add ui-commit.c + misc ui cleanupsLars Hjemli2006-12-16 | | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Add a common commit parserLars Hjemli2006-12-15 | | | | | | Make a better commit parser, replacing the ugly one in ui-log.c Signed-off-by: Lars Hjemli <hjemli@gmail.com> * Rename config.c to parsing.c + move cgit_parse_query from cgit.c to parsing.cLars Hjemli2006-12-11 Signed-off-by: Lars Hjemli <hjemli@gmail.com>