diff options
author | EuAndreh <eu@euandre.org> | 2021-08-02 11:06:59 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-08-02 11:06:59 -0300 |
commit | 242a7b4c81d84e12e17a2f42cb408b3e4a2954b0 (patch) | |
tree | 91f0b88cb73fc172b2ac453c0a2929c1932a8b0c /src | |
parent | TODOs.md: Add #task-cd214149-a183-9bd3-292a-d48b3fb85050 (diff) | |
download | gistatic-242a7b4c81d84e12e17a2f42cb408b3e4a2954b0.tar.gz gistatic-242a7b4c81d84e12e17a2f42cb408b3e4a2954b0.tar.xz |
src/gistatic.c: Tweak CSS and HTML, and some libgit2 error logging
Diffstat (limited to 'src')
-rw-r--r-- | src/gistatic.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/gistatic.c b/src/gistatic.c index 19d1654..5c03432 100644 --- a/src/gistatic.c +++ b/src/gistatic.c @@ -206,7 +206,11 @@ static const char *const STYLE_STR = "" "}\n" "\n" ".header-description {\n" - " margin-left: 1em;\n" + " margin-left: 2em;\n" + "}\n" + "\n" + "nav {\n" + " margin-top: 2em;\n" "}\n" "\n" "nav ul {\n" @@ -919,7 +923,7 @@ static char *last_commit_date(struct git_repository *const repo) { char *ret; if ( - git_revwalk_new(&walker, repo) + git_revwalk_new(&walker, repo) || git_revwalk_push_head(walker) || git_revwalk_next(&oid, walker) || git_commit_lookup(&commit, repo, &oid) @@ -1370,7 +1374,7 @@ static int repo_write_refs( " <td>\n" " <a href=\"log/%s.html\">\n" " %s\n" - " <a>\n" + " </a>\n" " </td>\n" " <td>\n" " <a href=\"commit/%s.html\">\n" @@ -1404,6 +1408,9 @@ static int repo_write_refs( git_reference_free(ref); } if (e != GIT_ITEROVER) { + const git_error *const error = git_error_last(); + assert(error); + logerr("git_branch_next()", error->message, __LINE__); ret = -1; goto cleanup; } @@ -1445,6 +1452,7 @@ static int repo_write_refs( ret = -1; goto cleanup; } + while (!(e = git_reference_next(&ref, ref_iter))) { if (!git_reference_is_tag(ref)) { git_reference_free(ref); @@ -1492,9 +1500,9 @@ static int repo_write_refs( "" " <tr>\n" " <td>\n" - " <a href=\"log/%s.html\">\n" + " <a href=\"tag/%s.html\">\n" " %s\n" - " <a>\n" + " </a>\n" " </td>\n" " <td>\n" " <a href=\"commit/%s.html\">\n" @@ -1538,6 +1546,9 @@ static int repo_write_refs( git_reference_free(ref); } if (e != GIT_ITEROVER) { + const git_error *const error = git_error_last(); + assert(error); + logerr("git_reference_next()", error->message, __LINE__); ret = -1; goto cleanup; } @@ -1627,10 +1638,7 @@ static int repo_write( goto cleanup; } - if ( - write_logo(logo_fd) - || write_style(style_fd) - ) { + if (write_logo(logo_fd) || write_style(style_fd)) { ret = -1; goto cleanup; } @@ -1672,8 +1680,11 @@ static int repo_write( goto cleanup; } - if (repo_write_refs(outdir, repo, encoded_name, encoded_description, - clone_url)) { + if ( + repo_write_refs(outdir, repo, encoded_name, + encoded_description, clone_url) + || repo_write_snapshots(outdir, repo, encoded_name) + ) { ret = -1; goto cleanup; } @@ -1806,10 +1817,8 @@ int main(int argc, char *argv[]) { errno = 0; - if ( - mkdir(outdir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) - && errno != EEXIST - ) { + if (mkdir(outdir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) + && errno != EEXIST) { logerrs("mkdir(\"", outdir, "\")", strerror(errno), __LINE__); ret = EXIT_ERROR; goto cleanup; |