Commit Graph

232 Commits (d88ec849c4f7af41a8a41af1a4f79a2b4d41717a)

Author SHA1 Message Date
Jason A. Donenfeld d88ec849c4 Hosted on HTTPS now 8 years ago
Jason A. Donenfeld c34e28835b forms: action should not be empty
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years ago
Juuso Lapinlampi 9afda36ed7 ui-shared: Remove a name attribute with an empty value
The name attribute is optional in an input element, but it must not be
an empty value.

See: https://html.spec.whatwg.org/#attr-fe-name
See: https://html.spec.whatwg.org/#the-input-element
8 years ago
Juuso Lapinlampi 8d05b398bb ui-shared: HTML-ize DOCTYPE and <html>
Get rid of the XHTML headers, bringing cgit slowly to the modern age of
HTML.
8 years ago
Juuso Lapinlampi 80f12b3e7e ui-shared: Simplify cgit_print_error_page() logic 8 years ago
Jason A. Donenfeld e9cbdf6463 ui-shared: redirect should not exit early for cache
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years ago
Jason A. Donenfeld c424b5cb02 tabs: do not use target=_blank 8 years ago
Jason A. Donenfeld 5f2664f13c ui-shared: add homepage to tabs
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years ago
John Keeping 9c15f3c695 Avoid DATE_STRFTIME for long/short dates
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>
8 years ago
John Keeping 17c74eefa4 ui-shared: remove cgit_print_date()
There are no longer any users of this function.

Signed-off-by: John Keeping <john@keeping.me.uk>
8 years ago
John Keeping e68c86e8c5 ui-shared: use show_date for footer timestamp
Signed-off-by: John Keeping <john@keeping.me.uk>
8 years ago
John Keeping f2a901d2e1 ui: show ages in the originator's timezone
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>
8 years ago
John Keeping 360af46fac ui-shared: add cgit_date_mode()
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>
8 years ago
John Keeping 57ea1aa2a5 ui-shared: remove "format" from cgit_print_age()
We never use any format other than FMT_SHORTDATE, so move that into the
function.

Signed-off-by: John Keeping <john@keeping.me.uk>
8 years ago
Jason A. Donenfeld 513b3863d9 ui-shared: prevent malicious filename from injecting headers 8 years ago
Jason A. Donenfeld 4291453ec3 ui-shared: Avoid new line injection into redirect header 8 years ago
Lukas Fleischer da1b89710f Fix segmentation fault in hc()
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>
8 years ago
Christian Hesse 559ab5ecc4 git: update to v2.7.0
Update to git version v2.7.0.

* Upstream commit ed1c9977cb1b63e4270ad8bdf967a2d02580aa08 (Remove
  get_object_hash.) changed API:

  Convert all instances of get_object_hash to use an appropriate
  reference to the hash member of the oid member of struct object.
  This provides no functional change, as it is essentially a macro
  substitution.

Signed-off-by: Christian Hesse <mail@eworm.de>
8 years ago
Christian Hesse 6edfc1672c ui-shared: fix resource leak: free allocation from cgit_hosturl
Signed-off-by: Christian Hesse <mail@eworm.de>
9 years ago
Christian Hesse f77e2a8cfa ui-shared: return value of cgit_hosturl is not const
Signed-off-by: Christian Hesse <mail@eworm.de>
9 years ago
Christian Hesse 3e244a0cca ui-shared: fix resource leak: free allocation from cgit_currenturl
Coverity-id: 13927
Signed-off-by: Christian Hesse <mail@eworm.de>
9 years ago
Christian Hesse c5c0eb873e ui-shared: return value of cgit_currenturl is not const
Signed-off-by: Christian Hesse <mail@eworm.de>
9 years ago
Christian Hesse 37fce9916a ui-shared: fix resource leak: free allocation from cgit_fileurl
Coverity-id: 13918
Signed-off-by: Christian Hesse <mail@eworm.de>
9 years ago
John Keeping c5975ae566 ui-shared: cache errors for "dynamic TTL"
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>
9 years ago
John Keeping 764987980e ui-shared: add cgit_print_layout_{start,end}()
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>
9 years ago
John Keeping aec1204a54 ui-shared: add cgit_print_error_page() function
This will allow us to generate error responses with the correct HTTP
response code without needing all of the layout boilerplate.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
John Keeping a360666df3 ui-shared: show full date in tooltip if longer ago than max_relative
Commit caed6cb (ui-shared: show absolute time in tooltip for relative
dates, 2014-12-20) added a toolip when we show a relative time.

However, in some cases we show a short date (that is, the date but not
the time) if an event was sufficiently far in the past and that commit
did not update that case to add the same tooltip.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
John Keeping b44dd95f13 ui-shared: use common function in print_rel_date()
Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
John Keeping f03e3cb8a5 ui-shared: extract date formatting to a function
This will allow this code to be common with print_rel_date.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
Jason A. Donenfeld c0b5982303 redirect: cleanliness 9 years ago
John Keeping 30304d8156 log: allow users to follow a file
Teach the "log" UI to behave in the same way as "git log --follow", when
given a suitable instruction by the user.  The default behaviour remains
to show the log without following renames, but the follow behaviour can
be activated by following a link in the page header.

Follow is not the default because outputting merges in follow mode is
tricky ("git log --follow" will not show merges).  We also disable the
graph in follow mode because the commit graph is not simplified so we
end up with frequent gaps in the graph and many lines that do not
connect with any commits we're actually showing.

We also teach the "diff" and "commit" UIs to respect the follow flag on
URLs, causing the single-file version of these UIs to detect renames.
This feature is needed only for commits that rename the path we're
interested in.

For commits before the file has been renamed (i.e. that appear later in
the log list) we change the file path in the links from the log to point
to the old name; this means that links to commits always limit by the
path known to that commit.  If we didn't do this we would need to walk
down the log diff'ing every commit whenever we want to show a commit.
The drawback is that the "Log" link in the top bar of such a page links
to the log limited by the old name, so it will only show pre-rename
commits.  I consider this a reasonable trade-off since the "Back" button
still works and the log matches the path displayed in the top bar.

Since following renames requires running diff on every commit we
consider, I've added a knob to the configuration file to globally
enable/disable this feature.  Note that we may consider a large number
of commits the revision walking machinery no longer performs any path
limitation so we have to examine every commit until we find a page full
of commits that affect the target path or something related to it.

Suggested-by: René Neumann <necoro@necoro.eu>
Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
Jason A. Donenfeld d7034806a4 about: always ensure page has a trailing slash
Otherwise we can't easily embed links to other /about/ pages.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years ago
Christian Hesse de83de276b git: update to v2.5.0
Update to git version v2.5.0.

* Upstream commit 5455ee0573a22bb793a7083d593ae1ace909cd4c (Merge branch
  'bc/object-id') changed API:

  for_each_ref() callback functions were taught to name the objects
  not with "unsigned char sha1[20]" but with "struct object_id".

* Upstream commit dcf692625ac569fefbe52269061230f4fde10e47 (path.c: make
  get_pathname() call sites return const char *)

Signed-off-by: Christian Hesse <mail@eworm.de>
9 years ago
Christian Hesse d1ddce90f5 ui-shared: allow remote refs in branch switcher
Signed-off-by: Christian Hesse <mail@eworm.de>
9 years ago
Lukas Fleischer db021a1989 Remove no-op link from submodule entries
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>
9 years ago
Jason A. Donenfeld 8eef4589d0 ui-shared: currenturl should take into account leading slash 9 years ago
John Keeping d34b967190 ui-shared: don't use an integer as a NULL pointer
Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
John Keeping 94e5f212f5 ui-shared: avoid initializing static variable to zero
Sparse complains that we are using a plain integer as a NULL pointer
here, but in fact we do not have to specify a value for this variable at
all since it has static storage duration and thus will be initialized to
NULL by the compiler.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
John Keeping 0f23d4651c ui-shared: make cgit_doctype 'static'
This is not used outside this file and is not declared.

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
John Keeping e3d3fffdd4 Avoid non-ANSI function declarations
Sparse says things like:

	warning: non-ANSI function declaration of function 'calc_ttl'

Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
Jason A. Donenfeld 2e4a41e840 Make root handling sane again. 9 years ago
Jason A. Donenfeld 6bcda2f73d ui-shared: Add current url helper function. 9 years ago
Jason A. Donenfeld db4b735464 ui-shared: keep filter repolist page in pagination 9 years ago
Jason A. Donenfeld c3473e8a5d ui-repolist: use ctx.qry.url instead of rooturl, in case we're filtering 9 years ago
Lukas Fleischer 1a9e56607e ui-shared.c: Refactor add_clone_urls()
Make use of strbuf_split_str() and strbuf lists to split clone URLs.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
9 years ago
John Keeping c422b9b3d5 tag: reference with "h" instead of "id"
When clicking on "log" from a tag we end up showing the log of whatever
branch we used to reach the tag.  If the tag doesn't point onto a branch
then the tagged commit won't appear in this output.

By linking to tags with the head parameter instead of the "id" parameter
the log link will show the log of the tag.  This is clearly desirable
when the tag has been reached from the refs UI and changing the
behaviour for tag decorations makes them match branch decorations where
log -> decoration -> log shows the log of the decoration.

Reported-by: Ferry Huberts <mailings@hupie.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
9 years ago
Jason A. Donenfeld 2159414a39 footer: link back to cgit home page
The footer has always been overrideable using the footer= in cgitrc, so
this won't anger anybody who cares about their footer.
10 years ago
John Keeping caed6cb27f ui-shared: show absolute time in tooltip for relative dates
Signed-off-by: John Keeping <john@keeping.me.uk>
10 years ago
John Keeping 3c53ebfb57 ui-shared: add rel-vcs microformat links to HTML header
As described at https://joeyh.name/rfc/rel-vcs/.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years ago
John Keeping bbfa006e6e Extract clone URL printing to ui-shared.c
This will allow us to reuse the same logic to add clone URL <link/>
elements to the header of all repo-specific pages in order to support
the rel-vcs microformat.

Signed-off-by: John Keeping <john@keeping.me.uk>
10 years ago