void test_repo_head__setting_head_updates_reflog(void) { git_object *tag; git_signature *sig; git_annotated_commit *annotated; cl_git_pass(git_signature_now(&sig, "me", "*****@*****.**")); cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked")); cl_git_pass(git_repository_set_head(repo, "refs/heads/unborn")); cl_git_pass(git_revparse_single(&tag, repo, "tags/test")); cl_git_pass(git_repository_set_head_detached(repo, git_object_id(tag))); cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked")); test_reflog(repo, 2, NULL, "refs/heads/haacked", "*****@*****.**", "checkout: moving from master to haacked"); test_reflog(repo, 1, NULL, "tags/test^{commit}", "*****@*****.**", "checkout: moving from unborn to e90810b8df3e80c413d903f631643c716887138d"); test_reflog(repo, 0, "tags/test^{commit}", "refs/heads/haacked", "*****@*****.**", "checkout: moving from e90810b8df3e80c413d903f631643c716887138d to haacked"); cl_git_pass(git_annotated_commit_from_revspec(&annotated, repo, "haacked~0")); cl_git_pass(git_repository_set_head_detached_from_annotated(repo, annotated)); test_reflog(repo, 0, NULL, "refs/heads/haacked", "*****@*****.**", "checkout: moving from haacked to haacked~0"); git_annotated_commit_free(annotated); git_object_free(tag); git_signature_free(sig); }
void test_repo_head__setting_head_updates_reflog(void) { git_object *tag; git_signature *sig; cl_git_pass(git_signature_now(&sig, "me", "*****@*****.**")); cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", sig, "message1")); cl_git_pass(git_repository_set_head(repo, "refs/heads/unborn", sig, "message2")); cl_git_pass(git_revparse_single(&tag, repo, "tags/test")); cl_git_pass(git_repository_set_head_detached(repo, git_object_id(tag), sig, "message3")); cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", sig, "message4")); test_reflog(repo, 2, NULL, "refs/heads/haacked", "*****@*****.**", "message1"); test_reflog(repo, 1, NULL, "tags/test^{commit}", "*****@*****.**", "message3"); test_reflog(repo, 0, "tags/test^{commit}", "refs/heads/haacked", "*****@*****.**", "message4"); git_object_free(tag); git_signature_free(sig); }