README: add example for a git hook and to set the url file
1 files changed, 41 insertions(+), 2 deletions(-) | |||
---|---|---|---|
M | README | +41 | -2 |
1@@ -28,7 +28,7 @@ Dependencies
2 ------------
3
4 - libgit2 (v0.22+).
5-- libc (tested with OpenBSD, FreeBSD, glibc and musl).
6+- libc (tested with OpenBSD, FreeBSD, Linux: glibc and musl).
7 - C compiler (C99).
8 - make
9
10@@ -64,7 +64,7 @@ make install
11 Extract owner field from git config
12 -----------------------------------
13
14-A (hacky) way to extract the gitweb owner for example in the format:
15+A way to extract the gitweb owner for example in the format:
16
17 [gitweb]
18 owner = Name here
19@@ -78,6 +78,45 @@ Script:
20 }'
21
22
23+Set clone url for a directory of repos
24+--------------------------------------
25+ #!/bin/sh
26+ cd "$dir"
27+ for i in *; do
28+ test -d "$i" && echo "git://git.codemadness.org/$i" > "$i/url"
29+ done
30+
31+
32+Update files on git push
33+------------------------
34+
35+Using a post-receive hook the static files can be automatically updated.
36+Keep in mind git push -f can change the history and the commits may need
37+to be recreated. This is because stagit checks if a commit file already
38+exists. It also has a cache (-c) option which can conflict with the new
39+history. See stagit(1).
40+
41+git post-receive hook (repo/.git/hooks/post-receive):
42+
43+ #!/bin/sh
44+ # detect git push -f
45+ force=0
46+ while read -r old new ref; do
47+ hasrevs=$(git rev-list "$old" "^$new" | sed 1q)
48+ if test -n "$hasrevs"; then
49+ force=1
50+ break
51+ fi
52+ done
53+
54+ # remove commits and .cache on git push -f
55+ #if test "$force" = "1"; then
56+ # ...
57+ #fi
58+
59+ # see example.sh for normal creation of the files.
60+
61+
62 Create .tar.gz archives by tag
63 ------------------------------
64 #!/bin/sh