diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-01-15 16:50:31 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-03-03 14:40:50 +0100 |
commit | 4e498646b6e4f3e6303cd3a27682dcd10d97eaeb (patch) | |
tree | cab3a87c8845f549d9355a505df665a57ed4f4b3 /tests | |
parent | 412a3808889de65d8f94f22502aba10b9afbf755 (diff) | |
download | libgit2-4e498646b6e4f3e6303cd3a27682dcd10d97eaeb.tar.gz |
repository: remove log message override for switching the active branch
We want to use the "checkout: moving from ..." message in order to let
git know when a change of branch has happened. Make the convenience
functions for this goal write this message.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/checkout/crlf.c | 2 | ||||
-rw-r--r-- | tests/checkout/tree.c | 28 | ||||
-rw-r--r-- | tests/checkout/typechange.c | 4 | ||||
-rw-r--r-- | tests/clone/nonetwork.c | 2 | ||||
-rw-r--r-- | tests/network/remote/defaultbranch.c | 6 | ||||
-rw-r--r-- | tests/perf/helper__perf__do_merge.c | 3 | ||||
-rw-r--r-- | tests/rebase/setup.c | 2 | ||||
-rw-r--r-- | tests/refs/branches/delete.c | 2 | ||||
-rw-r--r-- | tests/repo/head.c | 78 | ||||
-rw-r--r-- | tests/repo/headtree.c | 2 | ||||
-rw-r--r-- | tests/repo/state.c | 2 | ||||
-rw-r--r-- | tests/reset/soft.c | 4 | ||||
-rw-r--r-- | tests/stash/save.c | 2 | ||||
-rw-r--r-- | tests/status/submodules.c | 2 | ||||
-rw-r--r-- | tests/submodule/init.c | 2 | ||||
-rw-r--r-- | tests/submodule/update.c | 6 |
16 files changed, 66 insertions, 81 deletions
diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c index 9d098a786..a7a579eaa 100644 --- a/tests/checkout/crlf.c +++ b/tests/checkout/crlf.c @@ -113,7 +113,7 @@ void test_checkout_crlf__detect_crlf_autocrlf_true_utf8(void) cl_repo_set_bool(g_repo, "core.autocrlf", true); - git_repository_set_head(g_repo, "refs/heads/utf8", NULL); + git_repository_set_head(g_repo, "refs/heads/utf8"); git_checkout_head(g_repo, &opts); if (GIT_EOL_NATIVE == GIT_EOL_LF) diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c index 96208868f..7d4c784a1 100644 --- a/tests/checkout/tree.c +++ b/tests/checkout/tree.c @@ -63,7 +63,7 @@ void test_checkout_tree__can_checkout_and_remove_directory(void) cl_git_pass(git_revparse_single(&g_object, g_repo, "subtrees")); cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees")); cl_assert_equal_i(true, git_path_isdir("./testrepo/ab/")); cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/2.txt")); @@ -78,7 +78,7 @@ void test_checkout_tree__can_checkout_and_remove_directory(void) cl_git_pass(git_revparse_single(&g_object, g_repo, "master")); cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/master", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/master")); /* This directory should no longer exist */ cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/")); @@ -163,7 +163,7 @@ void test_checkout_tree__can_switch_branches(void) cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir")); cl_assert(git_path_isfile("testrepo/README")); cl_assert(git_path_isfile("testrepo/branch_file.txt")); @@ -183,7 +183,7 @@ void test_checkout_tree__can_switch_branches(void) cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees")); cl_assert(git_path_isfile("testrepo/README")); cl_assert(git_path_isfile("testrepo/branch_file.txt")); @@ -253,7 +253,7 @@ static int checkout_tree_with_blob_ignored_in_workdir(int strategy, bool isdir) cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir")); cl_assert(git_path_isfile("testrepo/README")); cl_assert(git_path_isfile("testrepo/branch_file.txt")); @@ -313,7 +313,7 @@ void test_checkout_tree__can_overwrite_ignored_by_default(void) { cl_git_pass(checkout_tree_with_blob_ignored_in_workdir(GIT_CHECKOUT_SAFE, false)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees")); cl_assert(git_path_isfile("testrepo/ab/4.txt")); @@ -334,7 +334,7 @@ void test_checkout_tree__can_overwrite_ignored_folder_by_default(void) { cl_git_pass(checkout_tree_with_blob_ignored_in_workdir(GIT_CHECKOUT_SAFE, true)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees")); cl_assert(git_path_isfile("testrepo/ab/4.txt")); @@ -367,7 +367,7 @@ void test_checkout_tree__can_update_only(void) cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir")); assert_on_branch(g_repo, "dir"); @@ -396,7 +396,7 @@ void test_checkout_tree__can_checkout_with_pattern(void) cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts)); cl_git_pass( - git_repository_set_head_detached(g_repo, git_object_id(g_object), NULL)); + git_repository_set_head_detached(g_repo, git_object_id(g_object))); git_object_free(g_object); g_object = NULL; @@ -435,7 +435,7 @@ void test_checkout_tree__can_disable_pattern_match(void) cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts)); cl_git_pass( - git_repository_set_head_detached(g_repo, git_object_id(g_object), NULL)); + git_repository_set_head_detached(g_repo, git_object_id(g_object))); git_object_free(g_object); g_object = NULL; @@ -677,7 +677,7 @@ void test_checkout_tree__can_checkout_with_last_workdir_item_missing(void) cl_git_pass(git_commit_lookup(&commit, g_repo, &commit_id)); cl_git_pass(git_checkout_tree(g_repo, (git_object *)commit, &opts)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/master", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/master")); cl_git_pass(p_mkdir("./testrepo/this-is-dir", 0777)); cl_git_mkfile("./testrepo/this-is-dir/contained_file", "content\n"); @@ -1049,7 +1049,7 @@ void test_checkout_tree__case_changing_rename(void) cl_git_pass(git_commit_lookup(&dir_commit, g_repo, &dir_commit_id)); cl_git_pass(git_checkout_tree(g_repo, (git_object *)dir_commit, &opts)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir")); cl_assert(git_path_isfile("testrepo/README")); case_sensitive = !git_path_isfile("testrepo/readme"); @@ -1086,7 +1086,7 @@ void test_checkout_tree__case_changing_rename(void) cl_git_pass(git_commit_lookup(&master_commit, g_repo, &master_id)); cl_git_pass(git_checkout_tree(g_repo, (git_object *)master_commit, &opts)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/master", NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/master")); assert_on_branch(g_repo, "master"); @@ -1285,7 +1285,7 @@ void test_checkout_tree__safe_proceeds_if_no_index(void) cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); - cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees", NULL, NULL)); + cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees")); cl_assert(git_path_isfile("testrepo/README")); cl_assert(git_path_isfile("testrepo/branch_file.txt")); diff --git a/tests/checkout/typechange.c b/tests/checkout/typechange.c index 330341846..b4959a351 100644 --- a/tests/checkout/typechange.c +++ b/tests/checkout/typechange.c @@ -122,7 +122,7 @@ void test_checkout_typechange__checkout_typechanges_safe(void) cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); cl_git_pass( - git_repository_set_head_detached(g_repo, git_object_id(obj), NULL)); + git_repository_set_head_detached(g_repo, git_object_id(obj))); assert_workdir_matches_tree(g_repo, git_object_id(obj), NULL, true); @@ -231,7 +231,7 @@ void test_checkout_typechange__checkout_with_conflicts(void) cl_assert(!git_path_exists("typechanges/untracked")); cl_git_pass( - git_repository_set_head_detached(g_repo, git_object_id(obj), NULL)); + git_repository_set_head_detached(g_repo, git_object_id(obj))); assert_workdir_matches_tree(g_repo, git_object_id(obj), NULL, true); diff --git a/tests/clone/nonetwork.c b/tests/clone/nonetwork.c index f62966247..46b36ed92 100644 --- a/tests/clone/nonetwork.c +++ b/tests/clone/nonetwork.c @@ -230,7 +230,7 @@ void test_clone_nonetwork__can_detached_head(void) cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options)); cl_git_pass(git_revparse_single(&obj, g_repo, "master~1")); - cl_git_pass(git_repository_set_head_detached(g_repo, git_object_id(obj), NULL)); + cl_git_pass(git_repository_set_head_detached(g_repo, git_object_id(obj))); cl_git_pass(git_clone(&cloned, "./foo", "./foo1", &g_options)); diff --git a/tests/network/remote/defaultbranch.c b/tests/network/remote/defaultbranch.c index 293a860d9..c83d5c8b0 100644 --- a/tests/network/remote/defaultbranch.c +++ b/tests/network/remote/defaultbranch.c @@ -39,13 +39,13 @@ void test_network_remote_defaultbranch__master(void) void test_network_remote_defaultbranch__master_does_not_win(void) { - cl_git_pass(git_repository_set_head(g_repo_a, "refs/heads/not-good", NULL)); + cl_git_pass(git_repository_set_head(g_repo_a, "refs/heads/not-good")); assert_default_branch("refs/heads/not-good"); } void test_network_remote_defaultbranch__master_on_detached(void) { - cl_git_pass(git_repository_detach_head(g_repo_a, NULL)); + cl_git_pass(git_repository_detach_head(g_repo_a)); assert_default_branch("refs/heads/master"); } @@ -74,7 +74,7 @@ void test_network_remote_defaultbranch__detached_sharing_nonbranch_id(void) git_repository *cloned_repo; cl_git_pass(git_reference_name_to_id(&id, g_repo_a, "HEAD")); - cl_git_pass(git_repository_detach_head(g_repo_a, NULL)); + cl_git_pass(git_repository_detach_head(g_repo_a)); cl_git_pass(git_reference_remove(g_repo_a, "refs/heads/master")); cl_git_pass(git_reference_remove(g_repo_a, "refs/heads/not-good")); cl_git_pass(git_reference_create(&ref, g_repo_a, "refs/foo/bar", &id, 1, NULL)); diff --git a/tests/perf/helper__perf__do_merge.c b/tests/perf/helper__perf__do_merge.c index 10f726c8b..c77b46a1f 100644 --- a/tests/perf/helper__perf__do_merge.c +++ b/tests/perf/helper__perf__do_merge.c @@ -43,8 +43,7 @@ void perf__do_merge(const char *fixture, cl_git_pass(git_checkout_tree(g_repo, (git_object*)commit_a, &checkout_opts)); perf__timer__stop(&t_checkout); - cl_git_pass(git_repository_set_head(g_repo, - git_reference_name(ref_branch_a), NULL)); + cl_git_pass(git_repository_set_head(g_repo, git_reference_name(ref_branch_a))); git_oid_fromstr(&oid_b, id_b); cl_git_pass(git_commit_lookup(&commit_b, g_repo, &oid_b)); diff --git a/tests/rebase/setup.c b/tests/rebase/setup.c index 93dc7ad47..627d3b9de 100644 --- a/tests/rebase/setup.c +++ b/tests/rebase/setup.c @@ -308,7 +308,7 @@ void test_rebase_setup__merge_null_branch_uses_HEAD(void) cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo)); - cl_git_pass(git_repository_set_head(repo, "refs/heads/beef", NULL)); + cl_git_pass(git_repository_set_head(repo, "refs/heads/beef")); cl_git_pass(git_checkout_head(repo, &checkout_opts)); cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master")); diff --git a/tests/refs/branches/delete.c b/tests/refs/branches/delete.c index c52c45b24..343ff0f50 100644 --- a/tests/refs/branches/delete.c +++ b/tests/refs/branches/delete.c @@ -75,7 +75,7 @@ void test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD( git_reference_free(head); /* Detach HEAD and make it target the commit that "master" points to */ - git_repository_detach_head(repo, NULL); + git_repository_detach_head(repo); cl_git_pass(git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL)); cl_git_pass(git_branch_delete(branch)); diff --git a/tests/repo/head.c b/tests/repo/head.c index b838ff565..b26d6acc7 100644 --- a/tests/repo/head.c +++ b/tests/repo/head.c @@ -38,8 +38,8 @@ void test_repo_head__head_detached(void) cl_assert_equal_i(false, git_repository_head_detached(repo)); - cl_git_pass(git_repository_detach_head(repo, "CABLE DETACHED")); - check_last_reflog_entry(g_email, "CABLE DETACHED"); + cl_git_pass(git_repository_detach_head(repo)); + check_last_reflog_entry(g_email, "checkout: moving from master to a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); cl_assert_equal_i(true, git_repository_head_detached(repo)); /* take the repo back to it's original state */ @@ -73,7 +73,7 @@ void test_repo_head__set_head_Attaches_HEAD_to_un_unborn_branch_when_the_branch_ { git_reference *head; - cl_git_pass(git_repository_set_head(repo, "refs/heads/doesnt/exist/yet", NULL)); + cl_git_pass(git_repository_set_head(repo, "refs/heads/doesnt/exist/yet")); cl_assert_equal_i(false, git_repository_head_detached(repo)); @@ -82,19 +82,19 @@ void test_repo_head__set_head_Attaches_HEAD_to_un_unborn_branch_when_the_branch_ void test_repo_head__set_head_Returns_ENOTFOUND_when_the_reference_doesnt_exist(void) { - cl_assert_equal_i(GIT_ENOTFOUND, git_repository_set_head(repo, "refs/tags/doesnt/exist/yet", NULL)); + cl_assert_equal_i(GIT_ENOTFOUND, git_repository_set_head(repo, "refs/tags/doesnt/exist/yet")); } void test_repo_head__set_head_Fails_when_the_reference_points_to_a_non_commitish(void) { - cl_git_fail(git_repository_set_head(repo, "refs/tags/point_to_blob", NULL)); + cl_git_fail(git_repository_set_head(repo, "refs/tags/point_to_blob")); } void test_repo_head__set_head_Attaches_HEAD_when_the_reference_points_to_a_branch(void) { git_reference *head; - cl_git_pass(git_repository_set_head(repo, "refs/heads/br2", NULL)); + cl_git_pass(git_repository_set_head(repo, "refs/heads/br2")); cl_assert_equal_i(false, git_repository_head_detached(repo)); @@ -121,7 +121,7 @@ static void assert_head_is_correctly_detached(void) void test_repo_head__set_head_Detaches_HEAD_when_the_reference_doesnt_point_to_a_branch(void) { - cl_git_pass(git_repository_set_head(repo, "refs/tags/test", NULL)); + cl_git_pass(git_repository_set_head(repo, "refs/tags/test")); cl_assert_equal_i(true, git_repository_head_detached(repo)); @@ -134,7 +134,7 @@ void test_repo_head__set_head_detached_Return_ENOTFOUND_when_the_object_doesnt_e cl_git_pass(git_oid_fromstr(&oid, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef")); - cl_assert_equal_i(GIT_ENOTFOUND, git_repository_set_head_detached(repo, &oid, NULL)); + cl_assert_equal_i(GIT_ENOTFOUND, git_repository_set_head_detached(repo, &oid)); } void test_repo_head__set_head_detached_Fails_when_the_object_isnt_a_commitish(void) @@ -143,7 +143,7 @@ void test_repo_head__set_head_detached_Fails_when_the_object_isnt_a_commitish(vo cl_git_pass(git_revparse_single(&blob, repo, "point_to_blob")); - cl_git_fail(git_repository_set_head_detached(repo, git_object_id(blob), NULL)); + cl_git_fail(git_repository_set_head_detached(repo, git_object_id(blob))); git_object_free(blob); } @@ -155,7 +155,7 @@ void test_repo_head__set_head_detached_Detaches_HEAD_and_make_it_point_to_the_pe cl_git_pass(git_revparse_single(&tag, repo, "tags/test")); cl_assert_equal_i(GIT_OBJ_TAG, git_object_type(tag)); - cl_git_pass(git_repository_set_head_detached(repo, git_object_id(tag), NULL)); + cl_git_pass(git_repository_set_head_detached(repo, git_object_id(tag))); assert_head_is_correctly_detached(); @@ -166,7 +166,7 @@ void test_repo_head__detach_head_Detaches_HEAD_and_make_it_point_to_the_peeled_c { cl_assert_equal_i(false, git_repository_head_detached(repo)); - cl_git_pass(git_repository_detach_head(repo, NULL)); + cl_git_pass(git_repository_detach_head(repo)); assert_head_is_correctly_detached(); } @@ -177,7 +177,7 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, "refs/tags/point_to_blob", 1, NULL)); - cl_git_fail(git_repository_detach_head(repo, NULL)); + cl_git_fail(git_repository_detach_head(repo)); git_reference_free(head); } @@ -186,7 +186,7 @@ void test_repo_head__detaching_an_unborn_branch_returns_GIT_EUNBORNBRANCH(void) { make_head_unborn(repo, NON_EXISTING_HEAD); - cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_detach_head(repo, NULL)); + cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_detach_head(repo)); } void test_repo_head__retrieving_an_unborn_branch_returns_GIT_EUNBORNBRANCH(void) @@ -254,15 +254,15 @@ void test_repo_head__setting_head_updates_reflog(void) cl_git_pass(git_signature_now(&sig, "me", "foo@example.com")); - cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", "message1")); - cl_git_pass(git_repository_set_head(repo, "refs/heads/unborn", "message2")); + 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),"message3")); - cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", "message4")); + 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", "foo@example.com", "message1"); - test_reflog(repo, 1, NULL, "tags/test^{commit}", "foo@example.com", "message3"); - test_reflog(repo, 0, "tags/test^{commit}", "refs/heads/haacked", "foo@example.com", "message4"); + test_reflog(repo, 2, NULL, "refs/heads/haacked", "foo@example.com", "checkout: moving from master to haacked"); + test_reflog(repo, 1, NULL, "tags/test^{commit}", "foo@example.com", "checkout: moving from unborn to e90810b8df3e80c413d903f631643c716887138d"); + test_reflog(repo, 0, "tags/test^{commit}", "refs/heads/haacked", "foo@example.com", "checkout: moving from e90810b8df3e80c413d903f631643c716887138d to haacked"); git_object_free(tag); git_signature_free(sig); @@ -297,14 +297,14 @@ void test_repo_head__detaching_writes_reflog(void) cl_git_pass(git_signature_now(&sig, "me", "foo@example.com")); - msg = "message1"; + msg = "checkout: moving from master to e90810b8df3e80c413d903f631643c716887138d"; git_oid_fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d"); - cl_git_pass(git_repository_set_head_detached(repo, &id, msg)); + cl_git_pass(git_repository_set_head_detached(repo, &id)); assert_head_reflog(repo, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "e90810b8df3e80c413d903f631643c716887138d", msg); - msg = "message2"; - cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", msg)); + msg = "checkout: moving from e90810b8df3e80c413d903f631643c716887138d to haacked"; + cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked")); assert_head_reflog(repo, 0, "e90810b8df3e80c413d903f631643c716887138d", "258f0e2a959a364e40ed6603d5d44fbb24765b10", msg); @@ -313,37 +313,30 @@ void test_repo_head__detaching_writes_reflog(void) void test_repo_head__orphan_branch_does_not_count(void) { - git_signature *sig; git_oid id; const char *msg; - cl_git_pass(git_signature_now(&sig, "me", "foo@example.com")); - /* Have something known */ - msg = "message1"; + msg = "checkout: moving from master to e90810b8df3e80c413d903f631643c716887138d"; git_oid_fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d"); - cl_git_pass(git_repository_set_head_detached(repo, &id, msg)); + cl_git_pass(git_repository_set_head_detached(repo, &id)); assert_head_reflog(repo, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "e90810b8df3e80c413d903f631643c716887138d", msg); /* Switching to an orphan branch does not write tot he reflog */ - cl_git_pass(git_repository_set_head(repo, "refs/heads/orphan", "ignored message")); + cl_git_pass(git_repository_set_head(repo, "refs/heads/orphan")); assert_head_reflog(repo, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "e90810b8df3e80c413d903f631643c716887138d", msg); /* And coming back, we set the source to zero */ - msg = "message2"; - cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", msg)); + msg = "checkout: moving from orphan to haacked"; + cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked")); assert_head_reflog(repo, 0, "0000000000000000000000000000000000000000", "258f0e2a959a364e40ed6603d5d44fbb24765b10", msg); - - git_signature_free(sig); } void test_repo_head__set_to_current_target(void) { - git_signature *sig; - const char *msg; git_reflog *log; size_t nentries, nentries_after; @@ -351,20 +344,14 @@ void test_repo_head__set_to_current_target(void) nentries = git_reflog_entrycount(log); git_reflog_free(log); - cl_git_pass(git_signature_now(&sig, "me", "foo@example.com")); - - msg = "message 1"; - cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", msg)); - cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", msg)); + cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked")); + cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked")); cl_git_pass(git_reflog_read(&log, repo, GIT_HEAD_FILE)); nentries_after = git_reflog_entrycount(log); git_reflog_free(log); cl_assert_equal_i(nentries + 1, nentries_after); - - git_signature_free(sig); - } void test_repo_head__branch_birth(void) @@ -387,8 +374,7 @@ void test_repo_head__branch_birth(void) cl_git_pass(git_reference_peel((git_object **) &tree, ref, GIT_OBJ_TREE)); git_reference_free(ref); - msg = "message 1"; - cl_git_pass(git_repository_set_head(repo, "refs/heads/orphan", msg)); + cl_git_pass(git_repository_set_head(repo, "refs/heads/orphan")); cl_git_pass(git_reflog_read(&log, repo, GIT_HEAD_FILE)); nentries_after = git_reflog_entrycount(log); diff --git a/tests/repo/headtree.c b/tests/repo/headtree.c index e8721b7a3..e899ac399 100644 --- a/tests/repo/headtree.c +++ b/tests/repo/headtree.c @@ -20,7 +20,7 @@ void test_repo_headtree__cleanup(void) void test_repo_headtree__can_retrieve_the_root_tree_from_a_detached_head(void) { - cl_git_pass(git_repository_detach_head(repo, NULL)); + cl_git_pass(git_repository_detach_head(repo)); cl_git_pass(git_repository_head_tree(&tree, repo)); diff --git a/tests/repo/state.c b/tests/repo/state.c index 8e03f5bc3..bf2633c17 100644 --- a/tests/repo/state.c +++ b/tests/repo/state.c @@ -37,7 +37,7 @@ void test_repo_state__none_with_HEAD_attached(void) void test_repo_state__none_with_HEAD_detached(void) { - cl_git_pass(git_repository_detach_head(_repo, NULL)); + cl_git_pass(git_repository_detach_head(_repo)); assert_repo_state(GIT_REPOSITORY_STATE_NONE); } diff --git a/tests/reset/soft.c b/tests/reset/soft.c index f7ae59b3e..a5bb13cc8 100644 --- a/tests/reset/soft.c +++ b/tests/reset/soft.c @@ -45,7 +45,7 @@ void test_reset_soft__can_reset_the_non_detached_Head_to_the_specified_commit(vo void test_reset_soft__can_reset_the_detached_Head_to_the_specified_commit(void) { - git_repository_detach_head(repo, NULL); + git_repository_detach_head(repo); assert_reset_soft(true); } @@ -118,7 +118,7 @@ void test_reset_soft__fails_when_merging(void) { git_buf merge_head_path = GIT_BUF_INIT; - cl_git_pass(git_repository_detach_head(repo, NULL)); + cl_git_pass(git_repository_detach_head(repo)); 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"); diff --git a/tests/stash/save.c b/tests/stash/save.c index cdf0838ea..78eee4a04 100644 --- a/tests/stash/save.c +++ b/tests/stash/save.c @@ -217,7 +217,7 @@ void test_stash_save__cannot_stash_against_a_bare_repository(void) void test_stash_save__can_stash_against_a_detached_head(void) { - git_repository_detach_head(repo, NULL); + git_repository_detach_head(repo); cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT)); diff --git a/tests/status/submodules.c b/tests/status/submodules.c index 7056c15ab..e6de60088 100644 --- a/tests/status/submodules.c +++ b/tests/status/submodules.c @@ -143,7 +143,7 @@ void test_status_submodules__moved_head(void) /* move submodule HEAD to c47800c7266a2be04c571c04d5a6614691ea99bd */ cl_git_pass( git_oid_fromstr(&oid, "c47800c7266a2be04c571c04d5a6614691ea99bd")); - cl_git_pass(git_repository_set_head_detached(smrepo, &oid, NULL)); + cl_git_pass(git_repository_set_head_detached(smrepo, &oid)); /* first do a normal status, which should now include the submodule */ diff --git a/tests/submodule/init.c b/tests/submodule/init.c index d12aa5731..3db6dae61 100644 --- a/tests/submodule/init.c +++ b/tests/submodule/init.c @@ -89,7 +89,7 @@ void test_submodule_init__relative_url_detached_head(void) cl_git_pass(git_repository_head(&head_ref, g_repo)); cl_git_pass(git_reference_peel(&head_commit, head_ref, GIT_OBJ_COMMIT)); - cl_git_pass(git_repository_set_head_detached(g_repo, git_commit_id((git_commit *)head_commit), NULL)); + cl_git_pass(git_repository_set_head_detached(g_repo, git_commit_id((git_commit *)head_commit))); cl_assert(git_path_dirname_r(&absolute_url, git_repository_workdir(g_repo)) > 0); cl_git_pass(git_buf_joinpath(&absolute_url, absolute_url.ptr, "testrepo.git")); diff --git a/tests/submodule/update.c b/tests/submodule/update.c index 803ba36de..533e64efc 100644 --- a/tests/submodule/update.c +++ b/tests/submodule/update.c @@ -196,7 +196,7 @@ void test_submodule_update__update_already_checked_out_submodule(void) cl_git_pass(git_reference_lookup(&branch_reference, g_repo, "refs/heads/alternate_1")); cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJ_COMMIT)); cl_git_pass(git_checkout_tree(g_repo, branch_commit, &checkout_options)); - cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference), NULL)); + cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference))); /* * Verify state after checkout of parent repository. The submodule ID in the @@ -270,7 +270,7 @@ void test_submodule_update__update_blocks_on_dirty_wd(void) cl_git_pass(git_reference_lookup(&branch_reference, g_repo, "refs/heads/alternate_1")); cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJ_COMMIT)); cl_git_pass(git_checkout_tree(g_repo, branch_commit, &checkout_options)); - cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference), NULL)); + cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference))); /* * Verify state after checkout of parent repository. The submodule ID in the @@ -343,7 +343,7 @@ void test_submodule_update__can_force_update(void) cl_git_pass(git_reference_lookup(&branch_reference, g_repo, "refs/heads/alternate_1")); cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJ_COMMIT)); cl_git_pass(git_checkout_tree(g_repo, branch_commit, &checkout_options)); - cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference), NULL)); + cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference))); /* * Verify state after checkout of parent repository. The submodule ID in the |