feat(commit): added structs and functionality for the commit log

This commit is contained in:
lisk77 2025-09-15 03:23:49 +02:00
parent bb0ab630c0
commit f19209ba0a
2 changed files with 497 additions and 0 deletions

31
include/commit.h Normal file
View file

@ -0,0 +1,31 @@
#ifndef COMMIT_H
#define COMMIT_H
#include <math.h>
#include "utilities.h"
typedef struct {
char* name;
char* email;
char* timestamp;
} Author;
typedef struct {
char* hash;
char* tree_hash;
Author* authors;
size_t authors_count;
Author committer;
char* message;
} Commit;
typedef List CommitLog;
CommitLog* commit_log_new();
void commit_log_push(CommitLog*, Commit);
void commit_log_free(CommitLog*);
int read_commit_log(CommitLog*, char*);
int write_commit_log(CommitLog*, char*);
#endif // COMMIT_H