4 static git page generator.
6 It generates static HTML pages for a git repository.
12 Make files per repository:
14 $ mkdir -p htmldir && cd htmldir
17 Make index file for repositories:
19 $ stagit-index repodir1 repodir2 repodir3 > index.html
33 - libc (tested with OpenBSD, FreeBSD, NetBSD, Linux: glibc and musl).
35 - POSIX make (optional).
41 See man pages: stagit(1) and stagit-index(1).
44 Building a static binary
45 ------------------------
47 It may be useful to build static binaries, for example to run in a chroot.
49 It can be done like this at the time of writing (v0.24):
53 # change the options in the CMake file: CMakeLists.txt
54 BUILD_SHARED_LIBS to OFF (static)
55 CURL to OFF (not needed)
56 USE_SSH OFF (not needed)
57 THREADSAFE OFF (not needed)
58 USE_OPENSSL OFF (not needed, use builtin)
60 mkdir -p build && cd build
66 Extract owner field from git config
67 -----------------------------------
69 A way to extract the gitweb owner for example in the format:
77 awk '/^[ ]*owner[ ]=/ {
78 sub(/^[^=]*=[ ]*/, "");
83 Set clone url for a directory of repos
84 --------------------------------------
88 test -d "$i" && echo "git://git.codemadness.org/$i" > "$i/url"
92 Update files on git push
93 ------------------------
95 Using a post-receive hook the static files can be automatically updated.
96 Keep in mind git push -f can change the history and the commits may need
97 to be recreated. This is because stagit checks if a commit file already
98 exists. It also has a cache (-c) option which can conflict with the new
99 history. See stagit(1).
101 git post-receive hook (repo/.git/hooks/post-receive):
106 while read -r old new ref; do
107 hasrevs=$(git rev-list "$old" "^$new" | sed 1q)
108 if test -n "$hasrevs"; then
114 # remove commits and .cache on git push -f
115 #if test "$force" = "1"; then
119 # see example_create.sh for normal creation of the files.
122 Create .tar.gz archives by tag
123 ------------------------------
127 git tag -l | while read -r t; do
128 f="archives/${name}-$(echo "${t}" | tr '/' '_').tar.gz"
129 test -f "${f}" && continue
142 - Log of all commits from HEAD.
143 - Log and diffstat per commit.
144 - Show file tree with linkable line numbers.
145 - Show references: local branches and tags.
146 - Detect README and LICENSE file from HEAD and link it as a webpage.
147 - Detect submodules (.gitmodules file) from HEAD and link it as a webpage.
148 - Atom feed log (atom.xml).
149 - Make index page for multiple repositories with stagit-index.
150 - After generating the pages (relatively slow) serving the files is very fast,
151 simple and requires little resources (because the content is static), only
152 a HTTP file server is required.
153 - Usable with text-browsers such as dillo, links, lynx and w3m.
159 - Not suitable for large repositories (2000+ commits), because diffstats are
160 an expensive operation, the cache (-c flag) is a workaround for this in
162 - Not suitable for large repositories with many files, because all files are
163 written for each execution of stagit. This is because stagit shows the lines
164 of textfiles and there is no "cache" for file metadata (this would add more
165 complexity to the code).
166 - Not suitable for repositories with many branches, a quite linear history is
169 In these cases it is better to just use cgit or possibly change stagit to
170 run as a CGI program.
172 - Relatively slow to run the first time (about 3 seconds for sbase,
173 1500+ commits), incremental updates are faster.
174 - Does not support some of the dynamic features cgit has, like:
175 - Snapshot tarballs per commit.
176 - File tree per commit.
177 - History log of branches diverged from HEAD.
178 - Stats (git shortlog -s).
180 This is by design, just use git locally.