939232e72e
Added: Project Overview TUI Build Cache / Dirty Detection Post-Build Hooks gbuild status
35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
#ifndef GIT_OPS_H
|
|
#define GIT_OPS_H
|
|
|
|
#include "logger.h"
|
|
|
|
/* Returns 1 if clone_dir/project/.git exists, 0 otherwise */
|
|
int git_repo_exists(const char *clone_dir, const char *project);
|
|
|
|
/* Clone repo under clone_dir/project using token or password auth */
|
|
int git_clone(const char *base_url, const char *user,
|
|
const char *token, const char *password,
|
|
const char *project, const char *clone_dir,
|
|
Logger *log);
|
|
|
|
/* Pull latest in repo_path */
|
|
int git_pull(const char *repo_path, Logger *log);
|
|
|
|
/* Read the current HEAD hash of repo_path into out (at least 41 bytes).
|
|
* Returns 0 on success, -1 on failure. */
|
|
int git_head_hash(const char *repo_path, char *out, size_t n);
|
|
|
|
/* Write the current branch name into out.
|
|
* Returns 0 on success, -1 on failure (detached HEAD writes "(detached)"). */
|
|
int git_current_branch(const char *repo_path, char *out, size_t n);
|
|
|
|
/* Returns 1 if the working tree has uncommitted changes, 0 if clean,
|
|
* -1 on error. Does NOT stage anything. */
|
|
int git_is_dirty(const char *repo_path);
|
|
|
|
/* Silently fetches from origin then returns the number of commits
|
|
* the local branch is behind its upstream, or -1 on error. */
|
|
int git_behind_count(const char *repo_path);
|
|
|
|
#endif /* GIT_OPS_H */
|