By default, git-arr limits the number of pages of commits to 5, however,
it is reasonable to expect that some projects will want all commits to
be shown. Rather than forcing such projects to choose an arbitrarily
large number as the value of 'max_pages', provide a formal mechanism to
specify unlimited commit pages.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
When emitting a blob in the root tree of a commit, write_tree() composes
the blob's HTML filename with an extra slash before the "f=", like this:
output/r/repo/b/master/t//f=README.txt.html
Although the double-slash is not harmful on Unix, it is unsightly, and
may be problematic for other platforms or filesystems which interpret
double-slash specially or disallow it. Therefore, suppress the extra
slash for blobs in the root tree.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
A human-readable representation of a Git SHA1 commit ID is composed
only of hexadecimal digits, thus there is no need to match against
the full alphabet.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
When a repository has a "master" branch, a short summary of its most
recent commits is shown, followed by a horizontal rule. If there is no
"master" branch, then the commit summary is suppressed, however, the
rule is shown unconditionally, which is ugly, particularly when there
is already a rule following the web_url/git_url block. Therefore,
suppress the "master" branch horizontal rule when not needed. (This is
analogous to how the rule following the web_url/git_url block is
suppressed when that information is not shown).
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
These repo-specific options were added in 54026b75 (Make embedding
markdown and images configurable per-repo, 2013-11-02) but not
documented.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
If there is a branch and a file with the same name, git-arr will fail to
generate, as git will complain when running git rev-list.
For example, if there is both a file and a branch called "hooks" in the
repository, git-arr would fail as follows:
=== git-arr running: ['git', '--git-dir=/some/repo', 'rev-list', '--max-count=1', '--header', u'hooks'])
fatal: ambiguous argument 'hooks': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Traceback (most recent call last):
File "./git-arr", line 457, in <module>
main()
File "./git-arr", line 452, in main
skip_index = len(opts.only) > 0)
File "./git-arr", line 388, in generate
branch_mtime = r.commit(bn).committer_date.epoch
AttributeError: 'NoneType' object has no attribute 'committer_date'
To fix that, this patch appends a "--" as the last argument to rev-list, which
indicates that it has completed the revision list, which disambiguates the
argument.
While at it, a minor typo in a comment is also fixed.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
The current parsing of dates from git incorrectly uses
datetime.fromtimestamp(), which returns the *local* date and time
corresponding to the given timestamp.
Instead, it should be using datetime.utcfromtimestamp() which returns the UTC
date and time, as the rest of the code expects.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
Some versions of bottle.py don't deal well with the "if" inside the lambda, so
work around it by just using comparison and simplifying the function.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
The missing '% end' template keyword to these one-line if statements was
causing bottle 0.12.7 to incorrectly indent the following line, leading to an
IndentationError at runtime when the blob and tree templates are compiled.
Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
The commit view shows the author information in the committer field; this
patch fixes it by showing the appropriate fields.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
It turned out that bottle.py is not backwards-compatible with the status code
change: older versions encode the status in e.status; newer ones use
e.status_code (and e.status became a string).
This patch works around that by trying to pick up which of the two variants we
have, and deciding accordingly.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This patch adds the age of the repository to the index view, using javascript
to give a nice human string for the age.
When javascript is not available, the element remains hidden.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
Newer versions of bottle have a string in the e.status attribute, and the
status code can be found in e.status_code, which should be backwards
compatible.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This patch introduces the embed_markdown and embed_images configuration
options, so users can enable and disable those features on a per-repository
basis.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This patch makes minor changes to the code that handles embedded images,
mostly to make it use mimetypes, and to remove SVG support (at least for now)
due to security concerns.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This patch adds a post-receive hook that can be used to trigger a git-arr
update when there is a push to a repository.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
When the tool is invoked like /path/to/git-arr, it currently fails because
both the serving of static files and bottle templates assume they're on the
current working directory.
This patch fixes that by computing the directories based on the executable
location.
Note this is assuming the static directory and the templates live next to the
executable, which will not always be the case, and eventually it should be
configurable; but it's ok for the time being.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This patch fixes the --only option, and makes it avoid generating the
top-level index so we don't get a broken one with only the specified
repositories.
The intention is that this option is used in hooks to update the views after a
commit or push.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
The lexer guesser based on content is often wrong; to minimize the chances of
that happening, we only use it on files that start with "#!", for which it
usually has smarter rules.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
If we can't guess the lexer by the file name, try to guess based on the
content.
This allows pygments to colorize extension-less files, usually scripts.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
In practise pygments seems to have a very hard time processing large files and
files with long lines, so try to avoid using it in those cases.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This patch improves the way we find the path to the repositories, both in the
recursive and in the non-recursive cases.
We now support specifying non-bare repositories directly, and also recursing
on them.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>