summaryrefslogtreecommitdiff
path: root/ui-shared.c (unfollow)
Commit message (Collapse)AuthorFilesLines
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-04t0107-snapshot: add tests for ZIP archivesJohn Keeping1-2/+37
Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-04tests: make whitespace consistentJohn Keeping3-14/+17
Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-04tests: "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.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-10-31Makefile: 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>.
2012-10-27syntax-highlighting.sh: Fix command injection.Jason A. Donenfeld1-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.
2012-10-18Fix man page typo.Jason A. Donenfeld1-2/+2
2012-10-17Makefile: Support OpenBSD just like FreeBSDJason A. Donenfeld1-2/+2
2012-10-17Makefile: support FreeBSD libiconv pathsJason A. Donenfeld1-0/+7
According to Dan Rue <drue@therub.org>, FreeBSD requires the lib paths to get libiconv from /usr/local.
2012-10-17tests: check for proper html entityJason A. Donenfeld1-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>
2012-10-17ui-log: Add "commit-sort" option for controlling commit orderingTobias Bieniek8-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>
2012-10-17ui-repolist: Add "section-sort" flag to control section sorting.Tobias Bieniek4-3/+13
Flag which, when set to "1", will sort the sections on the repository listing by name. Set this flag to "0" if the order in the cgitrc file should be preserved. Default value: "1". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2012-10-17scan-tree: Unify gitweb.* and cgit.* settings into one config option.Jason A. Donenfeld5-58/+36
After some back and forth with Jamie and René, it looks like the git config semantics are going to be like this: - gitweb.category maps to the cgit repo config key "section" - gitweb.description maps to the cgit repo config key "desc" - gitweb.owner maps to the cgit repo config key "owner" - cgit.* maps to all cgit repo config keys This option can be enabled with "enable-git-config=1", and replaces all previous "enable-gitweb-*" config keys. The order of operations is as follows: - git config settings are applied in the order that they exist in the git config file - if the owner is not set from git config, get the owner using the usual getpwuid call - if the description is not set from git config, look inside the static $path/description file - if section-from-path=1, override whatever previous settings were inside of git config using the section-from-path logic - parse $path/cgitrc for local repo.* settings, that override all previous settings
2012-10-17ui: Remember to print ampersand as proper html entities.William Bell2-8/+8
2012-10-16ui-repolist: Rename section-sort to repository-sort.Jason A. Donenfeld4-7/+7
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2012-10-16repo_config: do not let globals override repo settingsTobias Bieniek1-3/+3
This makes it possible to activate the enable_commit_graph, enable_log_filecount, and enable_log_linecount for individual repositories, even if the global setting is "0" (default). The commit that introduced the broken behavior was e189344, and the commit message of that makes it clear that this wasn't the intended behavior. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2012-10-09README: times, they are a-changinJason A. Donenfeld1-1/+1
2012-10-09syntax-highlight: when the file has no extension, assume textFerry Huberts1-1/+4
There are 2 situations: 1- empty extension: assuming text is better than highlight producing no output because of a missing argument. 2- no extension at all: assuming text is better than setting the extension to the filename, which is what now happens. Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
2012-10-09ui-repolist: do not use agefile if it's date could not be parsedFerry Huberts1-2/+4
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
2012-10-09Revert "filters/syntax-highlighting.sh: work around highlight --force bug"Ferry Huberts1-17/+0
This reverts commit f50be7fda0a7ab57009169dd5905fcbab8eb5166. An update with the latest highlight landed in EPEL. This new version doesn't have the --force bug, so the workaround can now be removed. Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>