diff options
-rw-r--r-- | git.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -64,6 +64,17 @@ void cleanup_git(git_repository **repos) { git_libgit2_shutdown(); } +file *create_file(const char *root, const char *filename) { + const size_t path_len = format_len("%s/%s", root, filename); + char *path = calloc(path_len+1, sizeof(char)); + long buf_size = 0; + file *f = calloc(1, sizeof(file)); + sprintf(path, "%s/%s", root, filename); + f->name = (char *)filename; + f->buf = read_file(filename, &buf_size); + return f; +} + void free_file(file *file) { if (file->name != NULL) { free(file->name); |