Commit graph

153 commits

Author SHA1 Message Date
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
Hiltjo Posthuma
980fa8ea9b text-browser improvements
for links, lynx, w3m, dil[dl]o etc:

- set oldschool align attribute.
- apply bold markup to table header.
2017-04-16 20:36:17 +02:00
Hiltjo Posthuma
ab3fdd7043 browser compatibility: use numeric entity for '
' 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
bba55b6bbc writeblobhtml, make fprintf format string const 2017-04-01 19:33:19 +02:00
Hiltjo Posthuma
1d91c79e3c fix potential leak, found by clang-analyzer 2017-03-12 21:30:43 +01:00
Hiltjo Posthuma
ae6461dc6f fix memory leak of commitinfo 2017-03-12 21:24:07 +01:00
Hiltjo Posthuma
543107cc36 atom.xml: add newline before EOF 2017-03-12 21:22:53 +01:00
Hiltjo Posthuma
0f05e4b4f0 fix memory leak of commitinfo->parent 2017-03-12 21:22:52 +01:00
Hiltjo Posthuma
7a515945dd fix memory leak of blob object 2017-03-12 21:22:52 +01: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
92cee02f12 also remove language and text direction attribute from <html> 2016-11-09 18:28:46 +01:00
Hiltjo Posthuma
9e96062b62 remove Content-Language: en
thanks Aymeric Mansoux!
2016-11-09 17:49:38 +01:00
Hiltjo Posthuma
30116a4ef2 treat an empty repo (without a HEAD) as valid
and create the standard files. Disable caching if there is no HEAD.
2016-05-29 15:04:52 +02:00
Hiltjo Posthuma
837427b09e refs_cmp: simplify check, functionally the same 2016-05-21 18:37:53 +02:00
Hiltjo Posthuma
df3ea10eca check if LICENSE, README and .gitmodules is a file blob
don't link to directory trees, etc. Thanks 600360 for reporting it!
2016-05-08 20:37:37 +02:00
Hiltjo Posthuma
a7dd578de7 simplify, id is unused 2016-05-07 14:38:39 +02:00
Hiltjo Posthuma
f89c317dee simplify, no need for goto 2016-05-07 14:34:51 +02:00
Hiltjo Posthuma
2f8595e786 consistency for messages for special-case in diffstat 2016-05-07 14:34:45 +02:00
Hiltjo Posthuma
f63edd593d fix error in "code cleanup" commit 9328d2690e
... the loop was simplified, but forgot to remove p++ (double used) while
rebasing the change.
2016-05-07 13:52:42 +02:00
Hiltjo Posthuma
6e5e218b69 fix and simplify time offset 2016-05-06 12:01:57 +02:00
Hiltjo Posthuma
c6e8f9fd80 make diffstat files an anchor (jump to delta) 2016-05-06 11:49:25 +02: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
2d8eb85f01 fix regression from last commit 2016-05-03 20:28:09 +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
f5301b25e1 style: write atom feed end in one write, kills 2 lines 2016-05-02 21:25:44 +02:00
Hiltjo Posthuma
1a3584e2d0 cache support (-c option)
"Optionally the -c cachefile option can be used to cache the entries of
the log page up to the point of the last commit. The cachefile will store
the last commit id and the entries in the HTML table."

this caches the diffstat and commits, it is an expensive operation (twss).
2016-05-02 21:17:52 +02:00
Hiltjo Posthuma
ede93fa7ee small code cleanup: no need for status variable 2016-05-01 19:09:26 +02:00
Hiltjo Posthuma
45ee6876d5 atom feed: use published for author commit date, updated for committer date
this is the same as cgit.
2016-05-01 17:20:54 +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
254f215e50 layout: right align lines changed count in diffstat 2016-04-30 13:08:44 +02:00
Hiltjo Posthuma
7067223104 optimization: suppress large diffs
the values are arbitrary, these can be tweaked later if needed.
2016-04-30 12:47:06 +02:00
Hiltjo Posthuma
914880f31b optimization: read stats once and remember it
for an initial run and new commits this speeds stagit up a bit:
on an initial run of sbase goes from about 4 seconds to 2.8 on my machine.

now we can't use statsbuf, so create the stats string ourselves, while at it
color the + and - using a style (can be disabled for the color-haters out
there ;)).
2016-04-30 12:47:00 +02:00
Hiltjo Posthuma
ad40433839 whoops, module is m--------- 2016-04-29 21:24:58 +02:00
Hiltjo Posthuma
5c278a600e submodule support
- detect .gitmodules file for submodules, add a link "submodules" to the top menu.
- link each submodule to the .gitmodules file in HEAD.
- revert the special style for modules, but list it as a file "m---------", don't show
  the line/filesize though, it is not a file.
2016-04-29 21:14:46 +02:00
Hiltjo Posthuma
671f4e9100 suppress meaningless error codes when a repo can't be opened (similar to stagit-index) 2016-04-29 16:39:33 +02:00
Hiltjo Posthuma
f2773b0319 minor style fix 2016-04-29 15:55:33 +02:00
Quentin Rameau
b8af751b01 Fix null pointer access for submodules in writefilestree
Do not try to set a link to submodules from bare repo as we can't get
the actual url.
2016-04-29 15:54:57 +02:00
Hiltjo Posthuma
375d41dcce tweak style of showing submodules
this will make it look similar to cgit. show mode as "m---------"
2016-04-29 12:32:36 +02:00
z3bra
571076b419 Don't fail on submodules
Submodules will get listed prefixed with a '@', using a specific CSS class for
styling. The href will be set to the url of the submodule.
Filesize will appear as 0 and filemode will not be printed to avoid an awkward
mode: "?---------".

In writefilestree, we don't return anymore if an entry can't be categorized as
an object, but rather, fail if we can't retrieve its name.
2016-04-29 12:31:39 +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
86bbe82211 fix: link to line in hunk if a patch has multiple files and hunks
thanks to lostd for reporting it!
2016-04-27 16:39:48 +02:00
Hiltjo Posthuma
c379d65770 add titles to pages, summary for commit messages, filename for files 2016-03-01 19:14:00 +01:00
Hiltjo Posthuma
78c29a1de2 fix right-alignment of "Files" column 2016-02-26 19:59:11 +01: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
8bf328befa atom feed: add link, move content order to bottom
NOTE: using relative links violates the Atom specification, but relative
links are convenient aswell.
2016-02-23 20:44:00 +01:00
Hiltjo Posthuma
5578784dda make printshowfile more generic and like other functions 2016-02-23 20:37:17 +01:00
Hiltjo Posthuma
ce535ae1af just use Name as first column, thanks quinq for the suggestion 2016-01-21 20:42:11 +01:00
Quentin Rameau
75b4b23c9f Rename “Age” column headers into “Date” 2016-01-21 20:38:47 +01:00
Quentin Rameau
502b95ce68 fix file tree handling
Do not forget to keep previous path when recursing or we end up with
filenames only.
2016-01-19 22:16:15 +01:00
z3bra
9693d1d1a9 use 'dirname' as error message for xdirname 2016-01-18 10:31:52 +00:00
Quentin Rameau
4f56d5dec6 fix file size byte unit suffix
Correct suffix for byte is B, b is for bit.
2016-01-13 21:58:08 +01:00
Quentin Rameau
79fab7c6fa replace file size with line count for text files
Keep the number of line when writing text blobs and print it in the
index file tree instead of the size. Still print the size otherwise.
2016-01-13 21:58:08 +01:00
sin
50dccf0e3b Rename Refs/branches to Refs 2016-01-13 18:57:18 +00:00
Hiltjo Posthuma
934980659a implify and restructure code
- remove commit message and lines changed from refs page.
- resolve HEAD once.
- dont make filepath in writeblob()
2016-01-08 20:08:40 +01:00
Hiltjo Posthuma
3cc1509656 atom: add newline after date and before message 2016-01-07 17:37:25 +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
Hiltjo Posthuma
9978fecb18 refs: only make commit link work for tags 2016-01-06 19:13:51 +01:00
Hiltjo Posthuma
512a31e81f free obj 2016-01-06 19:11:11 +01:00
Hiltjo Posthuma
650d6c903c old leftover: dont create log dir 2016-01-06 18:53:51 +01:00
Hiltjo Posthuma
aa3b813f14 cleanup code a bit 2016-01-06 18:53:51 +01:00
Hiltjo Posthuma
87360fe252 use git_reference for tags and branches, sort branches also
this removes some lines and somewhat simplifies it
2016-01-06 17:45:02 +01:00
Hiltjo Posthuma
c750958b95 fix cast to uintmax_t 2016-01-06 16:04:37 +01:00
Hiltjo Posthuma
d045340ea0 lookup commits of annotated tags
NOTE: as described in the TODO this will be rewritten more cleanly
      later using git_reference_*.
2016-01-06 15:35:34 +01:00
Hiltjo Posthuma
9128782aa8 fix warning, use intmax_t %ju, thanks stateless! 2016-01-06 15:19:26 +01:00
Hiltjo Posthuma
35a3d9b3fc fix relpath for log 2016-01-05 21:43:26 +01:00
Hiltjo Posthuma
f373cc7235 clone url is one line, strip newline 2016-01-05 21:43:14 +01:00
Hiltjo Posthuma
e51ec34dbe refs: fix table id for tags 2016-01-05 21:42:51 +01:00
Hiltjo Posthuma
48a09a0f10 refs: remove link, it may be broken for non-HEAD 2016-01-05 21:42:34 +01:00
Hiltjo Posthuma
a6b29cbbd9 make hunk line itself a link 2016-01-05 21:42:10 +01:00
Hiltjo Posthuma
4f318941d0 revert log.html to log/head.html change 2016-01-05 21:04:07 +01:00
Hiltjo Posthuma
200ccad8b5 fix newline after header 2016-01-05 21:03:39 +01:00
Hiltjo Posthuma
444e41b315 fix link to commit from log page 2016-01-04 23:55:39 +01:00
Hiltjo Posthuma
a89e756c9e stagit: fix hunk header, thanks uggedal for reporting! 2016-01-04 23:41:40 +01:00
Hiltjo Posthuma
f96ac27087 no log per branch
rename log.html to log/HEAD.html, small code cleanup
2016-01-03 22:36:48 +01:00
Hiltjo Posthuma
043609742f rename refs to refs/branches 2016-01-03 21:45:53 +01:00
Hiltjo Posthuma
a83a75bb18 refs: add link to log per branch 2016-01-03 21:21:30 +01:00