aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* git: update to v2.10.2 againJohn Keeping2016-11-241-0/+0
The submodule was accidentally downgraded in commit 8e9ddd21 (Bump version, 2016-11-23). Restore v2.10.2 so it matches the makefile again. Signed-off-by: John Keeping <john@keeping.me.uk>
* patch: reapply path limitJohn Keeping2016-10-121-2/+8
This was originally applied added in commit eac1b67 (ui-patch: Apply path limit to generated patch, 2010-06-10) but the ability to limit patches to particular paths was lost in commit 455b598 (ui-patch.c: Use log_tree_commit() to generate diffs, 2013-08-20). The new output is slightly different from the original because Git's diff infrastructure doesn't give us a way to insert an annotation immediately after the "---" separator, so the commit has moved below the diff stat. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-tree: remove a fixed size bufferJohn Keeping2016-10-011-6/+9
| | | | | | | | | As libgit.a moves away from using fixed size buffers, there is no guarantee that PATH_MAX is sufficient for all of the paths in a Git tree, so we should use a dynamically sized buffer here. Coverity-Id: 141884 Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-tag: clean up taginfoJohn Keeping2016-10-011-2/+4
| | | | | | | | | Free the taginfo when we're done with it. Also reduce the scope of a couple of variables so that it's clear that this is the only path that uses the taginfo structure. Coverity-Id: 141883 Signed-off-by: John Keeping <john@keeping.me.uk>
* shared: make cgit_free_taginfo() publicJohn Keeping2016-10-012-1/+2
| | | | | | We will use this function from ui-tag.c in the next patch. Signed-off-by: John Keeping <john@keeping.me.uk>
* shared: remove return value from cgit_free_commitinfo()John Keeping2016-10-012-3/+2
| | | | | | This return value is never used and the function always returns NULL. Signed-off-by: John Keeping <john@keeping.me.uk>
* tree: allow skipping through single-child treesJohn Keeping2016-10-011-2/+68
| | | | | | | | | If we have only a single element in a directory (for example in Java package paths), display multiple directories in one go so that it is possible to navigate directly to the first directory that contains either files or multiple directories. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-ssdiff: fix decl-after-statement warningsJohn Keeping2016-10-011-2/+2
| | | | | | | | git.git's coding style avoids decl-after-statement and we generally try to follow it but a few warnings have crept in recently. Fix the one in ui-ssdiff.c Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: fix decl-after-statement warningsJohn Keeping2016-10-011-5/+7
| | | | | | | | git.git's coding style avoids decl-after-statement and we generally try to follow it but a few warnings have crept in recently. Fix the ones in ui-shared.c Signed-off-by: John Keeping <john@keeping.me.uk>
* configfile: fix EOF handlingJohn Keeping2016-10-011-1/+3
Currently we can end up passing EOF to isspace(), which is in fact libgit's sane_isspace which does: ((sane_ctype[(unsigned char)(x)] & (GIT_SPACE)) != 0) It is very unlikely that EOF cast to "unsigned char" will end up in a character that has the GIT_SPACE bit set, but the standard only requires that EOF be a negative integer, so it could access any value in the sane_ctype array. If it does end up returning true for isspace() then this loop will never terminate, so handle EOF as a special value in the same way as the other loops in this function. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-atom: avoid DATE_STRFTIMEJohn Keeping2016-02-082-12/+4
| | | | | | | | | | | | | | Git's DATE_STRFTIME ignores the timezone argument and just uses the local timezone regardless of whether the "local" flag is set. Since Atom accepts ISO8601 dates [1], we can use Git's DATE_ISO8601_STRICT instead, which does get this right. Additionally, we never use the local timezone here so we can use the date_mode_from_type() wrapper to simplify the code a bit. [1] https://tools.ietf.org/html/rfc4287#section-3.3 Signed-off-by: John Keeping <john@keeping.me.uk>
* Avoid DATE_STRFTIME for long/short datesJohn Keeping2016-02-085-13/+10
| | | | | | | | | | | Git's DATE_STRFTIME ignores the timezone argument and just uses the local timezone regardless of whether the "local" flag is set. Since our existing FMT_LONGDATE and FMT_SHORTDATE are pretty-much perfect matches to DATE_ISO8601 and DATE_SHORT, switch to taking a date_mode_type directly in cgit_date_mode(). Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-stats: cast pointer before checking for zeroJohn Keeping2016-02-081-2/+2
We abuse the "void *util" field as a counter and recently started to cast it to a uintptr_t to avoid risking nasal demons by performing arithmetic on a void pointer. However, compilers are also known to do "interesting" things if they know that a pointer is or isn't NULL. Make this safer by checking if the counter (after casting) is non-zero rather than checking if the pointer is non-null. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: remove cgit_print_date()John Keeping2016-02-082-21/+0
| | | | | | There are no longer any users of this function. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-atom: use show_date directly for atom datesJohn Keeping2016-02-081-2/+7
| | | | | | | This will allow us to remove cgit_print_date and use Git's show_date consistently. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: use show_date for footer timestampJohn Keeping2016-02-081-1/+1
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* ui: show ages in the originator's timezoneJohn Keeping2016-02-085-18/+18
| | | | | | | This affects the tooltip showing the full time and the case when a date is sufficiently old to be shown in full rather than as an offset. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-{commit,tag}: show dates in originator's timezoneJohn Keeping2016-02-082-3/+6
| | | | | | | This is done by switching to Git's show_date() function and the mode given by cgit_date_mode(). Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: add cgit_date_mode()John Keeping2016-02-082-0/+10
| | | | | | | | This returns the correct mode value for use with Git's show_date() based on the current CGit configuration and will be used in the following patches. Signed-off-by: John Keeping <john@keeping.me.uk>
* parsing: add timezone to ident structuresJohn Keeping2016-02-082-4/+9
| | | | | | | This will allow us to mimic Git's behaviour of showing times in the originator's timezone when displaying commits and tags. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: remove "format" from cgit_print_age()John Keeping2016-02-085-9/+9
We never use any format other than FMT_SHORTDATE, so move that into the function. Signed-off-by: John Keeping <john@keeping.me.uk>
* cache: don't check for match with no keyJohn Keeping2016-01-171-2/+3
| | | | | | | | | | | We call open_slot() from cache_ls() without a key since we simply want to read the path out of the header. Should the file happen to contain an empty key then we end up calling memcmp() with NULL and a non-zero length. Fix this by assigning slot->match only if a key is set, which is always will be in the code paths where we use slot->match. Coverity-id: 13807 Signed-off-by: John Keeping <john@keeping.me.uk>
* cache: use size_t for string lengthsJohn Keeping2016-01-171-2/+2
| | | | | | | Avoid integer truncation on 64-bit systems. Coverity-id: 13864 Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-log: handle parse_commit() errorsJohn Keeping2016-01-171-1/+3
If parse_commit() fails, none of the fields in the commit structure will have been populated so we will dereference NULL when accessing item->tree. There isn't much we can do about the error at this point, but if we return true then we'll try parsing the commit again from print_commit() and we can report an error to the user at that point. Coverity-id: 13801 Signed-off-by: John Keeping <john@keeping.me.uk>
* Makefile: fix MAKEFLAGS tests with multiple flagsJohn Keeping2015-10-091-1/+1
| | | | | | | | findstring is defined as $(findstring FIND,IN) so if multiple flags are set these tests do the wrong thing unless $(MAKEFLAGS) is the second argument. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-refs: remove useless null checkJohn Keeping2015-10-091-1/+1
| | | | | | | There is no way that "tag" can be null here. Coverity-id: 13950 Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-blob: remove useless null checkJohn Keeping2015-10-091-1/+1
| | | | | | | | We have already called strlen() on "path" by the time we get here, so we know it can't be null. Coverity-id: 13954 Signed-off-by: John Keeping <john@keeping.me.uk>
* scan-tree: remove useless strdup()John Keeping2015-10-091-1/+1
| | | | | | | | | parse_configfile() takes a "const char *" and doesn't hold any references to it after it returns; there is no reason to pass it a duplicate. Coverity-id: 13941 Signed-off-by: John Keeping <john@keeping.me.uk>
* cgit.c: remove useless null checkJohn Keeping2015-10-091-1/+1
Everywhere else in this function we do not check whether the value is null and parse_configfile() never passes a null value to this callback. Coverity-id: 13846 Signed-off-by: John Keeping <john@keeping.me.uk>
* cmd: fix command definitionJohn Keeping2015-08-141-1/+1
The previous commit removed the "pre" field from "struct cgit_cmd" but forgot to update this macro. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de>
* ui-shared: cache errors for "dynamic TTL"John Keeping2015-08-141-0/+1
| | | | | | | Most errors we generate are (potentially) transient, such as non-existent object IDs so we don't want them to be cached forever. Signed-off-by: John Keeping <john@keeping.me.uk>
* cmd: remove "want_layout" fieldJohn Keeping2015-08-143-34/+24
| | | | | | No commands use this any more. Signed-off-by: John Keeping <john@keeping.me.uk>
* tree: move layout into page functionJohn Keeping2015-08-142-6/+19
| | | | | | | | This also allows us to return proper HTTP error codes when the requested tree is not found and display an error message in one case (invalid path inside valid commit) where we previously just displayed an empty page. Signed-off-by: John Keeping <john@keeping.me.uk>
* tag: move layout into page functionJohn Keeping2015-08-142-4/+11
| | | | | | | This also allows us to return proper HTTP error codes when something goes wrong. Signed-off-by: John Keeping <john@keeping.me.uk>
* summary: move layout into page functionJohn Keeping2015-08-142-1/+3
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* stats: move layout into page functionJohn Keeping2015-08-142-3/+7
| | | | | | | This also allows us to return proper HTTP error codes for invalid requests. Signed-off-by: John Keeping <john@keeping.me.uk>
* refs: move layout to page functionJohn Keeping2015-08-142-2/+3
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* log: move layout into page functionJohn Keeping2015-08-142-2/+5
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* diff: move layout to page functionJohn Keeping2015-08-142-6/+15
| | | | | | | The existing "show_ctrls" flag is used to control whether we are running in an existing page or control the page ourselves. Signed-off-by: John Keeping <john@keeping.me.uk>
* commit: move layout into page functionJohn Keeping2015-08-142-3/+7
| | | | | | | This allows us to return a proper HTTP status code when an object is not found by switching from cgit_print_error() to cgit_print_error_page(). Signed-off-by: John Keeping <john@keeping.me.uk>
* about: move layout into page functionsJohn Keeping2015-08-143-4/+11
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-shared: add cgit_print_layout_{start,end}()John Keeping2015-08-142-0/+15
| | | | | | | | These will avoid needing to call three functions to start page layout in subsequent patches when we move the layout setup into each individual page. Signed-off-by: John Keeping <john@keeping.me.uk>
* html: remove html_status()John Keeping2015-08-142-8/+0
| | | | | | This is now unused. Signed-off-by: John Keeping <john@keeping.me.uk>
* snapshot: don't reimplement cgit_print_error_page()John Keeping2015-08-141-17/+4
| | | | | | | | | | cgit_print_error_page() has the advantage that it sets a suitable HTTP status code for the response. Note that setting "mimetype" is redundant here since it cannot have changed since being initialized in cgit.c::prepare_context(), so we do not need to worry that cgit_print_error_page() does not set it. Signed-off-by: John Keeping <john@keeping.me.uk>
* snapshot: use cgit_print_error_page() for HTTP status codesJohn Keeping2015-08-141-2/+4
| | | | | | | | This is a bugfix as well as an improvement to the HTTP status code handling since previously we would not print HTTP headers on any of these code paths. Signed-off-by: John Keeping <john@keeping.me.uk>
* patch: use cgit_print_error_page() for HTTP status codesJohn Keeping2015-08-141-8/+8
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* blob: use cgit_print_error_page() to add HTTP headersJohn Keeping2015-08-141-4/+8
| | | | | | | | This is a bugfix as well as an improvement to the HTTP status code handling since previously we would not print HTTP headers on any of these code paths. Signed-off-by: John Keeping <john@keeping.me.uk>
* snapshot: use cgit_print_error_page() instead of html_status()John Keeping2015-08-141-1/+1
| | | | | | | This provides a formatted error response rather than a simple HTTP error. Signed-off-by: John Keeping <john@keeping.me.uk>
* plain: use cgit_print_error_page() instead of html_status()John Keeping2015-08-141-5/+5
| | | | | | | This provides a formatted error response rather than a simple HTTP error. Signed-off-by: John Keeping <john@keeping.me.uk>
* clone: use cgit_print_error_page() instead of html_status()John Keeping2015-08-141-5/+5
| | | | | | | This provides a formatted error response rather than a simple HTTP error. Signed-off-by: John Keeping <john@keeping.me.uk>