git.h (1230B)
1 #ifndef GOUT_GIT_GIT_H_ 2 #define GOUT_GIT_GIT_H_ 3 4 #include <stddef.h> 5 6 #include "git/commit.h" 7 #include "git/file.h" 8 #include "git/reference.h" 9 #include "git/repo.h" 10 #include "utils.h" 11 12 typedef struct Git Git; 13 14 typedef void (*RepoCallback)(Git* git, void* user_data); 15 typedef void (*CommitCallback)(const GitCommit* ci, void* user_data); 16 typedef void (*ReferenceCallback)(const GitReference* ref, void* user_data); 17 typedef void (*FileCallback)(const GitFile* file, void* user_data); 18 19 struct Git { 20 void* impl; 21 GitRepo* repo; 22 const FileSystem* fs; 23 24 void (*initialize)(Git* git); 25 void (*shutdown)(Git* git); 26 27 void (*for_repo)(Git* git, 28 const char* path, 29 RepoCallback cb, 30 void* user_data); 31 void (*for_each_commit)(Git* git, CommitCallback cb, void* user_data); 32 void (*for_commit)(Git* git, 33 const char* spec, 34 CommitCallback cb, 35 void* user_data); 36 void (*for_each_reference)(Git* git, ReferenceCallback cb, void* user_data); 37 void (*for_each_file)(Git* git, FileCallback cb, void* user_data); 38 }; 39 40 Git* gout_git_create(const FileSystem* fs); 41 void gout_git_free(Git* git); 42 43 #endif // GOUT_GIT_GIT_H_