aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * cgit_print_snapshot_links(): Free prefix variableLukas Fleischer2013-03-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes following memory leak seen with "PATH_INFO=/cgit/commit/": ==16894== 12 bytes in 1 blocks are definitely lost in loss record 9 of 92 ==16894== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16894== by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so) ==16894== by 0x46CAC8: xstrdup (wrapper.c:35) ==16894== by 0x414E34: cgit_print_snapshot_links (ui-shared.c:926) ==16894== by 0x40CFA1: cgit_print_commit (ui-commit.c:102) ==16894== by 0x407B06: commit_fn (cmd.c:54) ==16894== by 0x405E16: process_request (cgit.c:574) ==16894== by 0x4074C8: cache_process (cache.c:322) ==16894== by 0x406C4F: main (cgit.c:872) Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
| * cgit_print_commit(): Free tmp variableLukas Fleischer2013-03-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes following memory leak seen with "PATH_INFO=/cgit/commit/": ==16894== 7 bytes in 1 blocks are definitely lost in loss record 4 of 92 ==16894== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16894== by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so) ==16894== by 0x46CAC8: xstrdup (wrapper.c:35) ==16894== by 0x40CD6F: cgit_print_commit (ui-commit.c:70) ==16894== by 0x407B06: commit_fn (cmd.c:54) ==16894== by 0x405E16: process_request (cgit.c:574) ==16894== by 0x4074C8: cache_process (cache.c:322) ==16894== by 0x406C4F: main (cgit.c:872) Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
| * cgit_print_tree(): Free curr_rev after usageLukas Fleischer2013-03-041-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes following memory leak seen with "PATH_INFO=/cgit/tree/": ==15715== 7 bytes in 1 blocks are definitely lost in loss record 4 of 51 ==15715== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==15715== by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so) ==15715== by 0x46CAA8: xstrdup (wrapper.c:35) ==15715== by 0x418A4C: cgit_print_tree (ui-tree.c:274) ==15715== by 0x407D91: tree_fn (cmd.c:131) ==15715== by 0x405E16: process_request (cgit.c:574) ==15715== by 0x4074C8: cache_process (cache.c:322) ==15715== by 0x406C4F: main (cgit.c:872) Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
| * find_default_branch(): Free refmatch after usageLukas Fleischer2013-03-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes following memory leak seen with "PATH_INFO=/cgit/refs/": ==13408== 7 bytes in 1 blocks are definitely lost in loss record 4 of 52 ==13408== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==13408== by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so) ==13408== by 0x46CA78: xstrdup (wrapper.c:35) ==13408== by 0x405840: find_current_ref (cgit.c:426) ==13408== by 0x44BE5A: do_one_ref (refs.c:527) ==13408== by 0x44D3E0: do_for_each_ref_in_dir (refs.c:553) ==13408== by 0x44D85A: do_for_each_ref (refs.c:1298) ==13408== by 0x405889: find_default_branch (cgit.c:438) ==13408== by 0x405AC4: prepare_repo_cmd (cgit.c:490) ==13408== by 0x405D97: process_request (cgit.c:557) ==13408== by 0x407490: cache_process (cache.c:322) ==13408== by 0x406C18: main (cgit.c:864) Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
| * print_tag_downloads(): Free ref variableLukas Fleischer2013-03-041-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure the ref variable is freed if we build a "$basename-$version"-style ref. This fixes following memory leak seen with "PATH_INFO=/cgit/refs/": ==8784== 323 bytes in 29 blocks are definitely lost in loss record 41 of 53 ==8784== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==8784== by 0x56F2DF1: strdup (in /usr/lib/libc-2.17.so) ==8784== by 0x46CA28: xstrdup (wrapper.c:35) ==8784== by 0x410DA6: print_tag_downloads (ui-refs.c:115) ==8784== by 0x410F02: print_tag (ui-refs.c:141) ==8784== by 0x41128B: cgit_print_tags (ui-refs.c:230) ==8784== by 0x41134D: cgit_print_refs (ui-refs.c:250) ==8784== by 0x407C85: refs_fn (cmd.c:105) ==8784== by 0x405DDF: process_request (cgit.c:566) ==8784== by 0x407490: cache_process (cache.c:322) ==8784== by 0x406C18: main (cgit.c:864) Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
| * Free reflists after usageLukas Fleischer2013-03-043-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Free reflists in cgit_print_branches() and in cgit_print_tags() before returning reflist structures to the stack. This fixes following memory leaks seen with "PATH_INFO=/cgit/refs/": ==5710== 1,312 (32 direct, 1,280 indirect) bytes in 1 blocks are definitely lost in loss record 63 of 71 ==5710== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==5710== by 0x4C2C2FF: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==5710== by 0x46CA9B: xrealloc (wrapper.c:100) ==5710== by 0x40AAA6: cgit_add_ref (shared.c:156) ==5710== by 0x40ABC4: cgit_refs_cb (shared.c:186) ==5710== by 0x44BCBA: do_one_ref (refs.c:527) ==5710== by 0x44D240: do_for_each_ref_in_dir (refs.c:553) ==5710== by 0x44D6BA: do_for_each_ref (refs.c:1298) ==5710== by 0x410FE2: cgit_print_branches (ui-refs.c:191) ==5710== by 0x4111E9: cgit_print_refs (ui-refs.c:244) ==5710== by 0x407C85: refs_fn (cmd.c:105) ==5710== by 0x405DDF: process_request (cgit.c:566) ==5710== ==5710== 6,846 (256 direct, 6,590 indirect) bytes in 1 blocks are definitely lost in loss record 68 of 71 ==5710== at 0x4C2C25E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==5710== by 0x46CA9B: xrealloc (wrapper.c:100) ==5710== by 0x40AAA6: cgit_add_ref (shared.c:156) ==5710== by 0x40ABC4: cgit_refs_cb (shared.c:186) ==5710== by 0x44BCBA: do_one_ref (refs.c:527) ==5710== by 0x44D240: do_for_each_ref_in_dir (refs.c:553) ==5710== by 0x44D6EC: do_for_each_ref (refs.c:1288) ==5710== by 0x4110D5: cgit_print_tags (ui-refs.c:218) ==5710== by 0x4111FD: cgit_print_refs (ui-refs.c:246) ==5710== by 0x407C85: refs_fn (cmd.c:105) ==5710== by 0x405DDF: process_request (cgit.c:566) ==5710== by 0x407490: cache_process (cache.c:322) Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
| * ui-shared.c: Remove unused function print_archive_ref()Lukas Fleischer2013-03-041-39/+0
| | | | | | | | | | | | This is no longer used as of commit f135569b. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
| * ui-shared.c: Remove unused function cgit_currurl()Lukas Fleischer2013-03-041-12/+0
| | | | | | | | | | | | This is no longer used as of commit 0c8e184e. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
| * Mark several functions/variables staticLukas Fleischer2013-03-0414-60/+64
| | | | | | | | | | | | Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* | ui-shared: fix return type of cgit_self_linkJohn Keeping2013-03-201-41/+42
|/ | | | | | | | | | | | | | cgit_self_link() is a void function but implements each case it handles by doing "return <another_void_function>" which is not valid C; section 6.8.6.4 of C11 says: A return statement with an expression shall not appear in a function whose return type is void. Fix this by removing the return keywords and converting the final code block into an "else". Signed-off-by: John Keeping <john@keeping.me.uk>
* t0107-snapshot: add tests for ZIP archivesJohn Keeping2013-03-041-2/+37
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: make whitespace consistentJohn Keeping2013-03-043-14/+17
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: "grep -e" is not portable to all platformsJohn Keeping2013-03-048-55/+55
| | | | | | | | The "-e" option to grep is not needed unless specifying more than one pattern, which we don't do. Remove it to avoid restricting the tests on platforms that do not have a grep that recognises "-e". Signed-off-by: John Keeping <john@keeping.me.uk>
* Makefile: Disable gettext in the Git submoduleLukas Fleischer2013-03-041-1/+1
| | | | | | | | | | | | | | | Newer libgit versions depend on the libintl library. However, we currently do not link against libintl which breaks compilation under OpenBSD: git/libgit.a(commit.o)(.text+0x1d1b): In function `lookup_commit_or_die': git/gettext.h:47: undefined reference to `libintl_gettext' [...] Since we do not support i18n in cgit, just disable gettext in the Git submodule to fix this. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* Makefile: improve dependency generationJamie Couture2013-03-041-70/+82
| | | | | | | | | | | | | | | | | | | | Makefile target generation would always be included for any makefile target that was not clean. Only care to include the '.deps' directory when building cgit, rather than generating and including dependencies when calling other makefile targets. Heavily borrowed from git's Makefile, but without definitions to test for the compiler's header dependency feature. Previous Makefile implementation never checked for this compiler feature anyway. - Removed makecmdgoal 'clean' check - Grouped like .PHONY target definitions - Place build dependency targets under .SUFFIXES - Re-arranged location of library inclusion definitions - Use google code mirror instead of github Signed-off-by: Jamie Couture <jamie.couture@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* cgit.c: Remove parameter from guess_defbranch()Lukas Fleischer2013-03-041-2/+2
| | | | | | We use resolve_ref() since commit 8d7c2ec2, so this is no longer needed. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-tree.c: Use a context structure in walk_tree()Lukas Fleischer2013-03-041-22/+29
| | | | | | | | | | Use the context pointer to pass context information instead of misusing global variables, as we already did in "ui-blob.c" and in "ui-plain.c". In addition to the fixes to walk_tree(), pass the same structure to ls_tree() and ls_item() which is read_tree_recursive()-based as well. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-tree.c: Drop the header variableLukas Fleischer2013-03-041-6/+2
| | | | | | | Instead, use the value of the state variable to determine whether the footer needs to be drawn. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-tree.c: Declare the state variable globallyLukas Fleischer2013-03-041-1/+2
| | | | | | | | | | | This allows for removing the header variable in a following patch. We can use the state variable to check whether the tail needs to be printed instead. Note that the state variable will be moved into a context structure later. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-tree.c: Pass current revision to print_object()Lukas Fleischer2013-03-041-3/+3
| | | | | | | | | | No longer access the global curr_rev variable in print_object(). This will make it easier to squash the curr_rev variable into a context structure without having to pass the context to the print_object() function. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-plain.c: Use a context structure in walk_tree()Lukas Fleischer2013-03-041-13/+20
| | | | | | | | Do not misuse global variables to save the context. Instead, use the context pointer which was designed to share information between a read_tree_fn and the caller. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-plain.c: Do not access match variable in print_*()Lukas Fleischer2013-03-041-12/+14
| | | | | | | | | Move all code setting the match variable to walk_tree(). This allows for easily moving this variable into a context structure without having to pass the context to print_*(). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-blob.c: Use a context structure in walk_tree()Lukas Fleischer2013-03-041-16/+26
| | | | | | | | | | | | Do not misuse global variables to save the context. Instead, use the context pointer which was designed to share information between a read_tree_fn and the caller. This also prevents from potential misuse of the global pointers match_path and matched_sha1 after the referenced values have been overwritten on the stack. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-snapshot.c: Fill argv[0] with dummy.Jason A. Donenfeld2013-03-041-0/+1
| | | | | | | | | parse_archive_args does not pass PARSE_OPT_KEEP_ARGV0 to parse_args, which means the first argument will be discarded, as though it were a function being called from the command-line. Thus, we fill argv[0] with a dummy argument to prevent this from happening. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* White space around control verbs.Jason A. Donenfeld2013-03-0416-42/+42
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Fix several whitespace errorsLukas Fleischer2013-03-0414-99/+99
| | | | | | | | | | * 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>
* Update git to v1.7.12.4John Keeping2013-03-021-0/+0
| | | | | | No changes needed. Signed-off-by: John Keeping <john@keeping.me.uk>
* Update git to v1.7.9.7John Keeping2013-03-022-1/+1
| | | | | | resolve_ref() is renamed to resolve_ref_unsafe(). CGit's usage is safe. Signed-off-by: John Keeping <john@keeping.me.uk>
* Update git to v1.7.8.6John Keeping2013-03-021-0/+0
| | | | | | No changes required. Signed-off-by: John Keeping <john@keeping.me.uk>
* Update git to v1.7.7.7John Keeping2013-03-023-25/+38
| | | | | | | This release changes the archive interface so that we now need to pass argv into write_archive(). Signed-off-by: John Keeping <john@keeping.me.uk>
* Update git to v1.7.6.5John Keeping2013-03-024-12/+43
| | | | | | struct pathspec is now used in more places. Signed-off-by: John Keeping <john@keeping.me.uk>
* Update git to v1.7.5.4John Keeping2013-03-023-6/+6
| | | | | | | | | 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>
* Print submodule revision next to submodule linkstfn2013-03-021-0/+1
|
* Support unannotated tags in git-clone.Jason A. Donenfeld2013-02-011-4/+2
| | | | | | | | | | | | | | | | | | | Matthew McClintock reported that older unannotated tags were not correctly being cloned and did not appear in info/refs. Further investigation revealed some dubious prefix comparison code for determining whether or not to write refs in info/refs. After comparing it with git's own http-backend.c, it appears upstream does not use this prefix logic. OTOH, I don't know what the reasoning was when the prefix logic was introduced. It appears to me to just be buggy, though it's possible there are other reasons, and we'll have to revisit this commit. But for now, Works For Me. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Matthew McClintock <msm@freescale.com> Reported-by: Matthew McClintock <msm@freescale.com>
* ssdiff: correctly manage tab expansionJulius Plenz2013-02-011-2/+1
| | | | | | | Previously, replace_tabs("foo\tbar") would become " foobar". Signed-off-by: Julius Plenz <plenz@cis.fu-berlin.de> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Make "owner" column on index page configurableFlorian Pritz2013-02-014-7/+20
| | | | | | | | | This is not really needed for personal sites where all repos belong to the same person. Since it is pretty useful for shared sites however, it should be configurable. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* man: fix up default value duplicationJason A. Donenfeld2012-11-151-2/+2
|
* CGIT-0.9.1v0.9.1Jason A. Donenfeld2012-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enhancements: - path-selected submodule links - intelligent default branch guessing - /etc/mime.types lookup - gitweb.* and cgit.* git-config support - case insensitive sorting and age sorting - commit, repository, and section sorting - bold currently viewed page in pagination - support BSDs in makefile Security: - CVE-2012-4465: heap-buffer overflow in parsing.c - CVE-2012-4548: syntax highlighting command injection Bug Fixes: - transition maintainer to Jason Donenfeld (zx2c4) - download git snapshot from github instead of Lars' old server - css fixes - stablization of tests - more compatible default highlight script - suppress gzip timestamp so that tarballs only use tar timestamps - treat ctags as target in makefile - do not let global variables override certain local repo settings - print ampersand as proper html entity - use placeholder for empty commit subject - format diff view for addition and removal of files - point links at correct blob from ssdiff Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* man: show mime type default valueJason A. Donenfeld2012-11-151-0/+1
|
* ssdiff: point line links at exact blob by prepending "id="Julius Plenz2012-11-151-2/+2
| | | | | | | | | | Previously, the id_str (i.e. the current or diffed-against commit's SHA1 ID) was simply concatenated to the URL. Now, prepend an "id=" string so that the links actually point to the right blobs and thus the exact lines. Signed-off-by: Julius Plenz <plenz@cis.fu-berlin.de> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Format git diff headers correctly when adding or removing files.Michael Halstead2012-11-152-14/+22
| | | | | | Copying the output of cgit and using it in patches now works when adding files to or removing files from the repository. This is helpful for people who use cgit in their patch workflow.
* Makefile: get snapshots from githubFerry Huberts2012-11-041-2/+2
| | | | Github will have more bandwidth than Lars' server.
* Makefile: remove tags fileJamie Couture2012-10-311-1/+1
| | | | | | Remove tags file from working directory. Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
* ui-shared: use placeholder for empty commit subjectChristian Franke2012-10-281-1/+4
| | | | | Display a placeholder when creating links to commits with empty subjects. This avoids the creation of links of the form <a></a>.
* syntax-highlighting.sh: Fix command injection.Jason A. Donenfeld2012-10-271-2/+2
| | | | | | | | | By not quoting the argument, an attacker with the ability to add files to the repository could pass arbitrary arguments to the highlight command, in particular, the --plug-in argument which can lead to arbitrary command execution. This patch adds simple argument quoting.
* Fix man page typo.Jason A. Donenfeld2012-10-181-2/+2
|
* Makefile: Support OpenBSD just like FreeBSDJason A. Donenfeld2012-10-171-2/+2
|
* Makefile: support FreeBSD libiconv pathsJason A. Donenfeld2012-10-171-0/+7
| | | | | According to Dan Rue <drue@therub.org>, FreeBSD requires the lib paths to get libiconv from /usr/local.
* tests: check for proper html entityJason A. Donenfeld2012-10-171-1/+1
| | | | | | | Since we're now properly writing ampersand literals as &amp; instead of as a plain &, we need to update the test accordingly. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui-log: Add "commit-sort" option for controlling commit orderingTobias Bieniek2012-10-178-6/+40
| | | | | | | This makes it possible to use strict commit date ordering or strict topological ordering by passing the corresponding flags to "git log". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>