diff options
| author | Ben Straub <bs@github.com> | 2014-02-03 14:08:40 -0800 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2014-02-03 14:08:40 -0800 |
| commit | 0d847a31598a933877d94430b2fe80bade55fe1a (patch) | |
| tree | f07819e74fd2ddc759e1bc86ff24e6e02a8ddfde /tests/reset/soft.c | |
| parent | 3b6a5bac20a9cb46cd29d74baf06cf8a8d1248fb (diff) | |
| download | libgit2-0d847a31598a933877d94430b2fe80bade55fe1a.tar.gz | |
Reset helpers: use revparse instead
Diffstat (limited to 'tests/reset/soft.c')
| -rw-r--r-- | tests/reset/soft.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/reset/soft.c b/tests/reset/soft.c index bd6fcc205..f5501ac5f 100644 --- a/tests/reset/soft.c +++ b/tests/reset/soft.c @@ -26,8 +26,7 @@ static void assert_reset_soft(bool should_be_detached) cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD")); cl_git_fail(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO)); - - retrieve_target_from_oid(&target, repo, KNOWN_COMMIT_IN_BARE_REPO); + cl_git_pass(git_revparse_single(&target, repo, KNOWN_COMMIT_IN_BARE_REPO)); cl_assert(git_repository_head_detached(repo) == should_be_detached); @@ -60,7 +59,7 @@ void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_ch git_oid_fmt(raw_head_oid, &oid); raw_head_oid[GIT_OID_HEXSZ] = '\0'; - retrieve_target_from_oid(&target, repo, raw_head_oid); + cl_git_pass(git_revparse_single(&target, repo, raw_head_oid)); cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT)); @@ -73,7 +72,7 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void git_oid oid; /* b25fa35 is a tag, pointing to another tag which points to commit e90810b */ - retrieve_target_from_oid(&target, repo, "b25fa35b38051e4ae45d4222e795f9df2e43f1d1"); + cl_git_pass(git_revparse_single(&target, repo, "b25fa35")); cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT)); @@ -85,13 +84,13 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void void test_reset_soft__cannot_reset_to_a_tag_not_pointing_at_a_commit(void) { /* 53fc32d is the tree of commit e90810b */ - retrieve_target_from_oid(&target, repo, "53fc32d17276939fc79ed05badaef2db09990016"); + cl_git_pass(git_revparse_single(&target, repo, "53fc32d")); cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT)); git_object_free(target); /* 521d87c is an annotated tag pointing to a blob */ - retrieve_target_from_oid(&target, repo, "521d87c1ec3aef9824daf6d96cc0ae3710766d91"); + cl_git_pass(git_revparse_single(&target, repo, "521d87c")); cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT)); } @@ -99,7 +98,7 @@ void test_reset_soft__resetting_against_an_unborn_head_repo_makes_the_head_no_lo { git_reference *head; - retrieve_target_from_oid(&target, repo, KNOWN_COMMIT_IN_BARE_REPO); + cl_git_pass(git_revparse_single(&target, repo, KNOWN_COMMIT_IN_BARE_REPO)); make_head_unborn(repo, NON_EXISTING_HEAD); @@ -123,7 +122,7 @@ void test_reset_soft__fails_when_merging(void) cl_git_pass(git_buf_joinpath(&merge_head_path, git_repository_path(repo), "MERGE_HEAD")); cl_git_mkfile(git_buf_cstr(&merge_head_path), "beefbeefbeefbeefbeefbeefbeefbeefbeefbeef\n"); - retrieve_target_from_oid(&target, repo, KNOWN_COMMIT_IN_BARE_REPO); + cl_git_pass(git_revparse_single(&target, repo, KNOWN_COMMIT_IN_BARE_REPO)); cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT)); cl_git_pass(p_unlink(git_buf_cstr(&merge_head_path))); |
