]> granicus.if.org Git - cgit/log
cgit
6 years agoauth-filters: do not crash on nil username
Jason A. Donenfeld [Sat, 14 Jul 2018 03:10:28 +0000 (05:10 +0200)]
auth-filters: do not crash on nil username

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoauth-filter: do not write more than we've read
Jason A. Donenfeld [Sat, 14 Jul 2018 03:09:27 +0000 (05:09 +0200)]
auth-filter: do not write more than we've read

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoauth-filters: do not use HMAC-SHA1
Jason A. Donenfeld [Sat, 14 Jul 2018 01:32:00 +0000 (03:32 +0200)]
auth-filters: do not use HMAC-SHA1

Though SHA1 is broken, HMAC-SHA1 is still fine. But let's not push our
luck; SHA256 is more sensible anyway.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoBump version. v1.2
Jason A. Donenfeld [Fri, 13 Jul 2018 20:40:42 +0000 (22:40 +0200)]
Bump version.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoUpdate COPYING
Todd Zullinger [Tue, 10 Jul 2018 14:03:34 +0000 (10:03 -0400)]
Update COPYING

The address of the Free Software Foundation has changed since the
license was added in 7640d90 ("Add license file and copyright notices",
2006-12-10).  Update the license file from gnu.org¹.

The only non-whitespace changes are the updated FSF address and two
references to the L in LGPL changed from Library to Lesser.

¹ https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt

Signed-off-by: Todd Zullinger <tmz@pobox.com>
6 years agocss: use correct size in annotated decoration
Jason A. Donenfeld [Sun, 8 Jul 2018 17:14:44 +0000 (19:14 +0200)]
css: use correct size in annotated decoration

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agocgitrc.5: add local tar signature example
Jason A. Donenfeld [Thu, 5 Jul 2018 00:38:33 +0000 (02:38 +0200)]
cgitrc.5: add local tar signature example

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoFix gcc 8.1.1 compiler warnings
Jason A. Donenfeld [Wed, 4 Jul 2018 01:13:31 +0000 (03:13 +0200)]
Fix gcc 8.1.1 compiler warnings

    CC ../shared.o
../shared.c: In function ‘expand_macro’:
../shared.c:487:3: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
   strncpy(name, value, len);
   ^~~~~~~~~~~~~~~~~~~~~~~~~
../shared.c:484:9: note: length computed here
   len = strlen(value);
         ^~~~~~~~~~~~~
../ui-shared.c: In function ‘cgit_repobasename’:
../ui-shared.c:136:2: warning: ‘strncpy’ specified bound 1024 equals destination size [-Wstringop-truncation]
  strncpy(rvbuf, reponame, sizeof(rvbuf));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CC ../ui-ssdiff.o
../ui-ssdiff.c: In function ‘replace_tabs’:
../ui-ssdiff.c:142:4: warning: ‘strncat’ output truncated copying between 1 and 8 bytes from a string of length 8 [-Wstringop-truncation]
    strncat(result, spaces, 8 - (strlen(result) % 8));
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agocgitrc.5: document new signature notes
Jason A. Donenfeld [Tue, 3 Jul 2018 18:44:08 +0000 (20:44 +0200)]
cgitrc.5: document new signature notes

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agosnapshot: support tar signature for compressed tar
Christian Hesse [Thu, 7 Jun 2018 19:31:28 +0000 (21:31 +0200)]
snapshot: support tar signature for compressed tar

This adds support for kernel.org style signatures where the uncompressed
tar archive is signed and compressed later. The signature is valid for
all tar* snapshots.

We have a filter which snapshots may be generated and downloaded. This has
to allow tar signatures now even if tar itself is not allowed. To simplify
things we allow all signatures.

Signed-off-by: Christian Hesse <mail@eworm.de>
6 years agoextra-head-content: introduce another option for meta tags
Jason A. Donenfeld [Mon, 12 Feb 2018 22:10:06 +0000 (23:10 +0100)]
extra-head-content: introduce another option for meta tags

This is to support things like go-import meta tags, which are on a
per-repo basis.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoUse string list strdup_strings for mimetypes
John Keeping [Wed, 20 Jun 2018 10:12:09 +0000 (18:12 +0800)]
Use string list strdup_strings for mimetypes

There's no need to do this manually with the string list API will do it
for us.

Signed-off-by: John Keeping <john@keeping.me.uk>
6 years agomanpage: fix sorting order
Andy Green [Wed, 20 Jun 2018 10:12:03 +0000 (18:12 +0800)]
manpage: fix sorting order

You maybe didn't know you had OCD until you saw an
alpha sorted list that has stuff out of order in it.

Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
6 years agocache: close race window when unlocking slots
John Keeping [Wed, 20 Jun 2018 05:29:14 +0000 (07:29 +0200)]
cache: close race window when unlocking slots

We use POSIX advisory record locks to control access to cache slots, but
these have an unhelpful behaviour in that they are released when any
file descriptor referencing the file is closed by this process.

Mostly this is okay, since we know we won't be opening the lock file
anywhere else, but there is one place that it does matter: when we
restore stdout we dup2() over a file descriptor referring to the file,
thus closing that descriptor.

Since we restore stdout before unlocking the slot, this creates a window
during which the slot content can be overwritten.  The fix is reasonably
straightforward: simply restore stdout after unlocking the slot, but the
diff is a bit bigger because this requires us to move the temporary
stdout FD into struct cache_slot.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agogit: update to v2.18.0
Christian Hesse [Mon, 4 Jun 2018 16:49:28 +0000 (18:49 +0200)]
git: update to v2.18.0

Update to git version v2.18.0. Required changes follow upstream commits:

* Convert find_unique_abbrev* to struct object_id
  (aab9583f7b5ea5463eb3f653a0b4ecac7539dc94)
* sha1_file: convert read_sha1_file to struct object_id
  (b4f5aca40e6f77cbabcbf4ff003c3cf30a1830c8)
* sha1_file: convert sha1_object_info* to object_id
  (abef9020e3df87c441c9a3a95f592fce5fa49bb9)
* object-store: move packed_git and packed_git_mru to object store
  (a80d72db2a73174b3f22142eb2014b33696fd795)
* treewide: rename tree to maybe_tree
  (891435d55da80ca3654b19834481205be6bdfe33)

The changed data types required some of our own functions to be converted
to struct object_id:

  ls_item
  print_dir
  print_dir_entry
  print_object
  single_tree_cb
  walk_tree
  write_tree_link

And finally we use new upstream functions that were added for
struct object_id:

  hashcpy     -> oidcpy
  sha1_to_hex -> oid_to_hex

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
6 years agoglobal: remove functionality we deprecated for cgit v1.0
Christian Hesse [Mon, 18 Jun 2018 09:48:43 +0000 (11:48 +0200)]
global: remove functionality we deprecated for cgit v1.0

The man page states these were deprecated for v1.0. We are past v1.1,
so remove the functionality.

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
6 years agosnapshot: strip bit from struct cgit_snapshot_format
Christian Hesse [Mon, 11 Jun 2018 06:26:59 +0000 (08:26 +0200)]
snapshot: strip bit from struct cgit_snapshot_format

We had a static bit value in struct cgit_snapshot_format. We do not rely
on it and things can be calculated on the fly. So strip it.

Signed-off-by: Christian Hesse <mail@eworm.de>
6 years agosnapshot: support special value 'all' to enable all formats
Christian Hesse [Thu, 7 Jun 2018 20:01:50 +0000 (22:01 +0200)]
snapshot: support special value 'all' to enable all formats

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
6 years agosnapshot: support archive signatures
John Keeping [Sat, 31 Mar 2018 15:15:48 +0000 (16:15 +0100)]
snapshot: support archive signatures

Read signatures from the notes refs refs/notes/signatures/$FORMAT where
FORMAT is one of our archive formats ("tar", "tar.gz", ...).  The note
is expected to simply contain the signature content to be returned when
the snapshot "${filename}.asc" is requested, so the signature for
cgit-1.1.tar.xz can be stored against the v1.1 tag with:

git notes --ref=refs/notes/signatures/tar.xz add -C "$(
gpg --output - --armor --detach-sign cgit-1.1.tar.xz |
git hash-object -w --stdin
)" v1.1

and then downloaded by simply appending ".asc" to the archive URL.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoui-refs: use shared function to print tag downloads
John Keeping [Sat, 31 Mar 2018 14:11:05 +0000 (15:11 +0100)]
ui-refs: use shared function to print tag downloads

cgit_compose_snapshot_prefix() is identical to print_tag_downloads(), so
remove the latter and use the function from ui-shared.c instead.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoui-shared: pass separator in to cgit_print_snapshot_links()
John Keeping [Sat, 31 Mar 2018 14:08:59 +0000 (15:08 +0100)]
ui-shared: pass separator in to cgit_print_snapshot_links()

cgit_print_snapshot_links() is almost identical to
print_tag_downloads(), so let's extract the difference to a parameter in
preparation for removing print_tag_downloads() in the next commit.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoui-shared: use the same snapshot logic as ui-refs
John Keeping [Sat, 31 Mar 2018 14:06:01 +0000 (15:06 +0100)]
ui-shared: use the same snapshot logic as ui-refs

Make snapshot links in the commit UI use the same prefix algorithm as
those in the summary UI, so that refs starting with the snapshot prefix
are used as-is rather than composed with the prefix repeated.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoui-shared: rename parameter to cgit_print_snapshot_links()
John Keeping [Sat, 31 Mar 2018 14:03:21 +0000 (15:03 +0100)]
ui-shared: rename parameter to cgit_print_snapshot_links()

This is expected to be a ref not a hex object ID, so name it more
appropriately.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoui-shared: remove unused parameter
John Keeping [Sat, 31 Mar 2018 14:02:21 +0000 (15:02 +0100)]
ui-shared: remove unused parameter

The "head" parameter to cgit_print_snapshot_links() is never used, so
remove it.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoui-refs: remove unnecessary sanity check
John Keeping [Sat, 31 Mar 2018 13:57:22 +0000 (14:57 +0100)]
ui-refs: remove unnecessary sanity check

There is no way for refinfo::refname to be null, and Git will prevent
zero-length refs so this check is unnecessary.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoui-snapshot: filter permitted snapshot requests
John Keeping [Sat, 31 Mar 2018 14:19:52 +0000 (15:19 +0100)]
ui-snapshot: filter permitted snapshot requests

Currently the snapshots configuration option only filters which links
are displayed, not which snapshots may be generated and downloaded.
Apply the filter also to requests to ensure that the system policy is
enforced.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoAdd "snapshot-prefix" repo configuration
John Keeping [Sat, 31 Mar 2018 13:20:01 +0000 (14:20 +0100)]
Add "snapshot-prefix" repo configuration

Allow using a user-specified value for the prefix in snapshot files
instead of the repository basename.  For example, files downloaded from
the linux-stable.git repository should be named linux-$VERSION and not
linux-stable-$VERSION, which can be achieved by setting:

repo.snapshot-prefix=linux

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoui-snapshot: pass repo into get_ref_from_filename()
John Keeping [Sat, 31 Mar 2018 14:18:57 +0000 (15:18 +0100)]
ui-snapshot: pass repo into get_ref_from_filename()

Prepare to allow a custom snapshot prefix.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoui-shared: pass repo object to print_snapshot_links()
John Keeping [Sat, 31 Mar 2018 13:05:02 +0000 (14:05 +0100)]
ui-shared: pass repo object to print_snapshot_links()

Both call sites of cgit_print_snapshot_links() use the same values for
the snapshot mask and repository name, which are derived from the
cgit_repo structure so let's pass in the structure and access the fields
directly.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
6 years agoui-log: highlight annotated tags in different color
Christian Hesse [Tue, 5 Jun 2018 10:46:13 +0000 (12:46 +0200)]
ui-log: highlight annotated tags in different color

Annotated tags have some extra information... Descriptive text or signature.
Highlighting annotated tags in a different color show what tag may be worth
clicking for extra information.

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
6 years agoprint git version string in footer
Christian Hesse [Mon, 4 Jun 2018 20:27:46 +0000 (22:27 +0200)]
print git version string in footer

This helps tracking what git version cgit uses. The security implications are
low as anybody can look up the version of our submodule anyway. The paranoid
can use a custom footer. :-p

On the other hand this brings potential security issues to the
administrators eyes...

Signed-off-by: Christian Hesse <mail@eworm.de>
6 years agogit: update to v2.17.1
Christian Hesse [Wed, 30 May 2018 08:28:12 +0000 (10:28 +0200)]
git: update to v2.17.1

Update to git version v2.17.1. Required changes:

* The function 'typename' has been renamed to 'type_name'
  (upstream commit debca9d2fe784193dc2d9f98b5edac605ddfefbb)

Signed-off-by: Christian Hesse <mail@eworm.de>
6 years agoui-blame: free read_sha1_file() buffer after use
Andy Green [Tue, 19 Jun 2018 09:02:07 +0000 (17:02 +0800)]
ui-blame: free read_sha1_file() buffer after use

Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
6 years agoui-tag: Fix inconsistent capitalization
Jon DeVree [Sun, 10 Jun 2018 22:28:49 +0000 (18:28 -0400)]
ui-tag: Fix inconsistent capitalization

Way back in 2009 all of these were lower cased except this one
occurrence.

Signed-off-by: Jon DeVree <nuxi@vault24.org>
Signed-off-by: John Keeping <john@keeping.me.uk>
6 years agoui-tree: free read_sha1_file() buffer after use
Andy Green [Wed, 13 Jun 2018 02:02:00 +0000 (10:02 +0800)]
ui-tree: free read_sha1_file() buffer after use

Free up the buffer allocated in read_sha1_file()

Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
6 years agoMakefile: drive asciidoc directly for HTML output
John Keeping [Sat, 16 Jun 2018 12:11:09 +0000 (13:11 +0100)]
Makefile: drive asciidoc directly for HTML output

This is mostly taken from Git's doc/Makefile, although simplified for
our use.  The output now uses Asciidoc's default CSS which I think looks
a bit nicer than the Docbook formatting; as a result of this we no
longer need our custom .css file.

A side effect of this change is that temporary files generated from the
HTML output no longer conflict with the manpage output format (because
any temporary HTML output files use names derived from the output
filename which includes .html).

Signed-off-by: John Keeping <john@keeping.me.uk>
6 years agodoc: use consistent id's when generating html files
Todd Zullinger [Wed, 21 Feb 2018 01:36:03 +0000 (20:36 -0500)]
doc: use consistent id's when generating html files

The html documentation is generated using a2x which calls docbook tools
to do the work.  The generate.consistent.ids parameter ensures that when
the docbook stylesheet assigns an id value to an output element it is
consistent as long as the document structure has not changed.

Having consistent html files reduces frivolous changes between builds.
Distributions can more easily deploy multiple architecture builds and
compare changes between package versions.  End-users avoid needless
changes in files deployed or backed up.

The generate.consistent.ids parameter was added in docbook-xsl-1.77.0.
Older versions gracefully ignore the parameter, so we can pass the
parameter unconditionally.  Most distributions contain docbook-xsl newer
than 1.77.0.  This includes Fedora, Debian, Ubuntu, and RHEL/CentOS 7.
RHEL/CentOS 6 and Debian Wheezy (old stable) ship with an older version,
unsurprisingly.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
6 years agocgit: prepare repo before error pages
Jason A. Donenfeld [Mon, 12 Feb 2018 22:23:47 +0000 (23:23 +0100)]
cgit: prepare repo before error pages

This fixes a crash when showing a list of all heads in the <select> box
in the header.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoui-blame: Allow syntax highlighting
Jeff Smith [Sun, 29 Oct 2017 02:43:26 +0000 (21:43 -0500)]
ui-blame: Allow syntax highlighting

Place file contents into a single block so that syntax highlighting can
be applied in the usual fashion.  Place the alternating color bars
behind the file contents.  Force the default syntax highlighting
background to transparent.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
6 years agoui-blame: Make each column into a single table cell
Jeff Smith [Wed, 18 Oct 2017 04:17:34 +0000 (23:17 -0500)]
ui-blame: Make each column into a single table cell

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
6 years agoui-blame: Break out emit_blame_entry into component methods
Jeff Smith [Wed, 18 Oct 2017 04:17:33 +0000 (23:17 -0500)]
ui-blame: Break out emit_blame_entry into component methods

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
6 years agoui-blame: Distinguish hashes column from lines column
Jeff Smith [Wed, 18 Oct 2017 04:17:32 +0000 (23:17 -0500)]
ui-blame: Distinguish hashes column from lines column

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
6 years agogit: update to v2.16.0
Christian Hesse [Thu, 18 Jan 2018 08:19:31 +0000 (09:19 +0100)]
git: update to v2.16.0

Update to git version v2.16.0:

* refs: convert resolve_ref_unsafe to struct object_id
  (49e61479be913f67e66bb3fdf8de9475c41b58bd)
* diff: remove DIFF_OPT_SET macro
  (23dcf77f48feb49c54bad09210f093a799816334)
* log: add option to choose which refs to decorate
  (65516f586b69307f977cd67cc45513a296cabc25)
* diff: convert flags to be stored in bitfields
  (02f2f56bc377c287c411947d0e1482aac888f8db)

Signed-off-by: Christian Hesse <mail@eworm.de>
7 years agogit: update to v2.15.1
Christian Hesse [Wed, 29 Nov 2017 21:25:42 +0000 (22:25 +0100)]
git: update to v2.15.1

Update to git version v2.15.1: With commit 0abe14f6 prepare_packed_git()
moved to packfile.[ch].

Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
7 years agoglobal: spelling fixes
Ville Skyttä [Sat, 14 Oct 2017 19:05:51 +0000 (22:05 +0300)]
global: spelling fixes

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
7 years agoui-shared: use type='search' for the search box
Ville Skyttä [Sat, 14 Oct 2017 19:02:16 +0000 (22:02 +0300)]
ui-shared: use type='search' for the search box

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
7 years agofilter: pipe_fh should be local
Jason A. Donenfeld [Sat, 14 Oct 2017 14:13:07 +0000 (16:13 +0200)]
filter: pipe_fh should be local

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoparsing: don't clear existing state with empty input
John Keeping [Sat, 14 Oct 2017 12:02:53 +0000 (13:02 +0100)]
parsing: don't clear existing state with empty input

Since commit c699866 (parsing: clear query path before starting,
2017-02-19), we clear the "page" variable simply by calling
cgit_parse_url() even if the URL is empty.  This breaks a URL like:

.../cgit?p=about

which is generated when using the "root-readme" configuration option.

This happens because "page" is set to "about" when parsing the query
string before we handle the path (which is empty, but non-null).

It turns out that this is not the only case which is broken, but
specifying repository and page via query options has been broken since
before the commit mentioned above, for example:

.../cgit?r=git&p=log

Fix both of these by allowing the previous state to persist if PATH_INFO
is empty, falling back to the query parameters if no path has been
requested.

Reported-by: Tom Ryder <tom@sanctum.geek.nz>
Signed-off-by: John Keeping <john@keeping.me.uk>
7 years agoui-tree: link to blame UI if enabled
Jeff Smith [Mon, 2 Oct 2017 04:39:09 +0000 (23:39 -0500)]
ui-tree: link to blame UI if enabled

Create links to the blame page.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
7 years agoui-blame: add blame UI
Jeff Smith [Mon, 2 Oct 2017 04:39:08 +0000 (23:39 -0500)]
ui-blame: add blame UI

Implement a page which provides the blame view of a specified file.

This feature is controlled by a new config variable, "enable-blame",
which is disabled by default.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
7 years agoui-shared: make a char* parameter const
Jeff Smith [Mon, 2 Oct 2017 04:39:07 +0000 (23:39 -0500)]
ui-shared: make a char* parameter const

All cgit_xxx_link functions take const char* for the 'name' parameter,
except for cgit_commit_link, which takes a char* and subsequently
modifies the contents.  Avoiding the content changes, and making it
const char* will avoid the need to make copies of const char* strings
being passed to cgit_commit_link.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
7 years agoui-tree: move set_title_from_path to ui-shared
Jeff Smith [Mon, 2 Oct 2017 04:39:06 +0000 (23:39 -0500)]
ui-tree: move set_title_from_path to ui-shared

The ui-blame code will also need to call set_title_from_path, so go
ahead and move it to ui-shared.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
7 years agohtml: html_ntxt with no ellipsis
Jeff Smith [Mon, 2 Oct 2017 04:39:05 +0000 (23:39 -0500)]
html: html_ntxt with no ellipsis

For implementing a ui-blame page, there is need for a function that
outputs a selection from a block of text, transformed for HTML output,
but with no further modifications or additions.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
7 years agocache: flush stdio before restoring FDs
John Keeping [Mon, 24 Apr 2017 18:38:34 +0000 (19:38 +0100)]
cache: flush stdio before restoring FDs

As described in commit 2efb59e (ui-patch: Flush stdout after outputting
data, 2014-06-11), we need to ensure that stdout is flushed before
restoring the file descriptor when writing to the cache.  It turns out
that it's not just ui-patch that is affected by this but also raw diff
which writes to stdout internally.

Let's avoid risking more places doing this by ensuring that stdout is
flushed after writing in fill_slot().

Signed-off-by: John Keeping <john@keeping.me.uk>
7 years agoUse https for submodule
Daniel M. Weeks [Wed, 20 Sep 2017 15:17:29 +0000 (11:17 -0400)]
Use https for submodule

The git protocol provides no transport security. https does provide
transport security and should be preferred by default. https is also
more likely than git to be permitted by firewalls in restricted
environments.

Signed-off-by: Daniel M. Weeks <dan@danweeks.net>
7 years agoui-plain: print symlink content
John Keeping [Mon, 6 Mar 2017 23:27:23 +0000 (23:27 +0000)]
ui-plain: print symlink content

We currently ignore symlinks in ui-plain, leading to a 404.  In ui-tree
we print the content of the blob (that is, the path to the target of the
link), so it makes sense to do the same here.

Signed-off-by: John Keeping <john@keeping.me.uk>
7 years agocgit: don't set vpath unless repo is set
John Keeping [Sun, 19 Feb 2017 12:02:37 +0000 (12:02 +0000)]
cgit: don't set vpath unless repo is set

After the previous two patches, this can be classified as a tidy up
rather than a bug fix, but I think it makes sense to group all of the
tests together before setting up the environment for the command to
execute.

Signed-off-by: John Keeping <john@keeping.me.uk>
7 years agoparsing: clear query path before starting
John Keeping [Sun, 19 Feb 2017 12:17:05 +0000 (12:17 +0000)]
parsing: clear query path before starting

By specifying the "url" query parameter multiple times it is possible to
end up with ctx.qry.vpath set while ctx.repo is null, which triggers an
invalid code path from cgit_print_pageheader() while printing path
crumbs, resulting in a null dereference.

The previous patch fixed this segfault, but it makes no sense for us to
clear ctx.repo while leaving ctx.qry.path set to the previous value, so
let's just clear it here so that the last "url" parameter given takes
full effect rather than partially overriding the effect of the previous
value.

Signed-off-by: John Keeping <john@keeping.me.uk>
7 years agoui-shared: don't print path crumbs without a repo
John Keeping [Sun, 19 Feb 2017 12:27:48 +0000 (12:27 +0000)]
ui-shared: don't print path crumbs without a repo

cgit_print_path_crumbs() can call repolink() which assumes that ctx.repo
is non-null.  Currently we don't have any commands that set want_vpath
without also setting want_repo so it shouldn't be possible to fail this
test, but the check in cgit.c is in the wrong order so it is possible to
specify a query string like "?p=log&path=foo/bar" to end up here without
a valid repository.

This was found by American fuzzy lop [0].

[0] http://lcamtuf.coredump.cx/afl/

Signed-off-by: John Keeping <john@keeping.me.uk>
7 years agoui-atom: properly escape delimiter in page link
John Keeping [Sun, 15 Jan 2017 12:29:38 +0000 (12:29 +0000)]
ui-atom: properly escape delimiter in page link

If the delimiter here is '&' then it needs to be escaped for inclusion
in an attribute.  Use html_attrf() to ensure that this happens (we know
that hex won't need escaping, but this makes it clearer what's
happening.

Signed-off-by: John Keeping <john@keeping.me.uk>
7 years agogit: update to v2.14
Jeff Smith [Thu, 10 Aug 2017 00:02:56 +0000 (19:02 -0500)]
git: update to v2.14

Numerous changes were made to git functions to use an object_id
structure rather than sending sha1 hashes as raw unsigned character
arrays.  The functions that affect cgit are: parse_object,
lookup_commit_reference, lookup_tag, lookup_tree, parse_tree_indirect,
diff_root_tree_sha1, diff_tree_sha1, and format_display_notes.

Commit b2141fc (config: don't include config.h by default) made it
necessary to that config.h be explicitly included when needed.

Commit 07a3d41 (grep: remove regflags from the public grep_opt API)
removed one way of specifying the ignore-case grep option.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
7 years agogit: update to v2.13.4
Christian Hesse [Mon, 24 Jul 2017 15:22:52 +0000 (17:22 +0200)]
git: update to v2.13.4

Update to git version v2.13.4: With commit 8aee769f (pathspec: copy and free
owned memory) the definition of struct pathspec_item has changed with the
expectation that pathspecs will be managed dynamically. We work around this
a bit by setting up a static structure, but let's allocate the match string
to avoid needing to cast away const.

Updated a patch from John Keeping <john@keeping.me.uk> for git v2.12.1.

7 years agoUpdate .mailmap with my new email address
Lukas Fleischer [Thu, 27 Jul 2017 14:20:15 +0000 (16:20 +0200)]
Update .mailmap with my new email address

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
7 years agoRemove unused variable from sort_section()
Lukas Fleischer [Wed, 5 Apr 2017 04:38:27 +0000 (06:38 +0200)]
Remove unused variable from sort_section()

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
7 years agoui-repolist: properly sort by age
Jason A. Donenfeld [Thu, 30 Mar 2017 11:19:50 +0000 (13:19 +0200)]
ui-repolist: properly sort by age

When empty repos exist, comparing them against an existing repo with a
good mtime might, with particular qsort implementations, not sort
correctly, because of this brokenness:

   if (get_repo_modtime(r1, &t) && get_repo_modtime(r2, &t))

However, sorting by the age column works as expected, so anyway, to tidy
things up, we simply reuse that function.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoui-patch: fix crash when using path limit
Lukas Fleischer [Thu, 24 Nov 2016 19:14:54 +0000 (20:14 +0100)]
ui-patch: fix crash when using path limit

The array passed to setup_revisions() must be NULL-terminated. Fixes a
regression introduced in 455b598 (ui-patch.c: Use log_tree_commit() to
generate diffs, 2013-08-20).

Reported-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
7 years agosyntax-highlighting: replace invalid unicode with ?
Jason A. Donenfeld [Sun, 22 Jan 2017 11:44:44 +0000 (12:44 +0100)]
syntax-highlighting: replace invalid unicode with ?

8 years agogit: update to v2.11.0
Christian Hesse [Wed, 30 Nov 2016 09:43:08 +0000 (10:43 +0100)]
git: update to v2.11.0

Update to git version v2.11.0. Function write_archive()
dropped argument (int setup_prefix).

8 years agoLink with -ldl on GNU Hurd
Peter Colberg [Fri, 25 Nov 2016 20:57:11 +0000 (15:57 -0500)]
Link with -ldl on GNU Hurd

Debian GNU/Hurd uses the GNU C library.

Signed-off-by: Peter Colberg <peter@colberg.org>
8 years agogit: update to v2.10.2 again
John Keeping [Thu, 24 Nov 2016 18:59:42 +0000 (18:59 +0000)]
git: update to v2.10.2 again

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>
8 years agoBump version. v1.1
Jason A. Donenfeld [Wed, 23 Nov 2016 04:24:26 +0000 (05:24 +0100)]
Bump version.

8 years agocss: highlight even table rows and skip empty rows
Christian Hesse [Wed, 6 Jul 2016 20:42:36 +0000 (22:42 +0200)]
css: highlight even table rows and skip empty rows

This is stolen from kernel.org css [0].

[0] https://git.kernel.org/cgit-korg-0.10.1.css

8 years agogit: update to v2.10.2
Christian Hesse [Sun, 6 Nov 2016 20:47:04 +0000 (21:47 +0100)]
git: update to v2.10.2

Update to git version v2.10.2, no changes required.

8 years agoui-blog: fix oid handling
Christian Hesse [Tue, 11 Oct 2016 06:55:34 +0000 (08:55 +0200)]
ui-blog: fix oid handling

We have to use a pointer for walk_tree_ctx->matched_oid.

This fixes faulty commit 6e4b7b6776eb994e795fa38b2619db6c55e10ecc
(ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid').

8 years agoshared: remove unused function strlpart()
Christian Hesse [Mon, 10 Oct 2016 18:33:30 +0000 (20:33 +0200)]
shared: remove unused function strlpart()

8 years agoshared: remove unused function strrpart()
Christian Hesse [Mon, 10 Oct 2016 18:32:17 +0000 (20:32 +0200)]
shared: remove unused function strrpart()

8 years agoui-repolist: fix memory leak
Christian Hesse [Mon, 10 Oct 2016 18:17:51 +0000 (20:17 +0200)]
ui-repolist: fix memory leak

8 years agoUse skip_prefix() to get rid of magic constants
Lukas Fleischer [Sat, 8 Oct 2016 13:45:12 +0000 (15:45 +0200)]
Use skip_prefix() to get rid of magic constants

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
8 years agopatch: reapply path limit
John Keeping [Mon, 14 Mar 2016 22:41:14 +0000 (22:41 +0000)]
patch: reapply path limit

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>
8 years agoui-repolist: fix memory leak
Christian Hesse [Fri, 7 Oct 2016 13:08:53 +0000 (15:08 +0200)]
ui-repolist: fix memory leak

8 years agogit: update to v2.10.1
Christian Hesse [Tue, 4 Oct 2016 06:51:05 +0000 (08:51 +0200)]
git: update to v2.10.1

Update to git version v2.10.1, no changes required.

8 years agoui-tree: replace 'unsigned char sha1[20]' with 'struct object_id oid'
Christian Hesse [Thu, 29 Sep 2016 20:17:07 +0000 (22:17 +0200)]
ui-tree: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...

8 years agoui-tag: replace 'unsigned char sha1[20]' with 'struct object_id oid'
Christian Hesse [Thu, 29 Sep 2016 20:14:28 +0000 (22:14 +0200)]
ui-tag: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...

8 years agoui-snapshot: replace 'unsigned char sha1[20]' with 'struct object_id oid'
Christian Hesse [Thu, 29 Sep 2016 20:12:11 +0000 (22:12 +0200)]
ui-snapshot: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...

8 years agoui-shared: replace 'unsigned char sha1[20]' with 'struct object_id oid'
Christian Hesse [Thu, 29 Sep 2016 20:10:21 +0000 (22:10 +0200)]
ui-shared: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...

8 years agoui-plain: replace 'unsigned char sha1[20]' with 'struct object_id oid'
Christian Hesse [Thu, 29 Sep 2016 20:08:19 +0000 (22:08 +0200)]
ui-plain: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...

8 years agoui-patch: replace 'unsigned char sha1[20]' with 'struct object_id oid'
Christian Hesse [Thu, 29 Sep 2016 19:51:41 +0000 (21:51 +0200)]
ui-patch: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...

8 years agoui-log: replace get_sha1() with get_oid()
Christian Hesse [Thu, 29 Sep 2016 19:44:41 +0000 (21:44 +0200)]
ui-log: replace get_sha1() with get_oid()

Data structures have been replaced already, so use correct function calls.

8 years agoui-commit: replace 'unsigned char sha1[20]' with 'struct object_id oid'
Christian Hesse [Thu, 29 Sep 2016 19:41:09 +0000 (21:41 +0200)]
ui-commit: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...

8 years agoui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid'
Christian Hesse [Thu, 29 Sep 2016 19:38:49 +0000 (21:38 +0200)]
ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...

In addition replace memmove() with hashcpy().

8 years agocgit: replace 'unsigned char sha1[20]' with 'struct object_id oid'
Christian Hesse [Thu, 29 Sep 2016 19:16:14 +0000 (21:16 +0200)]
cgit: replace 'unsigned char sha1[20]' with 'struct object_id oid'

Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id
oid'. We have some code that can be changed independent from upstream. So
here we go...

8 years agoMakefile: remove extra space
Jason A. Donenfeld [Sat, 1 Oct 2016 21:35:04 +0000 (23:35 +0200)]
Makefile: remove extra space

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoSimplify http_parse_querystring()
Lukas Fleischer [Thu, 29 Sep 2016 06:38:45 +0000 (08:38 +0200)]
Simplify http_parse_querystring()

Instead of reimplementing URL parameter parsing from scratch, use
url_decode_parameter_name() and url_decode_parameter_value() which are
already provided by Git.

Also, change the return type of http_parse_querystring() to void since
its only caller already ignores the return value.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
8 years agoui-tree: remove a fixed size buffer
John Keeping [Sat, 13 Aug 2016 10:54:46 +0000 (11:54 +0100)]
ui-tree: remove a fixed size buffer

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>
8 years agoui-tag: clean up taginfo
John Keeping [Sat, 13 Aug 2016 10:53:24 +0000 (11:53 +0100)]
ui-tag: clean up taginfo

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>
8 years agoshared: make cgit_free_taginfo() public
John Keeping [Sat, 13 Aug 2016 10:52:51 +0000 (11:52 +0100)]
shared: make cgit_free_taginfo() public

We will use this function from ui-tag.c in the next patch.

Signed-off-by: John Keeping <john@keeping.me.uk>
8 years agoshared: remove return value from cgit_free_commitinfo()
John Keeping [Sat, 13 Aug 2016 10:51:58 +0000 (11:51 +0100)]
shared: remove return value from cgit_free_commitinfo()

This return value is never used and the function always returns NULL.

Signed-off-by: John Keeping <john@keeping.me.uk>
8 years agotree: allow skipping through single-child trees
John Keeping [Wed, 13 Jul 2016 19:19:42 +0000 (20:19 +0100)]
tree: allow skipping through single-child trees

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>
8 years agoui-ssdiff: fix decl-after-statement warnings
John Keeping [Sun, 7 Aug 2016 15:14:49 +0000 (16:14 +0100)]
ui-ssdiff: fix decl-after-statement warnings

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>
8 years agoui-shared: fix decl-after-statement warnings
John Keeping [Sun, 7 Aug 2016 15:13:30 +0000 (16:13 +0100)]
ui-shared: fix decl-after-statement warnings

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>