aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix crash when using path limitlf/for-jasonLukas Fleischer2016-11-251-4/+3
The array passed to setup_revisions() must be NULL-terminated. Fixes a regression introduced in 455b598 (ui-patch.c: Use log_tree_commit() to generate diffs, 2013-08-20). Reported-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
* Use skip_prefix() to get rid of magic constantsLukas Fleischer2016-10-122-28/+34
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
* Simplify http_parse_querystring()Lukas Fleischer2016-10-012-57/+11
Instead of reimplementing URL parameter parsing from scratch, use url_decode_parameter_name() and url_decode_parameter_value() which are already provided by Git. Also, change the return type of http_parse_querystring() to void since its only caller already ignores the return value. Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
* Avoid ambiguities when prettifying snapshot namesLukas Fleischer2016-07-053-20/+32
When composing snapshot file names for a tag with a prefix of the form v[0-9] (resp. V[0-9]), the leading "v" (resp. "V") is stripped. This leads to conflicts if a tag with the stripped name already exists or if there are tags only differing in the capitalization of the leading "v". Make sure we do not strip the "v" in these cases. Reported-by: Juuso Lapinlampi <wub@partyvan.eu> Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
* Fix segmentation fault in hc()Lukas Fleischer2016-01-131-0/+3
The ctx.qry.page variable might be unset at this point, e.g. when an invalid command is passed and cgit_print_pageheader() is called to show an error message. Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
* Remove no-op link from submodule entriesLukas Fleischer2015-03-132-18/+25
Instead of linking to the current page ("href='#'"), do not add a link to a submodule entry at all if the module-link setting is not used. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Drop return value from parse_user()Lukas Fleischer2015-03-051-11/+7
| | | | | | | | | In commit 936295c (Simplify commit and tag parsing, 2015-03-03), the commit and tag parsing code was refactored. This broke tag messages in ui-tag since the line after the tagger header was erroneously skipped. Rework parse_user() and skip the line manually outside parse_user(). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Remove leading newline characters from tag messagesLukas Fleischer2015-03-051-0/+3
Fixes a regression introduced in commit 936295c (Simplify commit and tag parsing, 2015-03-03). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Simplify commit and tag parsingLukas Fleischer2015-03-031-72/+42
* Use skip_prefix to avoid magic numbers in the code. * Use xcalloc() instead of xmalloc(), followed by manual initialization. * Split out line splitting. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-clone.c: Fix path checkLukas Fleischer2015-02-091-2/+2
The starts_with() check was broken in two ways: For one thing, the parameters were passed in the wrong order, for another thing, starts_with() returns 1 if the string starts with the prefix (not 0). Note that this bug existed since commit 02a545e (Add support for cloning over http, 2008-08-06) but only pops in in corner cases. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-shared.c: Refactor add_clone_urls()Lukas Fleischer2015-02-051-22/+10
| | | | | | Make use of strbuf_split_str() and strbuf lists to split clone URLs. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Add repo.hide and repo.ignoreLukas Fleischer2015-01-295-0/+23
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>
* Return proper HTTP response when accessing info/Lukas Fleischer2015-01-151-1/+3
Currently, when a user directly accesses the info command of a repository, we exit cgit without printing anything to stdout, bringing up error messages like "502 Bad Gateway" or "An error occurred while reading CGI reply (no response received)". Instead of bailing out, at least print the HTTP headers, including a reasonable error message. Reported-by: Janus Troelsen Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Use split_ident_line() in parse_user()Lukas Fleischer2014-12-241-28/+17
Use Git's built-in ident line splitting algorithm instead of reimplementing it. This does not only simplify the code but also makes sure that cgit is consistent with Git when it comes to author parsing. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Remove trailing slash after remove-suffixLukas Fleischer2014-12-231-3/+6
When removing the ".git" suffix of a non-bare repository, also remove the trailing slash for compatibility with cgit_repobasename(). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Always check if README exists in choose_readme()Lukas Fleischer2014-08-071-6/+0
Specifying a nonexistent README file via the readme option is sometimes useful, e.g. when using scan-path and setting a global default. Currently, we check whether there is only one option in the readme option and, if so, we choose that file without checking whether it exists. As a consequence, all repositories are equipped with an about link in the aforementioned scenario, even if there is no about file. Remove the early check for the number of keys and always check whether the file exists instead. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Remove unused parameter from cgit_print_snapshot()Lukas Fleischer2014-02-213-3/+3
* Skip cache slot when time-to-live is zeroLukas Fleischer2014-02-212-9/+15
| | | | | | | | | | If time-to-live is set to zero, we don't need to regenerate the cache slots on every request. Instead, just skip the caching process and immediately provide the dynamically generated version of the page. Setting time-to-live to zero is useful when you want to disable caching for certain pages. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* git: Update to 1.9.0Lukas Fleischer2014-02-212-1/+1
No code changes required, just bump the submodule and Makefile versions. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Add a cache-snapshot-ttl configuration variableLukas Fleischer2014-02-203-0/+12
This can be used to specify the TTL for snapshots. Snapshots are usually static and do not ever change. On the other hand, tarball generation is CPU intensive. One use case of this setting (apart from increasing the lifetime of snapshot cache slots) is caching of snapshots while disabling the cache for static/dynamic HTML pages (by setting TTL to zero for everything except for snapshot requests). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Switch to exclusively using global ctxLukas Fleischer2014-01-1719-442/+437
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>
* t0111: Additions and fixesLukas Fleischer2014-01-164-10/+10
| | | | | | | | | * Rename the capitalize-* filters to dump.* since they also dump the arguments. * Add full argument validation to the email filters. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* parsing.c: Remove leading space from committerLukas Fleischer2014-01-161-1/+1
| | | | | | | | This did not really break anything in the past since spaces are ignored when rendering HTML. Remove the preceding space anyway to prevent from potential future problems. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Add .mailmapLukas Fleischer2014-01-151-0/+10
| | | | Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* t0111: Add basic tests for Lua filtersLukas Fleischer2014-01-155-36/+63
* Validate the email filter by manipulating stdin. Additional checks for all the arguments can be added in a later patch. * Add the exec prefix to all informational messages. * Rename the filter repository to filter-exec. The Git repository itself is not renamed since it can be shared amongst all filter types. * In the filter checks, check whether all arguments are passed properly instead of validating the buffer/stdin only. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* tests/: Add t0111-filter.shLukas Fleischer2014-01-144-0/+57
This adds basic tests for all types of exec filters. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* cgitrc.5.txt: Fix documentation of the snapshot maskLukas Fleischer2014-01-141-6/+7
Mention that the snapshot setting only specifies the formats that links are generated for and not the set of formats that are accessible via HTTP. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* cgit.c: Fix comment on bit mask hackLukas Fleischer2014-01-101-8/+10
| | | | | | | | | * Formatting and spelling fixes. * A bit mask with the size of one byte only allows for storing 8 (not 255!) different flags. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* cgit.c: Use "else" for mutually exclusive branchesLukas Fleischer2014-01-101-19/+10
| | | | | | | | When parsing command line arguments, no pair of command line options can ever match simultaneously. Use "else if" blocks to reflect this. This change improves both readability and speed. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-snapshot.c: Do not reinvent suffixcmp()Lukas Fleischer2014-01-101-6/+1
| | | | | | | Use suffixcmp() from Git instead of reimplementing it. This is a preparation for moving to ends_with() in Git 1.8.6. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Refactor cgit_parse_snapshots_mask()Lukas Fleischer2014-01-101-11/+12
| | | | | | | Use Git string lists instead of str{spn,cspn,ncmp}() magic. This significantly improves readability. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Disallow use of undocumented snapshot delimitersLukas Fleischer2014-01-101-1/+1
| | | | | | | | | | | | | | | Since the introduction of selective snapshot format configuration in dc3c9b5 (allow selective enabling of snapshots, 2007-07-21), we allowed seven different delimiters for snapshot formats, while the documentation has always been clear about spaces being the only valid delimiter: The value is a space-separated list of zero or more of the values "tar", "tar.gz", "tar.bz2", "tar.xz" and "zip". Supporting the undocumented delimiters makes the code unnecessarily complex. Remove them. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Replace most uses of strncmp() with prefixcmp()Lukas Fleischer2014-01-106-20/+20
| | | | | | | This is a preparation for replacing all prefix checks with either strip_prefix() or starts_with() when Git 1.8.6 is released. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* README: Fix dependenciesLukas Fleischer2014-01-091-4/+3
| | | | | | | | | * Remove the dependency on Git (which can be obtained automatically when building, using either the Git submodule or `make get-git`). * Use proper upstream names of dependencies. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* README: Spelling and formatting fixesLukas Fleischer2014-01-081-41/+41
* Several small spelling and capitalization fixes. * Use consistent and better-looking formatting that is compatible with AsciiDoc (and partly compatible with RST). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Add AUTHORS fileLukas Fleischer2014-01-081-0/+6
| | | | | | | Contains a list of contributors with more than 20 patches, to be updated regularly. Signed-off-by: Lukas Fleischer <cgit@crytocrack.de>
* Update copyright informationLukas Fleischer2014-01-0823-31/+24
* Name "cgit Development Team" as copyright holder to avoid listing every single developer. * Update copyright ranges. Signed-off-by: Lukas Fleischer <cgit@crytocrack.de>
* ui-log.c: Several simplificationsLukas Fleischer2014-01-081-19/+9
| | | | | | | | * Use argv_array_pushf() for inserting formatted strings. * Remove unneeded static strings. * Replace "if" by "else if" for readability and speed. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Use argv_array in place of vectorLukas Fleischer2014-01-084-75/+15
| | | | | | | | | Instead of using our own vector implementation, use argv_array from Git which has been specifically designed for dynamic size argv arrays. Drop vector.h and vector.c which are no longer needed. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-stats.c: Remove unused macroLukas Fleischer2014-01-081-2/+0
| | | | Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* scan-tree.c: Remove unused macroLukas Fleischer2014-01-081-2/+0
| | | | | | | This is no longer needed since commit fb3655df (use struct strbuf instead of static buffers, 2013-04-06). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-shared: Drop filepair_cb_raw() and helperLukas Fleischer2013-09-142-73/+0
| | | | | | | | Remove filepair_cb_raw() and all related functions. These are no longer needed. We now use Git's internal functions for raw diff formatting everywhere. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-diff: Use diff_tree_sha1() for raw diff formattingLukas Fleischer2013-09-141-2/+21
| | | | | | | Use Git's internal diff_tree_sha1() function for the /rawdiff/ command instead of trying to recreate this functionality. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* tests/: Add t0110-rawdiff.shLukas Fleischer2013-08-261-0/+42
| | | | | | This adds some basic tests for the /rawdiff/ command. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* t0108: Add tests for revision rangesLukas Fleischer2013-08-261-0/+17
| | | | | | Add tests to check whether generating multiple patches at once works. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* t0108: Compare output with git-format-patch(1)Lukas Fleischer2013-08-261-0/+7
| | | | Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-patch.c: Add additional newline after each patchLukas Fleischer2013-08-262-3/+3
| | | | | | For consistency with git-format-patch(1). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-patch.c: Fix signature delimiterLukas Fleischer2013-08-261-1/+1
| | | | | | | Add a missing space after the "--" marker that introduces the patch signature. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* t0108: Avoid unnecessary fork()Lukas Fleischer2013-08-261-1/+1
Use `git rev-list --max-parents=0 HEAD` instead of `git rev-list HEAD | tail -1` to get the root commit. This works since Git 1.7.4.2. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-patch.c: Fix formatting for merge commitsLukas Fleischer2013-08-221-0/+1
| | | | | | | Add max_parents = 1 to the revision walk in order to make sure we do not include the footer signature twice for merge commits. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>