stagit

static git page - forked from https://git.codemadness.org/stagit
git clone git://src.gearsix.net/stagitstagit.zip
Log | Files | Refs | Atom | README | LICENSE

commit 47cf1a2386e70a386e3fcf03cef6c0366f534358
parent daae11dff1d35068265627b6eb903bd44f3de355
Author: gearsix <gearsix@tuta.io>
Date:   Thu, 19 Aug 2021 13:58:00 +0100

Merged commits from 0.9.6; updated README with some changes

Squashed commit of the following:

commit 1b6a24c893866a604d9b7bc425f9b23706f39912
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue Aug 3 19:22:50 2021 +0200

    man pages: add EXAMPLES section

commit 61be8f532818ac1c8d16e418d6e3124d10f82bd6
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat Jul 31 01:09:45 2021 +0200

    small typo fixes and url -> URL

commit 57f84d0fd12d6466122dc8a2190e7e284f5668d7
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu May 27 12:41:43 2021 +0200

    bump version to 0.9.6

commit 45394004a3455f76a2eef42d6f36c250f5e9a9ac
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue May 18 11:42:41 2021 +0200

    man page: codemadness is the primary server. make logo brandless (not 2f30)

commit ddc581bd9088d0b3503606993eb8ed9dbeb44347
Author: Quentin Rameau <quinq@fifth.space>
Date:   Tue May 18 10:38:54 2021 +0200

    README: improve a bit the usage examples

commit c827ab1b1dee13e512f8ae24aa824879d547d0db
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed May 5 19:15:58 2021 +0200

    do not simplify the history by first-parent

    Reference:
    https://libgit2.org/libgit2/#HEAD/group/revwalk/git_revwalk_simplify_first_parent

    Noticed on merge commits on:
    https://git.simple-cc.org/scc/

    Reported by quinq, thanks!

commit 727e02be6c6aaafd929341963465bf6e1ff2947d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu Mar 25 18:17:34 2021 +0100

    tiny comment change

commit 295e4b8cb95114bb74b582c7332bc4c171f36dd3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu Mar 25 18:13:13 2021 +0100

    add function to print a single line, ignoring \r and \n

    This can happen when there is no newline at end of file in the diff which is
    served by libgit2 as:

    "\n\ No newline at end of file\n".

commit 995f7d5c5d8e396b06e70b1497ac96df63ffec36
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri Mar 19 11:29:53 2021 +0100

    add meta viewport on stagit-index too

    Patch by Oscar Benedito, thanks!

commit f46405850133e43dcae95e0a41b74bcca7b10027
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun Mar 14 16:23:58 2021 +0100

    bump version to 0.9.5

commit c4d5fecc40e51ab4667315bd11dabd2023e357f3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri Mar 5 12:47:08 2021 +0100

    LICENSE: update

commit 5ced189f1993fc17ae683f0a542218db7be7267b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri Mar 5 12:44:48 2021 +0100

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

commit 7968c0bc9c0172bd654e1f87d8194aef7fb69865
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri Mar 5 11:51:21 2021 +0100

    add $STAGIT_BASEURL environment variable to make Atom links absolute

    With feedback from adc, thanks!

commit d1c528fb5ad81c876f07a69e1b759764f69cb9de
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri Mar 5 11:50:16 2021 +0100

    README: mention tags.xml feature

commit 722f8364601d2b6ee2439b42cd75750f6aac90ed
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat Jan 9 14:59:53 2021 +0100

    micro-optimization: fputc (function) -> putc (macro/inline function)

commit 5044ddeea3c77fea97daa62d51593d73b0e08413
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri Jan 8 14:32:33 2021 +0100

    LICENSE: bump year

commit e1c0aebde443979a524a944027b81f84f4323ff3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat Nov 28 12:28:05 2020 +0100

    fix warning with libgit2 v0.99+, remain compatible with older versions

    git_blob_rawsize now returns with git_object_size_t (unsigned). This was
    git_off_t (signed).

    In my current version 1.1.0:
    	types.h:typedef uint64_t git_object_size_t;

    v0.28.5:
    https://libgit2.org/libgit2/#v0.28.5/group/blob/git_blob_rawsize

    changed from v0.99 onwards:
    https://libgit2.org/libgit2/#v0.99.0/group/blob/git_blob_rawsize

    Fix: use size_t to remain compatible (with a possible warning in older
    versions), since git_object_size_t is a new defined type.
    This assumes size_t is atleast uint32_t / uint64_t size.

    Adapted from a patch by Augustin Fabre <augustin@augfab.fr>, thanks!

commit 66df204c440de3b0cf3442d3a0c719016cdcf9c6
Author: Oscar Benedito <oscar@oscarbenedito.com>
Date:   Mon Nov 16 23:24:32 2020 +0100

    add abbreviated commit hash to submodule file

commit a63645a5ea4e60523c0024f69c627f586b601d82
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun Nov 15 21:11:46 2020 +0100

    add meta viewport for scaling on mobile

    Patch by Augustin Fabre <augustin@augfab.fr>

commit ae41add24a87027343e3a6f7eea19f3902af4a12
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun Nov 15 21:11:10 2020 +0100

    style.css: improve contrast

    https://webaim.org/resources/contrastchecker/?fcolor=555555&bcolor=FFFFFF

    Patch by Augustin Fabre <augustin@augfab.fr> and adapted.

commit fc5ef41165df39d6def252e5230a63cc6839bfc1
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun Nov 15 20:59:34 2020 +0100

    use size_t to count lines

commit 4f60446c011b45e862540c97b684c62fd8dc3c60
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun Nov 15 20:58:58 2020 +0100

    avoid shadowed `name' global variable

    by Augustin Fabre <augustin@augfab.fr>

commit 9467f347a2224ac95b96ef5c74d50a4e2aad5241
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun Nov 15 20:58:41 2020 +0100

    refs_cmp: remove unneeded cast

commit 3e7865f8f9ef87f622a7a94e7ae70355753ee66a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun Nov 15 20:58:02 2020 +0100

    use LEN() macros for arrays

    from Augustin Fabre <augustin@augfab.fr>

commit 75555cd99ee4d5df765f7dd6f0d09f2f925be725
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon Aug 17 16:09:33 2020 +0200

    bump version to 0.9.4

commit 5334f3e0009bb7d5835c3bad60db507bfd146930
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon Aug 10 16:09:46 2020 +0200

    fix a small memleak in writeatom()

    non-tag references were not freed.

commit dc0709f6f4f7e256e27272cb0b8611715caf1f3b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat Aug 8 20:01:05 2020 +0200

    stagit-index: remove unveil support for argv

    This can reach the unveil argument limits and it is not a good case for using
    unveil.

commit 174a763058f9a90831ab5a2aeb1c9bfbecdabf48
Author: kst <nil@krj.st>
Date:   Wed Aug 5 22:11:18 2020 +0000

    fix submodule lookup in bare repos

    git_submodule_lookup does not work without a working tree [1], so the
    current approach fails to recognize any submodules in bare repos.

    Instead, notice that

    	$ git ls-tree HEAD

    lists any submodules as commit objects regardless of a working tree.
    This is the only instance commit object is used in a tree, so we will
    use this to check for submodules.

    [1]: https://github.com/libgit2/libgit2/pull/4305/files

commit f05e6b0fcb3b874180970d06ebcde05fb5aea470
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon Jul 20 14:15:12 2020 +0200

    regression: do not show unset or empty tags

commit d80a163acd47df2bd9ab145be6b249814aa9eceb
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun Jul 19 16:41:10 2020 +0200

    refactor get reference, add another feed for tags/releases

    A separate Atom feed is helpful to ports maintainers to monitor new
    tags/releases.

commit 693c06448972f049d74addbd4942365cd37d92e4
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun Jul 19 14:07:54 2020 +0200

    sort branches and tags by time (descending)

    In general version tags are done in chronological order, so this will have a
    better sorting for tagged (versioned) releases.

    Request from Caltlgin Stsodaat and others, thanks!

Diffstat:
MMakefile | 2+-
MREADME | 19+++++++++++++++----
Mexample_create.sh | 2+-
Mfavicon.png | 0
Mlogo.png | 0
Mstagit-index.1 | 7++++++-
Mstagit-index.c | 1-
Mstagit.1 | 14++++++++++++--
Mstagit.c | 6+++---
9 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,7 +1,7 @@ .POSIX: NAME = stagit -VERSION = 0.9.5 +VERSION = 0.9.6 # paths PREFIX = /usr/local diff --git a/README b/README @@ -18,6 +18,9 @@ stagit-index.c - changed favicon.png -> /logo.png - changed style.css -> /style.css - added #logo id to td displaying logo + - added "binary" (argv[0]) for error messages "$binary: ..." + - added optional "contact" row below description in table header + - split repo list into "original" and "forks", see "writebody()" stagit.c @@ -27,9 +30,12 @@ stagit.c - added rootpath ("/") - logo.png & style.css paths are prepended with rootpath value - added #logo id to td displaying logo + - added "forked from ..." in description (if repo is fork) + - added index.html for repo pages that redirect to ./log.html misc + - changed logo size to 50x50 - moved style.css -> style-default.css - added style-gearsix.css @@ -39,12 +45,17 @@ Usage Make files per repository: - $ mkdir -p htmldir && cd htmldir - $ stagit path-to-repo + $ mkdir -p htmlroot/htmlrepo1 && cd htmlroot/htmlrepo1 + $ stagit path/to/gitrepo1 + repeat for other repositories + $ ... Make index file for repositories: - $ stagit-index repodir1 repodir2 repodir3 > index.html + $ cd htmlroot + $ stagit-index path/to/gitrepo1 \ + path/to/gitrepo2 \ + path/to/gitrepo3 > index.html Build and install @@ -108,7 +119,7 @@ Script: }' -Set clone url for a directory of repos +Set clone URL for a directory of repos -------------------------------------- #!/bin/sh cd "$dir" diff --git a/example_create.sh b/example_create.sh @@ -6,7 +6,7 @@ # - copy style.css, logo.png and favicon.png manually, a style.css example # is included. # -# - write clone url, for example "git://git.codemadness.org/dir" to the "url" +# - write clone URL, for example "git://git.codemadness.org/dir" to the "url" # file for each repo. # - write owner of repo to the "owner" file. # - write description in "description" file. diff --git a/favicon.png b/favicon.png Binary files differ. diff --git a/logo.png b/logo.png Binary files differ. diff --git a/stagit-index.1 b/stagit-index.1 @@ -1,4 +1,4 @@ -.Dd December 26, 2015 +.Dd August 2, 2021 .Dt STAGIT-INDEX 1 .Os .Sh NAME @@ -36,6 +36,11 @@ favicon image. .It style.css CSS stylesheet. .El +.Sh EXAMPLES +.Bd -literal +cd htmlroot +stagit-index path/to/gitrepo1 path/to/gitrepo2 > index.html +.Ed .Sh SEE ALSO .Xr stagit 1 .Sh AUTHORS diff --git a/stagit-index.c b/stagit-index.c @@ -104,7 +104,6 @@ writelog(FILE *fp) git_revwalk_new(&w, repo); git_revwalk_push_head(w); - git_revwalk_simplify_first_parent(w); if (git_revwalk_next(&id, w) || git_commit_lookup(&commit, repo, &id)) { diff --git a/stagit.1 b/stagit.1 @@ -1,4 +1,4 @@ -.Dd March 5, 2021 +.Dd August 2, 2021 .Dt STAGIT 1 .Os .Sh NAME @@ -92,7 +92,8 @@ description .It .git/owner or owner (bare repo). owner of repository .It .git/url or url (bare repo). -primary clone url of the repository, for example: git://git.2f30.org/stagit +primary clone URL of the repository, for example: +git://git.codemadness.org/stagit .El .Pp When a README or LICENSE file exists in HEAD or a .gitmodules submodules file @@ -109,6 +110,15 @@ CSS stylesheet. .El .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +.Bd -literal +mkdir -p htmlroot/htmlrepo1 && cd htmlroot/htmlrepo1 +stagit path/to/gitrepo1 +# repeat for other repositories. +.Ed +.Pp +To update the HTML files when the repository is changed a git post-receive hook +can be used, see the file example_post-receive.sh for an example. .Sh SEE ALSO .Xr stagit-index 1 .Sh AUTHORS diff --git a/stagit.c b/stagit.c @@ -379,7 +379,7 @@ xmlencode(FILE *fp, const char *s, size_t len) } } -/* Escape characters below as HTML 2.0 / XML 1.0, ignore printing '\n', '\r' */ +/* Escape characters below as HTML 2.0 / XML 1.0, ignore printing '\r', '\n' */ void xmlencodeline(FILE *fp, const char *s, size_t len) { @@ -484,6 +484,8 @@ writeheader(FILE *fp, const char *title) fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", rootpath); fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed\" href=\"%satom.xml\" />\n", name, relpath); + fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed (tags)\" href=\"%stags.xml\" />\n", + name, relpath); fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", rootpath); fputs("</head>\n<body>\n<table><tr><td id=\"logo\">", fp); fprintf(fp, "<a href=\"../%s\"><img src=\"%slogo.png\" alt=\"\" width=\"50\" height=\"50\" /></a>", @@ -745,7 +747,6 @@ writelog(FILE *fp, const git_oid *oid) git_revwalk_new(&w, repo); git_revwalk_push(w, oid); - git_revwalk_simplify_first_parent(w); while (!git_revwalk_next(&id, w)) { relpath = ""; @@ -884,7 +885,6 @@ writeatom(FILE *fp, int all) if (all) { git_revwalk_new(&w, repo); git_revwalk_push_head(w); - git_revwalk_simplify_first_parent(w); for (i = 0; i < m && !git_revwalk_next(&id, w); i++) { if (!(ci = commitinfo_getbyoid(&id))) break;