4 static git page generator
10 Make files per repository:
12 $ mkdir -p htmldir && cd htmldir
15 Make index file for repositories:
17 $ stagit-index repodir1 repodir2 repodir3 > index.html
31 - libc (tested with OpenBSD, FreeBSD, Linux: glibc and musl).
39 See man pages: stagit(1) and stagit-index(1).
42 Building a static binary
43 ------------------------
45 It may be useful to build static binaries, for example to run in a chroot.
47 It can be done like this at the time of writing (v0.24):
51 # change the options in the CMake file: CMakeLists.txt
52 BUILD_SHARED_LIBS to OFF (static)
53 CURL to OFF (not needed)
54 USE_SSH OFF (not needed)
55 THREADSAFE OFF (not needed)
56 USE_OPENSSL OFF (not needed, use builtin)
58 mkdir -p build && cd build
64 Extract owner field from git config
65 -----------------------------------
67 A way to extract the gitweb owner for example in the format:
75 awk '/^[ ]*owner[ ]=/ {
76 sub(/^[^=]*=[ ]*/, "");
81 Set clone url for a directory of repos
82 --------------------------------------
86 test -d "$i" && echo "git://git.codemadness.org/$i" > "$i/url"
90 Update files on git push
91 ------------------------
93 Using a post-receive hook the static files can be automatically updated.
94 Keep in mind git push -f can change the history and the commits may need
95 to be recreated. This is because stagit checks if a commit file already
96 exists. It also has a cache (-c) option which can conflict with the new
97 history. See stagit(1).
99 git post-receive hook (repo/.git/hooks/post-receive):
104 while read -r old new ref; do
105 hasrevs=$(git rev-list "$old" "^$new" | sed 1q)
106 if test -n "$hasrevs"; then
112 # remove commits and .cache on git push -f
113 #if test "$force" = "1"; then
117 # see example_create.sh for normal creation of the files.
120 Create .tar.gz archives by tag
121 ------------------------------
125 git tag -l | while read -r t; do
126 f="archives/$name-$t.tar.gz"
127 test -f "$f" || git archive --format tar.gz "$t" -o "$f"
134 - Log of all commits from HEAD.
135 - Log and diffstat per commit.
136 - Show file tree with linkable line numbers.
137 - Show references: local branches and tags.
138 - Detect README and LICENSE file from HEAD and link it as a webpage.
139 - Detect submodules (.gitmodules file) from HEAD and link it as a webpage.
140 - Atom feed log (atom.xml).
141 - Make index page for multiple repositories with stagit-index.
142 - After generating the pages (relatively slow) serving the files is very fast,
143 simple and requires little resources (because the content is static), only
144 a HTTP file server is required.
145 - Usable with text-browsers such as dillo, links, lynx and w3m.
151 - Not suitable for large repositories (2000+ commits), because diffstats are
152 an expensive operation.
153 - Not suitable for repositories with many branches, a quite linear history is
155 - Relatively slow to run the first time (about 3 seconds for sbase,
156 1500+ commits), incremental updates are faster.
157 - Does not support some of the dynamic features cgit has, like:
159 - file tree per commit.
160 - history log of branches diverged from HEAD.
161 - stats (git shortlog -s).
163 this is by design, just use git locally.