2022-12-02 16:41:55 -05:00
|
|
|
# repo2html
|
|
|
|
|
2022-12-20 01:05:34 -05:00
|
|
|
A command-line tool that generates a static HTML representation of a Git
|
|
|
|
repository.
|
2022-12-09 02:15:03 -05:00
|
|
|
|
2022-12-20 00:42:35 -05:00
|
|
|
## Page contents
|
2022-12-09 02:15:03 -05:00
|
|
|
|
2022-12-20 00:42:35 -05:00
|
|
|
<!-- vim-markdown-toc GFM -->
|
2022-12-09 02:15:03 -05:00
|
|
|
|
2022-12-20 00:42:35 -05:00
|
|
|
- [Features](#features)
|
|
|
|
- [Requirements](#requirements)
|
|
|
|
- [Usage](#usage)
|
|
|
|
- [Installation](#installation)
|
|
|
|
- [Configuration](#configuration)
|
|
|
|
- [Templates](#templates)
|
|
|
|
- [Environment variables](#environment-variables)
|
2022-12-20 01:22:38 -05:00
|
|
|
- [Creating a Git forge on your web server](#creating-a-git-forge-on-your-web-server)
|
2022-12-20 00:42:35 -05:00
|
|
|
- [Alternative Git-to-HTML tools](#alternative-git-to-html-tools)
|
|
|
|
- [Existing Git forges](#existing-git-forges)
|
|
|
|
- [Existing Git forge software](#existing-git-forge-software)
|
|
|
|
- [Todos](#todos)
|
2022-12-09 02:15:03 -05:00
|
|
|
|
2022-12-20 00:42:35 -05:00
|
|
|
<!-- vim-markdown-toc -->
|
2022-12-09 11:00:07 -05:00
|
|
|
|
2022-12-20 00:42:35 -05:00
|
|
|
## Features
|
2022-12-02 16:41:55 -05:00
|
|
|
|
2022-12-20 00:42:35 -05:00
|
|
|
- Static html files
|
|
|
|
- Customizable templates
|
|
|
|
- Can be used as a standalone command-line tool, or in a Git hook
|
|
|
|
- Built-in, plaintext issue support
|
|
|
|
- Image support
|
|
|
|
- Markdown files are rendered as HTML
|
|
|
|
- No resident background process
|
2022-12-02 16:41:55 -05:00
|
|
|
|
2022-12-20 00:42:35 -05:00
|
|
|
## Requirements
|
2022-12-02 16:41:55 -05:00
|
|
|
|
2022-12-20 01:11:36 -05:00
|
|
|
- [Chicken Scheme](https://call-cc.org/)
|
|
|
|
- The following Chicken Scheme eggs:
|
2022-12-09 11:00:08 -05:00
|
|
|
- [clojurian](https://wiki.call-cc.org/eggref/5/clojurian)
|
2022-12-16 12:28:55 -05:00
|
|
|
- [ersatz](https://wiki.call-cc.org/eggref/5/ersatz)
|
|
|
|
- [lowdown](https://wiki.call-cc.org/eggref/5/lowdown)
|
2022-12-13 17:02:01 -05:00
|
|
|
- [scss](https://wiki.call-cc.org/eggref/5/scss)
|
|
|
|
- [srfi-1](https://wiki.call-cc.org/eggref/5/srfi-1)
|
|
|
|
- [srfi-13](https://wiki.call-cc.org/eggref/5/srfi-13)
|
|
|
|
- [srfi-14](https://wiki.call-cc.org/eggref/5/srfi-14)
|
2022-12-16 12:28:55 -05:00
|
|
|
- [sxml-transforms](https://wiki.call-cc.org/eggref/5/sxml-transforms)
|
|
|
|
- [symbol-utils](https://wiki.call-cc.org/eggref/5/symbol-utils)
|
|
|
|
- [utf8](https://wiki.call-cc.org/eggref/5/utf8)
|
2022-12-20 00:42:35 -05:00
|
|
|
- Git
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
repo2html <destination> <template-directory>
|
|
|
|
|
2022-12-20 01:05:34 -05:00
|
|
|
Run `repo2html` inside the root directory of a Git repository or a bare Git
|
|
|
|
repository.
|
2022-12-20 00:42:35 -05:00
|
|
|
|
2022-12-20 01:05:34 -05:00
|
|
|
- `<destination>` is the path to the directory that you want the HTML files to
|
|
|
|
be generated in.
|
2022-12-20 00:42:35 -05:00
|
|
|
- `<template-directory>` is the path to the directory that contains a
|
|
|
|
`default.html` file. Refer to `assets/templates/default.html` for an example
|
|
|
|
`default.html` file.
|
|
|
|
|
|
|
|
The HTML that's generated represents the state of the `HEAD` commit, not the
|
|
|
|
current state of the work tree.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
This section guides you through installing the required dependencies, compiling
|
|
|
|
a binary, and then installing the binary. By default, `repo2html` installs
|
|
|
|
into the `/usr/local/bin` directory.
|
|
|
|
|
|
|
|
1. Ensure you're in the `repo2html` git repository.
|
|
|
|
2. As root, run `make dependencies` to install the required Chicken Scheme eggs.
|
|
|
|
3. Run `make` to compile a static `repo2html` binary in the current directory.
|
2022-12-20 01:05:34 -05:00
|
|
|
4. As root, run `make install` to copy the `repo2html` binary into the
|
|
|
|
`/usr/local/bin` directory.
|
2022-12-20 00:42:35 -05:00
|
|
|
|
|
|
|
**Note**: If you want to use `main.scm` as the `repo2html` executable, instead
|
|
|
|
of compiling a static binary file, then run
|
|
|
|
`cp main.scm /usr/local/bin/repo2html` as root.
|
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
## Templates
|
|
|
|
|
|
|
|
You can customize `repo2html` by modifying the template file
|
|
|
|
`assets/templates/default.html`, and then specifying the directory containing
|
|
|
|
your modified `default.html` as the second command-line argument when running
|
|
|
|
`repo2html`.
|
|
|
|
|
|
|
|
For example, if you placed a `default.html` template file in
|
|
|
|
`~/var/templates`, and you serve HTML files from `/var/www/git`, then you run
|
|
|
|
`repo2html /var/www/git ~/var/templates`.
|
|
|
|
|
|
|
|
Templates are rendered using [ersatz](https://wiki.call-cc.org/eggref/5/ersatz),
|
|
|
|
whose syntax is similar to the [Jinja2](https://palletsprojects.com/p/jinja/)
|
|
|
|
templating system.
|
|
|
|
|
|
|
|
If you use the `include` directive in your modified `default.html` template
|
|
|
|
file, `repo2html` will look for the templates to be included in that same
|
|
|
|
specified directory, where your `default.html` template lives.
|
|
|
|
|
2022-12-20 00:42:35 -05:00
|
|
|
## Configuration
|
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
`repo2html` understands the following configuration settings.
|
|
|
|
|
|
|
|
These settings are typically set using `git config` like
|
|
|
|
|
|
|
|
```git config repo2html.<setting> value```
|
|
|
|
|
|
|
|
Environment variables may also be used for configuration, and take precedence over settings in `git config`:
|
|
|
|
|
|
|
|
```export REPO2HTML_<SETTING>=value```
|
|
|
|
|
|
|
|
### Name
|
2022-12-20 00:42:35 -05:00
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
- `$REPO2HTML_NAME` or
|
|
|
|
- `git config repo2html.name`
|
|
|
|
- default: the repo's directory name
|
2022-12-02 16:54:38 -05:00
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
Your repository "name" is, by default, the name of the directory as specified in the first argument provided to `repo2html`.
|
2022-12-08 21:20:04 -05:00
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
This affects the template variables:
|
|
|
|
This does not affect the template variables:
|
2022-12-08 21:20:04 -05:00
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
### Description
|
2022-12-08 21:20:04 -05:00
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
- `$REPO2HTML_DESCRIPTION` or
|
|
|
|
- `git config repo2html.description` or
|
|
|
|
- edit the `.git/description` file
|
|
|
|
- default: ""
|
2022-12-07 15:18:27 -05:00
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
A short description for the repo.
|
|
|
|
This may also be set by adding a description in a `description` file in the root directory of your Git repository.
|
|
|
|
(This is the same mechanism that `cgit` uses.)
|
|
|
|
|
|
|
|
### ForgeRoot
|
|
|
|
|
|
|
|
- `$REPO2HTML_FORGEROOT` or
|
|
|
|
- `git config repo2html.forgeroot`
|
|
|
|
|
|
|
|
This is a helper intended for use when [building a git forge](#creating-a-git-forge-on-your-web-server).
|
|
|
|
|
|
|
|
It specifies the filesystem path to the directory containing (possibly a hierarchy of) html output directories.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
With forgeroot unset, the command
|
|
|
|
`repo2html /var/www/repos/mike/projecta/repo1 /path/to/templates`
|
|
|
|
will set the variable repo_path to `repo1`
|
|
|
|
|
|
|
|
With forgeroot set to `/var/www/repos`, the command
|
|
|
|
`repo2html /var/www/repos/mike/projecta/repo1 /path/to/templates`
|
|
|
|
will set the variable repo_path to `mike/projecta/repo1`
|
|
|
|
|
|
|
|
When your forge is built with a shared git user, it's convenient to use --global to specify this just once, like:
|
|
|
|
|
|
|
|
`sudo -u git git config --global repo2html.forgeroot /var/git-repos/`
|
2022-12-02 16:41:55 -05:00
|
|
|
|
2022-12-20 01:22:38 -05:00
|
|
|
## Creating a Git forge on your web server
|
2022-12-06 00:07:43 -05:00
|
|
|
|
2022-12-20 01:05:34 -05:00
|
|
|
Refer to
|
2023-01-07 14:13:34 -05:00
|
|
|
[Create a Git forge with repo2html](documentation/create-a-git-forge-with-repo2html.md)
|
2022-12-20 01:22:38 -05:00
|
|
|
to learn how use `repo2html` in a `post-receive` hook to auto-generate HTML
|
|
|
|
representations of bare Git repositories on a remote web server after you `git
|
|
|
|
push` to them.
|
2022-12-06 00:07:43 -05:00
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
## Alternatives
|
|
|
|
|
|
|
|
### Git Repo Static Page Generators
|
|
|
|
|
|
|
|
Other tools like `repo2html`, that generate a set of HTML files representing the contents of a git repository.
|
2022-12-20 00:42:35 -05:00
|
|
|
|
|
|
|
- [stagit](https://codemadness.org/git/stagit/file/README.html)
|
|
|
|
- [depp](https://git.8pit.net/depp.git/)
|
|
|
|
- [git-arr](https://blitiri.com.ar/p/git-arr/)
|
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
### Git Forge Software
|
2022-12-20 00:42:35 -05:00
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
Software for self-hosting or building your own collection of many git repos for potentially multiple users.
|
2022-12-20 00:42:35 -05:00
|
|
|
|
2022-12-20 01:01:32 -05:00
|
|
|
- [GitLab](https://about.gitlab.com/install/)
|
|
|
|
- [Gogs](https://gogs.io/)
|
|
|
|
- [Gitea](https://gitea.io/)
|
|
|
|
- [cgit](https://git.zx2c4.com/cgit/)
|
|
|
|
- [GitWeb](https://git-scm.com/book/en/v2/Git-on-the-Server-GitWeb)
|
|
|
|
- [legit](https://git.icyphox.sh/legit)
|
2022-12-26 12:10:45 -05:00
|
|
|
- [gitile](https://git.lepiller.eu/gitile)
|
|
|
|
- [pagure](https://pagure.io/pagure)
|
2022-12-20 00:42:35 -05:00
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
### Git Forge Services
|
|
|
|
|
|
|
|
Third-party-hosted services that will host browsable code repositories.
|
|
|
|
|
|
|
|
- [NotABug](https://notabug.org/)
|
|
|
|
- [Codeberg](https://codeberg.org/)
|
|
|
|
- [sourcehut](https://sourcehut.org/)
|
|
|
|
- [GitLab](https://gitlab.com/)
|
|
|
|
- [Bitbucket](https://bitbucket.org/product/)
|
|
|
|
- [SourceForge](https://sourceforge.net/)
|
|
|
|
- GitHub
|
|
|
|
- [pagure](https://pagure.io/pagure)
|
|
|
|
|
2022-12-20 00:42:35 -05:00
|
|
|
## Todos
|
2022-12-02 16:41:55 -05:00
|
|
|
|
2023-01-08 03:53:04 -05:00
|
|
|
- **documentation**: provide a precompiled binary download
|
2022-12-20 01:05:34 -05:00
|
|
|
- **documentation/feature**: use post-update rather than post-receive hook for
|
|
|
|
simplicity
|
2022-12-09 11:52:38 -05:00
|
|
|
- **documentation**: also describe use with post-commit hook
|
2022-12-20 00:42:35 -05:00
|
|
|
- **documentation**: describe readme, license, and issues behaviours
|
2022-12-09 11:52:38 -05:00
|
|
|
- **feature**: multi-page or collapse-able files list
|
|
|
|
- **feature**: branches and releases (tags)
|
2022-12-26 12:10:45 -05:00
|
|
|
- **feature**: diffs for each commit
|
2022-12-08 21:01:31 -05:00
|
|
|
- **feature**: clickable line numbers in source files
|
2022-12-20 01:05:34 -05:00
|
|
|
- **feature**: display binary files as output from binary-file analysis tools
|
|
|
|
like `hexdump`, `xxd`, `dumpelf`, `elfls`, `readelf`, etc.?
|
2022-12-09 11:52:38 -05:00
|
|
|
- **feature**: syntax highlighting?
|
2022-12-12 00:31:32 -05:00
|
|
|
- **feature**: markdown-render git log text
|
2022-12-20 01:05:34 -05:00
|
|
|
- **feature**: other mechanisms for header id application like uniqueness
|
|
|
|
checking, sequential numbering
|
2022-12-26 12:10:45 -05:00
|
|
|
- **feature**: remotes, upstream identification, and tracking branch status
|
2022-12-09 02:15:03 -05:00
|
|
|
|