Commit graph

136 commits

Author SHA1 Message Date
Hiltjo Posthuma
e66cd8d5be tiny comment change 2021-10-06 23:40:33 -04:00
Hiltjo Posthuma
ad63c0a6a4 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".
2021-10-06 23:40:33 -04:00
f9161674fe some modifications to stagit 2021-03-10 20:51:30 -05:00
Hiltjo Posthuma
5ced189f19 change STAGIT_BASEURL to an -u option and also update the example script 2021-03-05 12:44:48 +01:00
Hiltjo Posthuma
7968c0bc9c add $STAGIT_BASEURL environment variable to make Atom links absolute
With feedback from adc, thanks!
2021-03-05 11:51:21 +01:00
Hiltjo Posthuma
722f836460 micro-optimization: fputc (function) -> putc (macro/inline function) 2021-01-09 14:59:53 +01:00
Hiltjo Posthuma
e1c0aebde4 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!
2020-11-28 12:28:05 +01:00
Oscar Benedito
66df204c44 add abbreviated commit hash to submodule file 2020-11-23 17:15:30 +01:00
Hiltjo Posthuma
a63645a5ea add meta viewport for scaling on mobile
Patch by Augustin Fabre <augustin@augfab.fr>
2020-11-15 21:16:24 +01:00
Hiltjo Posthuma
fc5ef41165 use size_t to count lines 2020-11-15 21:01:50 +01:00
Hiltjo Posthuma
4f60446c01 avoid shadowed `name' global variable
by Augustin Fabre <augustin@augfab.fr>
2020-11-15 20:58:58 +01:00
Hiltjo Posthuma
9467f347a2 refs_cmp: remove unneeded cast 2020-11-15 20:58:41 +01:00
Hiltjo Posthuma
3e7865f8f9 use LEN() macros for arrays
from Augustin Fabre <augustin@augfab.fr>
2020-11-15 20:58:02 +01:00
Hiltjo Posthuma
5334f3e000 fix a small memleak in writeatom()
non-tag references were not freed.
2020-08-10 16:09:46 +02:00
kst
174a763058 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
2020-08-06 18:25:27 +02:00
Hiltjo Posthuma
f05e6b0fcb regression: do not show unset or empty tags 2020-07-20 14:15:12 +02:00
Hiltjo Posthuma
d80a163acd refactor get reference, add another feed for tags/releases
A separate Atom feed is helpful to ports maintainers to monitor new
tags/releases.
2020-07-19 16:41:10 +02:00
Hiltjo Posthuma
693c064489 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!
2020-07-19 14:07:54 +02:00
Hiltjo Posthuma
bbeffc281d atom.xml: improve output format a bit 2020-02-21 13:46:23 +01:00
Hiltjo Posthuma
2f7e7f2503 improve includes, stagit-index does not need compat.h 2020-02-12 23:20:25 +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
028c7526ba escape HTML in paths
- escape paths in diff line.
- escape path in anchor href attribute in files.html
2019-03-16 13:07:58 +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
3a151527e1 in the diffstat prefix the type of change, allow CSS styling 2018-11-18 18:08:20 +01:00
Hiltjo Posthuma
608593b0f8 don't use a heuristic for renames, the content must match exactly
this prevents showing files as renames when most (but not all) of the file was
changed.
2018-11-18 18:07:22 +01:00
Hiltjo Posthuma
c100c3cc30 detect filetype changes in diff (for example a normal file to symlink) 2018-11-18 18:06:41 +01:00
Hiltjo Posthuma
84bb2212e8 detect more names for README and LICENSE
- for license: LICENSE, LICENSE.md, COPYING.
- for readme: README, README.md.
2018-11-11 19:12:55 +01:00
Hiltjo Posthuma
8c45dfc58e detect copies and renames based on the threshold of changes 2018-11-11 18:54:40 +01:00
Hiltjo Posthuma
175094899d simplify range check 2018-08-22 18:30:00 +02:00
Hiltjo Posthuma
1f76a28422 stagit: log: indicate when using the -l option and there are more commits 2018-08-22 18:30:00 +02:00
Hiltjo Posthuma
187daac420 assume OpenBSD 5.9+, always try pledge(2) on OpenBSD 2018-05-25 18:43:36 +02:00
Quentin Rameau
c7f158c58c Clarify usage regarding -c and -l mutual exclusion 2018-05-09 18:57:31 +02:00
Hiltjo Posthuma
3c07e52f98 pledge after git_libgit2_init
this is because libgit uses curl which uses some initialization
checks, namely an IPv6 check which creates a socket.
2018-03-26 20:08:19 +02:00
Hiltjo Posthuma
f53f481b3f optimization: only diff the tree when it is needed for the diffstat...
... also clear all fields in the structure on failure.

This is not as big an optimization as stagit-gopher, because the diffstat is
displayed in the log, but the difference is still measurable.
2018-03-18 15:34:37 +01:00
Hiltjo Posthuma
31392c13cf stagit: add -l option: limit the amount of commits for the log.html file 2018-01-21 16:47:10 +01:00
Hiltjo Posthuma
2ff0c0d6c0 fix: add "fattr" pledge for chmod(2) for cachefile
improve checks for when head is NULL (empty repo)
2017-11-19 14:52:04 +01:00
Hiltjo Posthuma
26bd89f681 fix file permissions for cachefile and respect umask(2) 2017-11-10 20:55:20 +01:00
Hiltjo Posthuma
1bab6952c6 more verbose errors: show which file failed on open 2017-11-10 20:53:46 +01:00
Hiltjo Posthuma
d7e003a519 allow umask to handle permissions 2017-09-04 18:14:52 +02:00
Hiltjo Posthuma
f843248215 separate getstats from getbyoid: slightly faster 2017-06-23 13:53:46 +02:00
Hiltjo Posthuma
54a8a7c153 for the commit Date: header use the git format-patch format 2017-05-07 13:12:43 +02:00
Hiltjo Posthuma
7cb669f74f dont truncate summary length anymore
make sure not partial (invalid) utf-8 sequences are written. The old logic
truncated by bytelen was wrong. It is too complex to implement it in a
correct way with git: it is not assured a commit message is UTF-8 encoded.

remove showlinecount and summarylen variables.
2017-05-07 12:06:45 +02:00
Hiltjo Posthuma
8fa0effa98 improve commitinfo_getstats
- reorder: unnecessary allocation when git_patch_from_diff fails.
- no need to free patch object when git_patch_from_diff fails.
2017-05-07 12:05:47 +02:00
Hiltjo Posthuma
e9e7978381 align line numbers to 8 spaces
... now it is done.
2017-04-17 16:39:03 +02:00
Hiltjo Posthuma
8e4eb29210 writeblobhtml: minor style fix
using len instead of the loop 'i' is slightly more clear
2017-04-17 16:16:33 +02:00
Hiltjo Posthuma
394d90b7bb stagit: fix rendering of first TAB in file
else TABs wont render properly (interpreted as part of HTML whitespace)
at the first TAB of the line.
2017-04-17 13:39:05 +02:00
Hiltjo Posthuma
f9e7dc8070 writeblobhtml: fix possible uninitialized variable n when len == 0
... whoops
2017-04-16 20:59:23 +02:00
Hiltjo Posthuma
44b20f3414 writeblobhtml: improve file view for text-browsers
browsers such as lynx and w3m have some quirks displaying tables and pre
elements.

links is a bit better with this.
2017-04-16 20:37:42 +02:00