1## README23No frills static page generator for Git repositories.45### Motivation67Contrary to existing static [page][stagit website] [generator][depp website]8approaches, this software does not strive to be a fully featured git browser9for the web. Instead, the idea is to provide a quick overview for a given10repository, thereby allowing users to decide whether it is interesting enough11to be cloned. As such, this software does intentionally not provide a web12frontend for existing tools like `git-log(1)`, `git-blame(1)`, et cetera. If13more information is needed, the user should simply clone the repository and use14`git(1)` as usual.1516Further, this page generator is entirely written in Go using the pure Go Git17library [go-git][go-git github] instead of [libgit2][libgit2 website] to18interact with Git repositories. Thereby, allowing the implementation to be19compiled as a single statically linked binary while also embedding all HTML and20CSS files into the binary through Go's [embed][go embed] package.2122### Features2324* Easy to deploy, everything is backed into the binaries (no external dependencies).25* Blazingly fast as it only rebuilds files that changed since the last invocation.26* Simple and mobile-friendly web design which can be easily customized.2728### Status2930I use this for my own [Git server][8pit git]. I am presently not aware of any31bugs and consider it mostly finished software. As I use it myself, I am32committed to maintaining it for the foreseeable future.3334### Installation3536Installation requires a [Go toolchain][go website]. Assuming a supported Go is37available, the software can be installed either via `go install` or `make`.38Both methods will install two binaries: `depp` for generating HTML files on a39per-repository basis and `depp-index` which can optionally be used to generate40an HTML index page for listing all hosted git repositories. Both commands are41further described in the provided man page, a usage example is provided below.4243#### go install4445To install to the program using `go install` run the following command:4647 $ go install github.com/nmeum/depp/...@latest4849Note that this will not install additional documentation files, e.g. man pages.5051#### make5253Clone the repository manually and ran the following commands:5455 $ make56 $ sudo make install5758This is the preferred method when packaging this software for a distribution.5960### Usage6162Assuming you have a web server serving files located at63`/var/www/htdocs/git.example.org`, you want 10 commits on the index64page, and the repository can be cloned via `git://example.org/foo.git`:6566 $ depp -c 10 -u git://example.org/foo.git \67 -d /var/www/htdocs/git.example.org/foo \68 <path to git repository to generate pages for>6970To automate this process, create a `post-receive` hook for your71repository on your git server, see `githooks(5)` for more information.72Keep in mind that the repository page itself only needs to be regenerated73if the default branch is pushed, since only the default branch is74considered by `depp`. As such, an exemplary `post-receive` hook may look75as follows:7677 #!/bin/sh7879 repo=$(git rev-parse --absolute-git-dir)80 name=${repo##*/}8182 rebuild=083 defref=$(git symbolic-ref HEAD)84 while read local_ref local_sha remote_ref remote_sha; do85 if [ "${remote_ref}" = "${defref}" ]; then86 rebuild=187 break88 fi89 done9091 # Only rebuild the HTML if the default ref was pushed.92 [ ${rebuild} -eq 1 ] || exit 09394 depp -u "git://git.example.org/${name}" \95 -d "/var/www/htdocs/git.example.org/${name}" .9697If usage of `deep-index` is also desired, the index page can either be98rebuild as part of the `post-receive` hook or in a separate cronjob.99100### README Rendering101102Rendering README files written in a chosen markup language (e.g.103markdown) is supported. This is achieved by including an executable file104called `git-render-readme` in the bare Git repository. When executed,105this file receives the README content on standard input and must write106plain HTML to standard output.107108As an example, consider the following `git-render-readme` script which109uses the `markdown(1)` program provided by the [discount][discount website]110Markdown implementation:111112 #!/bin/sh113 exec markdown -f autolink114115### License116117This program is free software: you can redistribute it and/or modify it118under the terms of the GNU General Public License as published by the119Free Software Foundation, either version 3 of the License, or (at your120option) any later version.121122This program is distributed in the hope that it will be useful, but123WITHOUT ANY WARRANTY; without even the implied warranty of124MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General125Public License for more details.126127You should have received a copy of the GNU General Public License along128with this program. If not, see <https://www.gnu.org/licenses/>.129130[stagit website]: http://codemadness.nl/git/stagit/log.html131[depp website]: https://depp.brause.cc/depp/132[libgit2 website]: https://libgit2.org/133[8pit git]: https://git.8pit.net/134[go website]: https://golang.org/135[discount website]: http://www.pell.portland.or.us/~orc/Code/discount/136[go embed]: https://pkg.go.dev/embed137[go-git github]: https://github.com/go-git/go-git