stagit

git site generator
Contents

change STAGIT_BASEURL to an -u option and also update the example script

Hiltjo Posthuma hiltjo@codemadness.org

commit: 661c378 parent: 2eea2be
4 files changed, 13 insertions(+), 13 deletions(-)
Mexample_create.sh+1-1
Mexample_post-receive.sh+1-1
Mstagit.1+5-7
Mstagit.c+6-4
M · example_create.sh +1, -1
1@@ -31,7 +31,7 @@ for dir in "${reposdir}/"*/; do
2
3 mkdir -p
"${curdir}/${d}"
4 cd
"${curdir}/${d}" || continue
5- stagit -c ".cache" "${reposdir}/${r}"
6+ stagit -c
".cache" -u "https://git.codemadness.nl/$d/" "${reposdir}/${r}"
7
8 # symlinks
9 ln -sf log.html
index.html
M · example_post-receive.sh +1, -1
1@@ -64,7 +64,7 @@ fi
2 stagit-index "${reposdir}/"*/
> "${destdir}/index.html"
3
4 # make pages.
5-stagit -c "${cachefile}" "${reposdir}/${r}"
6+stagit -c
"${cachefile}" -u "https://git.codemadness.nl/$d/" "${reposdir}/${r}"
7
8 ln -sf log.html
index.html
9 ln -sf ../style.css
style.css
M · stagit.1 +5, -7
 1@@ -1,4 +1,4 @@
 2-.Dd March 4, 2021
 3+.Dd March 5, 2021
 4 .Dt STAGIT 1
 5 .Os
 6 .Sh NAME
 7@@ -8,6 +8,7 @@
 8 .Nm
 9 .Op Fl c Ar
cachefile
10 .Op Fl l Ar
commits
11+.Op Fl u Ar baseurl
12 .Ar repodir
13 .Sh DESCRIPTION
14 .Nm
15@@ -31,6 +32,9 @@ Write a maximum number of
16 .Ar commits
17 to the log.html
file only.
18 However the
commit files are written as usual.
19+.It Fl u Ar baseurl
20+Base URL to make links
in the Atom feeds absolute.
21+For example:
"https://git.codemadness.org/stagit/".
22 .El
23 .Pp
24 The options
25@@ -103,12 +107,6 @@ favicon image.
26 .It style.css
27 CSS stylesheet.
28 .El
29-.Sh ENVIRONMENT
30-.Bl -tag -width Ds
31-.It Ev STAGIT_BASEURL
32-Base URL to make links
in atom.xml absolute.
33-For example:
STAGIT_BASE_URL="https://git.codemadness.org/stagit/".
34-.El
35 .Sh EXIT STATUS
36 .Ex -std
37 .Sh SEE ALSO
M · stagit.c +6, -4
 1@@ -1125,7 +1125,8 @@ writerefs(FILE *fp)
 2 void
 3 usage(char *argv0)
 4 {
 5- fprintf(stderr, "%s [-c cachefile | -l commits] repodir\n", argv0);
 6+ fprintf(stderr,
"%s [-c cachefile | -l commits] "
 7+ "[-u baseurl]
repodir\n", argv0);
 8 exit(1);
 9 }
10
11@@ -1158,6 +1159,10 @@ main(int argc, char *argv[])
12 if (argv[i][0] == '\0' || *p !=
'\0' ||
13 nlogcommits
<= 0 || errno)
14 usage(argv[0]);
15+ } else if (argv[i][1] == 'u') {
16+ if (i + 1 >=
argc)
17+ usage(argv[0]);
18+ baseurl = argv[++i];
19 }
20 }
21 if (!repodir)
22@@ -1185,9 +1190,6 @@ main(int argc, char *argv[])
23 }
24 #endif
25
26- if ((p = getenv("STAGIT_BASEURL")))
27- baseurl = p;
28-
29 if (git_repository_open_ext(&repo, repodir,
30
GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) < 0) {
31 fprintf(stderr,
"%s: cannot open repository\n", argv[0]);