#ifndef LIB_H_ #define LIB_H_ #include #include #include #define debugf(...) if (debug) (void)printf("[debug] " __VA_ARGS__) int is_git_metadata_dir(char *path); struct tmp_repo { git_repository* repo; char path[70]; }; struct tmp_repo tmp_repo_init(); void tmp_repo_deinit(struct tmp_repo repo); int check_for_backupignore(); void copy_over_backupignore(struct tmp_repo repo); int is_ignored(struct tmp_repo repo, char *path); struct recursive_reader { FILE *pfile; char *line; size_t capacity; }; struct recursive_reader recursive_reader_init(); int recursive_reader_read(struct recursive_reader *reader); void recursive_reader_deinit(struct recursive_reader reader); struct backup_streamer { int cwd_length; char to_prefix[PATH_MAX]; char cursor[PATH_MAX]; }; struct backup_streamer backup_streamer_init(char *cwd); void get_backup_destination(struct backup_streamer *streamer, char* from); int is_dir(char *path); void backup_file(char *from, char *to); void ensure_parents_exist(char *path); int debug; #endif // LIB_H_