aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2013-03-20cgit.mk: Use SHELL_PATH_SQ to run gen-version.shJohn Keeping1-1/+1
On some platforms (notably Solaris) /bin/sh doesn't support enough of POSIX for gen-version.sh to run. Git's Makefile provides SHELL_PATH_SQ to address this issue so we just have to use it. Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-20cgit.mk: don't rebuild everything if CGIT_VERSION changesJohn Keeping1-1/+8
If CGIT_VERSION is in CGIT_CFLAGS then a change in version (for example because you have committed your changes) causes all of the CGit objects to be rebuilt. Avoid this by using EXTRA_CPPFLAGS to add the version for only those files that are affected and make them depend on VERSION. Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-20ui-patch: use cgit_version not CGIT_VERSIONJohn Keeping1-1/+1
We already have a global cgit_version which is set from the #define'd CGIT_VERSION in cgit.c. Change ui-patch.c to use this so that we only need to rebuild cgit.o when the version changes. Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-20Makefile: re-use Git's Makefile where possibleJohn Keeping3-119/+80
Git does quite a lot of platform-specific detection in its Makefile, which can result in it defining preprocessor variables that are used in its header files. If CGit does not define the same variables it can result in different sizes of some structures in different places in the same application. For example, on Solaris Git uses it's "compat" regex library which has a different sized regex_t structure than that available in the platform regex.h. This has a knock-on effect on the size of "struct rev_info" and leads to hard to diagnose runtime issues. In order to avoid all of this, introduce a "cgit.mk" file that includes Git's Makefile and make all of the existing logic apply to CGit's objects as well. This is slightly complicated because Git's Makefile must run in Git's directory, so all references to CGit files need to be prefixed with "../". In addition, OBJECTS is a simply expanded variable in Git's Makefile so we cannot just add our objects to it. Instead we must copy the two applicable rules into "cgit.mk". This has the advantage that we can split CGit-specific CFLAGS from Git's CFLAGS and hence avoid rebuilding all of Git whenever a CGit-specific value changes. Signed-off-by: John Keeping <john@keeping.me.uk> Acked-by: Jamie Couture <jamie.couture@gmail.com>
2013-03-20tests: check that Git version are in syncJohn Keeping1-0/+36
This ensures that the Git version pointed at by the submodule is the same as the one that will be fetched using "make get-git". Suggested-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-20Merge branch 'wip'Jason A. Donenfeld18-111/+125
2013-03-20ui-shared: fix return type of cgit_self_linkJohn Keeping1-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>
2013-03-05cgit_print_snapshot_links(): Free prefix variableLukas Fleischer1-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>
2013-03-05cgit_print_commit(): Free tmp variableLukas Fleischer1-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>
2013-03-05cgit_print_tree(): Free curr_rev after usageLukas Fleischer1-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>
2013-03-05find_default_branch(): Free refmatch after usageLukas Fleischer1-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>
2013-03-05print_tag_downloads(): Free ref variableLukas Fleischer1-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>
2013-03-05Free reflists after usageLukas Fleischer3-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>
2013-03-05ui-shared.c: Remove unused function print_archive_ref()Lukas Fleischer1-39/+0
This is no longer used as of commit f135569b. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-03-05ui-shared.c: Remove unused function cgit_currurl()Lukas Fleischer1-12/+0
This is no longer used as of commit 0c8e184e. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-03-05Mark several functions/variables staticLukas Fleischer14-60/+64
Spotted by parsing the output of `gcc -Wmissing-prototypes [...]`. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-03-05t0107-snapshot: add tests for ZIP archivesJohn Keeping1-2/+37
Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-05tests: make whitespace consistentJohn Keeping3-14/+17
Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-05tests: "grep -e" is not portable to all platformsJohn Keeping8-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>
2013-03-04Makefile: Disable gettext in the Git submoduleLukas Fleischer1-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>
2013-03-04Makefile: improve dependency generationJamie Couture1-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>
2013-03-04cgit.c: Remove parameter from guess_defbranch()Lukas Fleischer1-2/+2
We use resolve_ref() since commit 8d7c2ec2, so this is no longer needed. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-03-04ui-tree.c: Use a context structure in walk_tree()Lukas Fleischer1-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>
2013-03-04ui-tree.c: Drop the header variableLukas Fleischer1-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>
2013-03-04ui-tree.c: Declare the state variable globallyLukas Fleischer1-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>
2013-03-04ui-tree.c: Pass current revision to print_object()Lukas Fleischer1-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>
2013-03-04ui-plain.c: Use a context structure in walk_tree()Lukas Fleischer1-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>
2013-03-04ui-plain.c: Do not access match variable in print_*()Lukas Fleischer1-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>
2013-03-04ui-blob.c: Use a context structure in walk_tree()Lukas Fleischer1-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>
2013-03-04ui-snapshot.c: Fill argv[0] with dummy.Jason A. Donenfeld1-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>
2013-03-04White space around control verbs.Jason A. Donenfeld16-42/+42
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2013-03-04Fix several whitespace errorsLukas Fleischer14-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>
2013-03-02Update git to v1.7.12.4John Keeping1-0/+0
No changes needed. Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-02Update git to v1.7.9.7John Keeping2-1/+1
resolve_ref() is renamed to resolve_ref_unsafe(). CGit's usage is safe. Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-02Update git to v1.7.8.6John Keeping1-0/+0
No changes required. Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-02Update git to v1.7.7.7John Keeping3-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>
2013-03-02Update git to v1.7.6.5John Keeping4-12/+43
struct pathspec is now used in more places. Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-02Update git to v1.7.5.4John Keeping3-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>
2013-03-02Print submodule revision next to submodule linkstfn1-0/+1
2013-02-01Support unannotated tags in git-clone.Jason A. Donenfeld1-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>
2013-02-01ssdiff: correctly manage tab expansionJulius Plenz1-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>
2013-02-01Make "owner" column on index page configurableFlorian Pritz4-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>
2012-11-15man: fix up default value duplicationJason A. Donenfeld1-2/+2
2012-11-15CGIT-0.9.1v0.9.1Jason A. Donenfeld1-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>
2012-11-15man: show mime type default valueJason A. Donenfeld1-0/+1
2012-11-15ssdiff: point line links at exact blob by prepending "id="Julius Plenz1-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>
2012-11-15Format git diff headers correctly when adding or removing files.Michael Halstead2-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.
2012-11-04Makefile: get snapshots from githubFerry Huberts1-2/+2
Github will have more bandwidth than Lars' server.
2012-11-01Makefile: remove tags fileJamie Couture1-1/+1
Remove tags file from working directory. Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
2012-10-28ui-shared: use placeholder for empty commit subjectChristian Franke1-1/+4
Display a placeholder when creating links to commits with empty subjects. This avoids the creation of links of the form <a></a>.