XD/hash.h

37 lines
684 B
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <git2/repository.h>
#ifdef GIT
typedef struct {
uint64_t hash;
bool changes;
} repohash;
#define XD_HASH_PATH "/XDhash"
/**
* @brief generate a hash from the repository state
*
* @param repo the git repository
* @return the hash
*/
uint64_t generate_hash(git_repository *repo);
/**
* @brief read the hash from the git repo
*
* @param repo the git repository
* @return the hash
*/
repohash *read_hash(git_repository *repo);
/**
* @brief write a new hash to the repository
*
* @param repo the repository
* @param hash the hash to write
*/
int write_hash(git_repository *repo, repohash hash);
#endif