diff --git a/src/main.c b/src/main.c index 93df2e4..aef2b96 100644 --- a/src/main.c +++ b/src/main.c @@ -415,6 +415,7 @@ static int commit(int argc, char** argv) { for (size_t idx = 0; idx < files->len; idx++) { BaseFileInfo* base_file = base_file_buffer_search(base_files, files->items[idx]); if (!base_file) { + printf("this is a basefile as it should be\n"); BaseFileInfo info = (BaseFileInfo){.base_num = 0, .diff_num = 0, .name = strdup(files->items[idx])}; base_file_buffer_push(base_files, info); // Compress the files content and put it into the object database @@ -604,8 +605,8 @@ static int commit(int argc, char** argv) { } for (size_t idx = 0; idx < tree->len; idx++) { - ((FileInfo*)tree->items + idx)->hash = strdup(flat_map_get(file_hash_map, ((FileInfo*)tree->items + idx)->name)); - printf("%s: %s\n", ((FileInfo*)tree->items + idx)->name, ((FileInfo*)tree->items + idx)->hash); + char* hash = flat_map_get(file_hash_map, ((FileInfo*)tree->items + idx)->name); + if (hash) ((FileInfo*)tree->items + idx)->hash = strdup(hash); } char tree_hash[41];