romele / git-trace public
62 commits · 1 branch · 1 tag · 1 contributor (top: Romele) · first commit 3d ago · last push 50m ago
src/mirror.h
#ifndef GT_MIRROR_H #define GT_MIRROR_H #include "web.h" /* validators shared with the settings UI */ int mirror_url_ok(const char *url); int mirror_refspec_ok(const char *spec); /* pull: dst refs/mirror/ */ int mirror_refspec_push_ok(const char *spec); /* push: src refs/heads/ */ /* render a URL for display: user:pass@ -> user:***@ */ void mirror_url_mask(const char *url, char *out, size_t n); /* sync enabled mirrors: owner==NULL -> all repos, else "owner" matches * the repo owned by that user named by 'name'. Returns # of failures. */ int gt_mirror_sync(struct app_ctx *app, const char *owner, const char *name); /* same for direction='push': git push <url> <refspec> per row */ int gt_mirror_push(struct app_ctx *app, const char *owner, const char *name); /* POST /<o>/<r>/mirror-sync — authenticated by X-Git-Trace-Signature * (HMAC-SHA256 over the raw body, keyed on the mirror's secret). */ void mirror_trigger(struct app_ctx *app, struct request *r, const char *owner, const char *name); #endif