romele / git-trace public
62 commits · 1 branch · 1 tag · 1 contributor (top: Romele) · first commit 3d ago · last push 51m ago
src/gitx.h
#ifndef GT_GITX_H #define GT_GITX_H #include "util.h" /* ref names: [A-Za-z0-9][A-Za-z0-9._/-]* (no '-', no "..", no leading '/') */ int git_ref_ok(const char *s); /* file paths inside a tree: segments like name_ok, '/'-separated, no ".." * leading '-' or '/' rejected; empty path allowed */ int git_path_ok(const char *s); /* branch-rule globs: branch-name charset plus '*' and '?' wildcards */ int git_pat_ok(const char *s); /* * Run git inside repo_dir with argv[0] == "git", capture stdout into * out (cap: 16 MiB). argv must be NULL-terminated. Returns exit * status, -1 spawn error, -2 output overflow (child killed). */ int git_capture(const char *repo_dir, const char *const argv[], struct buf *out); /* same, with extra "K=V" env strings for the child (NULL-terminated) */ int git_capture_env(const char *repo_dir, const char *const envs[], const char *const argv[], struct buf *out); /* resolve HEAD to a short branch name ("master"), malloc'd; NULL on error */ char *git_default_branch(const char *repo_dir); #endif