stagit-gopher

[fork] gopher git frontend
git clone https://hhvn.uk/stagit-gopher
git clone git://hhvn.uk/stagit-gopher
Log | Files | Refs | README | LICENSE

README (3987B)


      1 stagit-gopher
      2 -------------
      3 
      4 static git page generator for gopher.
      5 
      6 This generates pages in the geomyidae .gph file format:
      7 
      8 	http://git.r-36.net/geomyidae
      9 
     10 
     11 Usage
     12 -----
     13 
     14 Make files per repository:
     15 
     16 	$ mkdir -p gphdir && cd gphdir
     17 	$ stagit-gopher path-to-repo
     18 
     19 Make index file for repositories:
     20 
     21 	$ stagit-gopher-index repodir1 repodir2 repodir3 > index.gph
     22 
     23 
     24 Build and install
     25 -----------------
     26 
     27 $ make
     28 # make install
     29 
     30 
     31 Dependencies
     32 ------------
     33 
     34 - C compiler (C99).
     35 - libc (tested with OpenBSD, FreeBSD, NetBSD, Linux: glibc and musl).
     36 - libgit2 (v0.22+).
     37 - geomyidae (for .gph file serving).
     38 - POSIX make (optional).
     39 
     40 
     41 Documentation
     42 -------------
     43 
     44 See man pages: stagit-gopher(1) and stagit-gopher-index(1).
     45 
     46 
     47 Building a static binary
     48 ------------------------
     49 
     50 It may be useful to build static binaries, for example to run in a chroot.
     51 
     52 It can be done like this at the time of writing (v0.24):
     53 
     54 cd libgit2-src
     55 
     56 # change the options in the CMake file: CMakeLists.txt
     57 BUILD_SHARED_LIBS to OFF (static)
     58 CURL to OFF              (not needed)
     59 USE_SSH OFF              (not needed)
     60 THREADSAFE OFF           (not needed)
     61 USE_OPENSSL OFF          (not needed, use builtin)
     62 
     63 mkdir -p build && cd build
     64 cmake ../
     65 make
     66 make install
     67 
     68 
     69 Set clone url for a directory of repos
     70 --------------------------------------
     71 	#!/bin/sh
     72 	cd "$dir"
     73 	for i in *; do
     74 		test -d "$i" && echo "git://git.codemadness.org/$i" > "$i/url"
     75 	done
     76 
     77 
     78 Update files on git push
     79 ------------------------
     80 
     81 Using a post-receive hook the static files can be automatically updated.
     82 Keep in mind git push -f can change the history and the commits may need
     83 to be recreated. This is because stagit checks if a commit file already
     84 exists. It also has a cache (-c) option which can conflict with the new
     85 history. See stagit(1).
     86 
     87 git post-receive hook (repo/.git/hooks/post-receive):
     88 
     89 	#!/bin/sh
     90 	# detect git push -f
     91 	force=0
     92 	while read -r old new ref; do
     93 		hasrevs=$(git rev-list "$old" "^$new" | sed 1q)
     94 		if test -n "$hasrevs"; then
     95 			force=1
     96 			break
     97 		fi
     98 	done
     99 
    100 	# remove commits and .cache on git push -f
    101 	#if test "$force" = "1"; then
    102 	# ...
    103 	#fi
    104 
    105 	# see example_create.sh for normal creation of the files.
    106 
    107 
    108 Create .tar.gz archives by tag
    109 ------------------------------
    110 	#!/bin/sh
    111 	name="stagit-gopher"
    112 	mkdir -p archives
    113 	git tag -l | while read -r t; do
    114 		f="archives/${name}-$(echo "${t}" | tr '/' '_').tar.gz"
    115 		test -f "${f}" && continue
    116 		git archive \
    117 			--format tar.gz \
    118 			--prefix "${t}/" \
    119 			-o "${f}" \
    120 			-- \
    121 			"${t}"
    122 	done
    123 
    124 
    125 Features
    126 --------
    127 
    128 - Log of all commits from HEAD.
    129 - Log and diffstat per commit.
    130 - Show file tree with line numbers.
    131 - Show references: local branches and tags.
    132 - Detect README and LICENSE file from HEAD and link it as a page.
    133 - Detect submodules (.gitmodules file) from HEAD and link it as a page.
    134 - Atom feed log (atom.xml).
    135 - Make index page for multiple repositories with stagit-gopher-index.
    136 - After generating the pages (relatively slow) serving the files is very fast,
    137   simple and requires little resources (because the content is static), only
    138   a geomyidae Gopher server is required.
    139 
    140 
    141 Cons
    142 ----
    143 
    144 - Not suitable for large repositories (2000+ commits), because diffstats are
    145   an expensive operation, the cache (-c flag) is a workaround for this in
    146   some cases.
    147 - Not suitable for large repositories with many files, because all files are
    148   written for each execution of stagit. This is because stagit shows the lines
    149   of textfiles and there is no "cache" for file metadata (this would add more
    150   complexity to the code).
    151 - Not suitable for repositories with many branches, a quite linear history is
    152   assumed (from HEAD).
    153 - Relatively slow to run the first time (about 3 seconds for sbase,
    154   1500+ commits), incremental updates are faster.
    155 - Does not support some dynamic features like:
    156   - Snapshot tarballs per commit.
    157   - File tree per commit.
    158   - History log of branches diverged from HEAD.
    159   - Stats (git shortlog -s).
    160 
    161   This is by design, just use git locally.