diff --git a/src/commit.c b/src/commit.c index 5456751fe..79ddf2a63 100644 --- a/src/commit.c +++ b/src/commit.c @@ -104,7 +104,7 @@ static int validate_tree_and_parents(git_array_oid_t *parents, git_repository *r i++; } - if (current_id && git_oid_cmp(current_id, git_array_get(*parents, 0))) { + if (current_id && (parents->size == 0 || git_oid_cmp(current_id, git_array_get(*parents, 0)))) { giterr_set(GITERR_OBJECT, "failed to create commit: current tip is not the first parent"); error = GIT_EMODIFIED; goto on_error;