Commit Briefs

Thomas Adam

add initial support for commit notifications to gotd(8)

At present only email notifications are implemented. Code for HTTP notifications is not yet finished, hence HTTP-related documentation remains hidden for now. This adds a new 'notify' process which has an "exec" pledge. It runs helper programs which implement the notification transport layer, such as got-notify-email which speaks SMTP. This design avoids having to link all of gotd with network libraries and related crypto libraries. Notification content is generated by the 'repo_write' process. Commit log messages and diffstats are written to a file which the 'notify' process will pass on to its helpers on stdin. The default output looks similar to 'got log -d'. If too many new commits are present the output looks similar to 'got log -s' instead. Tags always look like 'got tag -l'. The session process coordinates generation of notifications. It maintains a notification queue which holds one notification per updated reference, and passes notification requests from this queue to the 'repo_write' process for notification content creation and then to the 'notify' process for notification delivery. Only one notification can be in flight at a time to avoid file descriptor starvation if many references get updated in a single client session. ok op@


Thomas Adam

portable: configure gitwrapper/gotd paths

Rather than hard-code assumptions into gitwrapper and gotd binaries, allow for some values to be overriden at compile time. This should help portability.


Thomas Adam

portable: linux: use default git libexec

Define a standard path to where git stores its libexec helpers. This is always going to be hit-and-miss hard-coded like this, but will suffice for now. Tested on ubuntu 22.04


Thomas Adam

portable: gotd/gitwrapper: update for libs

Bring gotd and gitwrapper closer to how libraries are detected.


Thomas Adam

make gitwrapper ignore 'permission denied' for repository paths

We recommend that gotsh users should not have direct filesystem access to repositories served by gotd. Which means admins will be setting things up as follows if public read-access should be denied: chown _gotd /git chmod 700 /git su -m _gotd -c 'gotadmin init /git/repo.git" However, gitwrapper would error out when repositories listed in gotd.conf were inaccessible to the user invoking gitwrapper: git-upload-pack: /etc/gotd.conf:2: realpath /git/repo.git: Permission denied Make gitwrapper ignore such errors as they are expected in this situation. While here, add a PROC_GITWRAPPER process ID for use as a global variable parse.y can check while special-casing any specific behaviour required by gitwrapper. (The worse alternative would have been adding a new global variable to parse.y just to control the behaviour on realpath errors.) ok op@



Thomas Adam

significantly reduce the amount of code linked into gitwrapper

By moving got_serve_parse_command() from lib/serve.c into lib/dial.c as got_dial_parse_command(), we can significantly reduce the amount of symbols gitwrapper depends on indirectly. As a downside, gotsh now needs to link to dial.c. But it only uses the same parsing routine, and any other routines in dial.c would likely cause pledge violations in gotsh if used. No functional change.


Thomas Adam

avoid gitwrapper printing a warning when /etc/gotd.conf does not exist

gotd still requires the config file, of course, but gitwrapper must treat is as optional and remain silent if the file cannot be found.


Thomas Adam

gitwrapper: execl() directly without fork()ing

Since we're going to unconditionally execute gotsh or git-*-pack, don't bother fork()ing and having the main process to wait(2), just execle()! ok stsp@


Thomas Adam

fmt


Thomas Adam

require gotsh to exist if the repository is listed in gotd.conf

ok op@


Thomas Adam

add gitwrapper(1)

ok op@, tracey@ earlier version