Added features
Added: Project Overview TUI Build Cache / Dirty Detection Post-Build Hooks gbuild status
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#ifndef CACHE_H
|
||||
#define CACHE_H
|
||||
|
||||
/*
|
||||
* Build cache — per-project dirty detection.
|
||||
*
|
||||
* A small dotfile (.gbuild_cache) is kept inside each cloned repo dir.
|
||||
* It stores the git HEAD hash that was current at the last *successful*
|
||||
* build. On the next run gbuild compares the live HEAD to the cached
|
||||
* one; if they match the build is skipped unless --force was passed.
|
||||
*
|
||||
* Format of .gbuild_cache (plain text, one line):
|
||||
* <40-char sha1>\n
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Maximum length of a stored hash (SHA-1 hex + NUL). */
|
||||
#define CACHE_HASH_LEN 64
|
||||
|
||||
/*
|
||||
* Read the cached hash for the repo at repo_path into out (>= CACHE_HASH_LEN
|
||||
* bytes). Returns 0 on success, -1 if the file does not exist or is
|
||||
* unreadable (out is set to an empty string in that case).
|
||||
*/
|
||||
int cache_read(const char *repo_path, char *out, size_t n);
|
||||
|
||||
/*
|
||||
* Write hash as the new cached HEAD for the repo at repo_path.
|
||||
* Creates or overwrites .gbuild_cache inside repo_path.
|
||||
* Returns 0 on success, -1 on error.
|
||||
*/
|
||||
int cache_write(const char *repo_path, const char *hash);
|
||||
|
||||
#endif /* CACHE_H */
|
||||
Reference in New Issue
Block a user