aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-08-04 12:43:20 -0300
committerEuAndreh <eu@euandre.org>2021-08-04 12:43:20 -0300
commit9708c3d6829caa8f28e57ffaf25d1cb5f5e78a5b (patch)
tree564d74bd06ea50100d5aa366267ecd00ca4fa4e4
parentsrc/gistatic.c: Mark test helper functions as static (diff)
downloadgistatic-9708c3d6829caa8f28e57ffaf25d1cb5f5e78a5b.tar.gz
gistatic-9708c3d6829caa8f28e57ffaf25d1cb5f5e78a5b.tar.xz
src/gistatic.c: Use "loop_cleanup" goto tag
-rw-r--r--src/gistatic.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/gistatic.c b/src/gistatic.c
index 2ab7865..f049b74 100644
--- a/src/gistatic.c
+++ b/src/gistatic.c
@@ -871,8 +871,8 @@ static int index_write_header(FILE *const fd, const char *const idx_title) {
}
static char *footer_signature_string() {
- const size_t signature_size = strlen(_(MSG_FOOTER_TEMPLATE)) - strlen("%s")
- + strlen(PROJECT_HOMEPAGE_LINK) + sizeof('\0');
+ const size_t signature_size = strlen(_(MSG_FOOTER_TEMPLATE))
+ - strlen("%s") + strlen(PROJECT_HOMEPAGE_LINK) + sizeof('\0');
char *const signature_text = malloc(signature_size);
if (!signature_text) {
logerrl("malloc(", signature_size, ")", strerror(errno),
@@ -1626,19 +1626,25 @@ static int repo_write_snapshots(
struct git_reference *ref;
while (!(e = git_reference_next(&ref, ref_iter))) {
- if (
- !git_reference_is_tag(ref)
- && !git_reference_is_branch(ref)
- && !git_reference_is_note(ref)
- ) {
- git_reference_free(ref);
- continue;
+ const char *const name = git_reference_shorthand(ref);
+ assert(name);
+ const bool is_tag = git_reference_is_tag(ref);
+ const bool is_branch = git_reference_is_branch(ref);
+ const bool is_note = git_reference_is_note(ref);
+
+ if (!is_tag && !is_branch && !is_note) {
+ goto loop_cleanup;
+ }
+ if (is_note && strcmp(name, "notes/signatures/tar.xz") != 0) {
+ goto loop_cleanup;
}
+ printf("reference name: %s\n", git_reference_shorthand(ref));
+
// https://github.com/ionescu007/minlzma
// https://git.tukaani.org/?p=xz.git;a=tree;f=src;h=665b39e6439f1bb5afd9181ec0890c2ed26d047e;hb=HEAD
// git archive --format tar.xz --prefix "$PROJECT-$tag/" "$tag"
- // printf("reference name: %s\n", git_reference_shorthand(ref));
+ loop_cleanup:
git_reference_free(ref);
}
if (e != GIT_ITEROVER) {