Commit graph

44 commits

Author SHA1 Message Date
Anton Lindqvist
1357ad5181 Allow git to run on an other user repository
Reported by Anton:

"Recent versions of libgit2 broke stagit for me due to the added opt-out
GIT_OPT_SET_OWNER_VALIDATION configuration knob. My repositories are owned by
root:vcs and I run stagit as another user which happens to be in vcs group but
not the owner of the repository. Disabling the validation makes stagit work as
expected again."

Some notes:

When using regular git it also provides a knob. This is due to a security
concern in some cases, which is not applicable to stagit.

	git log somerepo

	fatal: unsafe repository ('somerepo' is owned by someone else)
	To add an exception for this directory, call:

	        git config --global --add safe.directory somerepo

See also / related:
- https://github.blog/2022-04-12-git-security-vulnerability-announced/
2022-05-24 11:09:05 +02:00
Hiltjo Posthuma
d0e36eb6ab improve stream read and write error handling 2022-03-19 12:51:40 +01:00
Hiltjo Posthuma
4d19863b06 libgit2 config opts: set the search to an empty path
Otherwise this would search outside the unveiled paths and cause an unveil
violation.

Reported by Anton Lindqvist, thanks!
2022-01-03 12:22:52 +01:00
Hiltjo Posthuma
df2a31c67a do not percent-encode: ',' or '-' or '.' it looks ugly 2021-12-14 20:52:18 +01:00
Hiltjo Posthuma
6eeefd2087 percent encode characters in path names
Paths could contain characters like # (fragment), '?', control-characters, etc.
2021-11-16 14:16:46 +01:00
Hiltjo Posthuma
c827ab1b1d 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!
2021-05-05 19:15:58 +02:00
Hiltjo Posthuma
995f7d5c5d add meta viewport on stagit-index too
Patch by Oscar Benedito, thanks!
2021-03-19 11:29:53 +01:00
Hiltjo Posthuma
722f836460 micro-optimization: fputc (function) -> putc (macro/inline function) 2021-01-09 14:59:53 +01:00
Hiltjo Posthuma
dc0709f6f4 stagit-index: remove unveil support for argv
This can reach the unveil argument limits and it is not a good case for using
unveil.
2020-08-08 20:01:05 +02:00
Hiltjo Posthuma
2f7e7f2503 improve includes, stagit-index does not need compat.h 2020-02-12 23:20:25 +01:00
Hiltjo Posthuma
31c0f00651 small code-style white-space/newline 2019-12-22 12:53:54 +01:00
Hiltjo Posthuma
edee68f398 add OpenBSD unveil support
The unveil() system call first appeared in OpenBSD 6.4.

For stagit it has the following properties now:

- stagit-index: only read-access to the file-system for the specified
  directories/repositories.
- stagit: read-access to the specified directory/repository.
  read-write and creation access to the current directory for the output files.
  read-write and creation access to the specified cache file.
2019-12-01 18:31:07 +01:00
Hiltjo Posthuma
bb1d06eb20 pedantic snprintf() improvement
POSIX says:
"If an output error was encountered, these functions shall return a negative
value and set errno to indicate the error."
2019-03-09 12:39:10 +01:00
Hiltjo Posthuma
3fbef5c9b0 change order of commits in log from most recent to old to applied order 2019-02-16 21:17:45 +01:00
Hiltjo Posthuma
583c44395c fix compile: libgit2 0.28 changed giterr_last to git_error_last
libgit2 commit:
a27a4de6f8
2019-02-16 21:17:38 +01:00
Hiltjo Posthuma
187daac420 assume OpenBSD 5.9+, always try pledge(2) on OpenBSD 2018-05-25 18:43:36 +02:00
Hiltjo Posthuma
6a1224afae stagit-index: pledge after git_libgit2_init 2018-04-06 19:28:05 +02:00
Hiltjo Posthuma
99583eee62 stagit-index: also dont assume someones <html lang> :) 2017-04-17 13:13:26 +02:00
Hiltjo Posthuma
7bb7dc5cc9 stagit-index: remove Content-Language: en
forgot to remove this from stagit-index aswell, see also:
commit 9e96062b62
2017-04-17 13:06:02 +02:00
Hiltjo Posthuma
4035291297 stagit-index: remove empty h1 and add bold markup to table headers 2017-04-16 20:36:48 +02:00
Hiltjo Posthuma
ab3fdd7043 browser compatibility: use numeric entity for '
&apos; is a XHTML entity, browsers such as links, w3m, lynx and dillo
don't support it.
2017-04-15 12:56:29 +02:00
Hiltjo Posthuma
e862768a1f simplify/shorten pledge stub 2017-03-12 19:49:14 +01:00
Hiltjo Posthuma
6b48169fa5 reduce scope of repodir, remove unused branch parameter 2017-03-12 19:47:58 +01:00
Hiltjo Posthuma
543582034e fix joinpath(): use of global 'repodir', should be 'path'
use joinpath for another case.
2016-05-03 20:42:46 +02:00
Hiltjo Posthuma
9328d2690e code cleanup 2016-05-03 20:18:37 +02:00
Hiltjo Posthuma
069f105725 remove config.h, add options to stagit.c 2016-05-03 00:38:33 +02:00
Hiltjo Posthuma
aa36e0c9b4 add OpenBSD pledge(2) support using -DUSE_PLEDGE 2016-05-03 00:33:56 +02:00
Hiltjo Posthuma
462ba66ee7 fix times (and timezone)
- in the index and log show the short time (GMT).
- in the Atom feed use GMT time.
- for commits show the time + offset.
2016-05-01 16:56:58 +02:00
Hiltjo Posthuma
fc60d78d89 fix path join '/'
add joinpath() function to handle this.
2016-05-01 14:51:02 +02:00
Hiltjo Posthuma
c13c411950 code cleanup + style, functionally equivalent 2016-05-01 14:42:20 +02:00
Hiltjo Posthuma
28730218c4 fix: check gmtime, can return NULL on error 2016-04-27 19:24:15 +02:00
Hiltjo Posthuma
8df54926f2 resolve absolute paths to repodir, remove basename just use strrchr.
- resolve repodir, for example: stagit-index ../ used to use ".." as the name,
  now it will resolve to the real directory name.
- just use strrchr(path, '/') instead of basename, '/' path separator is now
  used.
2016-04-27 19:19:50 +02:00
Hiltjo Posthuma
70b777831a stagit-index: remove unused efopen function 2016-04-27 16:40:51 +02:00
lostd
2b50046245 Use the recommended HTML5 document type. 2016-02-26 19:57:15 +01:00
Hiltjo Posthuma
ad22404903 check path truncation
be strict about it
2016-02-24 14:47:20 +01:00
Hiltjo Posthuma
ede4982f67 strip .git suffix from name
also free stripped_name in the case of stagit-index
2016-01-06 20:06:06 +01:00
Hiltjo Posthuma
db02820a17 extra whitespace 2016-01-06 20:06:06 +01:00
sin
264aef81d5 Be more explicit when stripping the .git suffix 2016-01-06 17:45:57 +00:00
sin
f631d4ce70 stagit-index: Strip per repo .git suffix from generated index 2016-01-06 14:48:50 +00:00
Hiltjo Posthuma
a8943ce1f8 stagit-index: continue making list, but return error code 2016-01-05 22:30:59 +01:00
Hiltjo Posthuma
f17def25be stagit-index: owner is one line, strip newline 2016-01-05 21:41:03 +01:00
Hiltjo Posthuma
4f318941d0 revert log.html to log/head.html change 2016-01-05 21:04:07 +01:00
Hiltjo Posthuma
00fb6ea2b0 fix link in stagit-index, update documentation, add TODO 2016-01-03 22:42:00 +01:00
Hiltjo Posthuma
81dd454368 rename urmoms to stagit, improve documentation 2015-12-26 21:05:55 +01:00
Renamed from urmoms-index.c (Browse further)