From 6bfb990dc74c3749b356f82f7c9744b43fe90ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 7 Jan 2015 14:47:02 +0000 Subject: [PATCH] branch: don't accept a reflog message override This namespace is about behaving like git's branch command, so let's do exactly that instead of taking a reflog message. This override is still available via the reference namespace. --- include/git2/branch.h | 12 ++----- src/branch.c | 29 ++++++---------- src/clone.c | 6 +++- tests/checkout/tree.c | 6 ++-- tests/perf/helper__perf__do_merge.c | 4 +-- tests/refs/branches/create.c | 49 +++++++++----------------- tests/refs/branches/move.c | 53 ++++++++--------------------- tests/refs/branches/upstream.c | 2 +- tests/refs/revparse.c | 6 ++-- 9 files changed, 58 insertions(+), 109 deletions(-) diff --git a/include/git2/branch.h b/include/git2/branch.h index e45a36453..06f4d2c68 100644 --- a/include/git2/branch.h +++ b/include/git2/branch.h @@ -43,10 +43,6 @@ GIT_BEGIN_DECL * * @param force Overwrite existing branch. * - * @param log_message The one line long message to be appended to the reflog. - * If NULL, the default is "Branch: created"; if you want something more - * useful, provide a message. - * * @return 0, GIT_EINVALIDSPEC or an error code. * A proper reference is written in the refs/heads namespace * pointing to the provided target commit. @@ -56,8 +52,7 @@ GIT_EXTERN(int) git_branch_create( git_repository *repo, const char *branch_name, const git_commit *target, - int force, - const char *log_message); + int force); /** * Delete an existing branch reference. @@ -120,16 +115,13 @@ GIT_EXTERN(void) git_branch_iterator_free(git_branch_iterator *iter); * * @param force Overwrite existing branch. * - * @param log_message The one line long message to be appended to the reflog - * * @return 0 on success, GIT_EINVALIDSPEC or an error code. */ GIT_EXTERN(int) git_branch_move( git_reference **out, git_reference *branch, const char *new_branch_name, - int force, - const char *log_message); + int force); /** * Lookup a branch by its name in a repository. diff --git a/src/branch.c b/src/branch.c index 762a26211..4e9460f36 100644 --- a/src/branch.c +++ b/src/branch.c @@ -54,13 +54,12 @@ int git_branch_create( git_repository *repository, const char *branch_name, const git_commit *commit, - int force, - const char *log_message) + int force) { int is_head = 0; git_reference *branch = NULL; git_buf canonical_branch_name = GIT_BUF_INIT, - log_message_buf = GIT_BUF_INIT; + log_message = GIT_BUF_INIT; int error = -1; assert(branch_name && commit && ref_out); @@ -87,19 +86,19 @@ int git_branch_create( if (git_buf_joinpath(&canonical_branch_name, GIT_REFS_HEADS_DIR, branch_name) < 0) goto cleanup; - if (git_buf_sets(&log_message_buf, log_message ? log_message : "Branch: created") < 0) + if (git_buf_printf(&log_message, "Branch: created from %s", git_oid_tostr_s(git_commit_id(commit))) < 0) goto cleanup; error = git_reference_create(&branch, repository, git_buf_cstr(&canonical_branch_name), git_commit_id(commit), force, - git_buf_cstr(&log_message_buf)); + git_buf_cstr(&log_message)); if (!error) *ref_out = branch; cleanup: git_buf_free(&canonical_branch_name); - git_buf_free(&log_message_buf); + git_buf_free(&log_message); return error; } @@ -221,13 +220,12 @@ int git_branch_move( git_reference **out, git_reference *branch, const char *new_branch_name, - int force, - const char *log_message) + int force) { git_buf new_reference_name = GIT_BUF_INIT, old_config_section = GIT_BUF_INIT, new_config_section = GIT_BUF_INIT, - log_message_buf = GIT_BUF_INIT; + log_message = GIT_BUF_INIT; int error; assert(branch && new_branch_name); @@ -238,20 +236,15 @@ int git_branch_move( if ((error = git_buf_joinpath(&new_reference_name, GIT_REFS_HEADS_DIR, new_branch_name)) < 0) goto done; - if (log_message) { - if ((error = git_buf_sets(&log_message_buf, log_message)) < 0) + if ((error = git_buf_printf(&log_message, "Branch: renamed %s to %s", + git_reference_name(branch), git_buf_cstr(&new_reference_name))) < 0) goto done; - } else { - if ((error = git_buf_printf(&log_message_buf, "Branch: renamed %s to %s", - git_reference_name(branch), git_buf_cstr(&new_reference_name))) < 0) - goto done; - } /* first update ref then config so failure won't trash config */ error = git_reference_rename( out, branch, git_buf_cstr(&new_reference_name), force, - git_buf_cstr(&log_message_buf)); + git_buf_cstr(&log_message)); if (error < 0) goto done; @@ -268,7 +261,7 @@ done: git_buf_free(&new_reference_name); git_buf_free(&old_config_section); git_buf_free(&new_config_section); - git_buf_free(&log_message_buf); + git_buf_free(&log_message); return error; } diff --git a/src/clone.c b/src/clone.c index f7ae17c57..ac6a059dd 100644 --- a/src/clone.c +++ b/src/clone.c @@ -35,6 +35,7 @@ static int create_branch( { git_commit *head_obj = NULL; git_reference *branch_ref = NULL; + git_buf refname = GIT_BUF_INIT; int error; /* Find the target commit */ @@ -42,8 +43,11 @@ static int create_branch( return error; /* Create the new branch */ - error = git_branch_create(&branch_ref, repo, name, head_obj, 0, log_message); + if ((error = git_buf_printf(&refname, GIT_REFS_HEADS_DIR "%s", name)) < 0) + return error; + error = git_reference_create(&branch_ref, repo, git_buf_cstr(&refname), target, 0, log_message); + git_buf_free(&refname); git_commit_free(head_obj); if (!error) diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c index 97ef22b6e..96208868f 100644 --- a/tests/checkout/tree.c +++ b/tests/checkout/tree.c @@ -481,7 +481,7 @@ void assert_conflict( /* Create a branch pointing at the parent */ cl_git_pass(git_revparse_single(&g_object, g_repo, parent_sha)); cl_git_pass(git_branch_create(&branch, g_repo, - "potential_conflict", (git_commit *)g_object, 0, NULL)); + "potential_conflict", (git_commit *)g_object, 0)); /* Make HEAD point to this branch */ cl_git_pass(git_reference_symbolic_create( @@ -1201,7 +1201,7 @@ void test_checkout_tree__can_not_update_index(void) cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD")); cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJ_ANY)); - cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts, NULL)); + cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts)); cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/")); @@ -1238,7 +1238,7 @@ void test_checkout_tree__can_update_but_not_write_index(void) cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD")); cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJ_ANY)); - cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts, NULL)); + cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts)); cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/")); diff --git a/tests/perf/helper__perf__do_merge.c b/tests/perf/helper__perf__do_merge.c index 8ffd863af..10f726c8b 100644 --- a/tests/perf/helper__perf__do_merge.c +++ b/tests/perf/helper__perf__do_merge.c @@ -37,7 +37,7 @@ void perf__do_merge(const char *fixture, cl_git_pass(git_commit_lookup(&commit_a, g_repo, &oid_a)); cl_git_pass(git_branch_create(&ref_branch_a, g_repo, "A", commit_a, - 0, NULL)); + 0)); perf__timer__start(&t_checkout); cl_git_pass(git_checkout_tree(g_repo, (git_object*)commit_a, &checkout_opts)); @@ -50,7 +50,7 @@ void perf__do_merge(const char *fixture, cl_git_pass(git_commit_lookup(&commit_b, g_repo, &oid_b)); cl_git_pass(git_branch_create(&ref_branch_b, g_repo, "B", commit_b, - 0, NULL)); + 0)); cl_git_pass(git_annotated_commit_lookup(&annotated_commits[0], g_repo, &oid_b)); diff --git a/tests/refs/branches/create.c b/tests/refs/branches/create.c index 4d52c7720..dc805789f 100644 --- a/tests/refs/branches/create.c +++ b/tests/refs/branches/create.c @@ -45,7 +45,7 @@ void test_refs_branches_create__can_create_a_local_branch(void) { retrieve_known_commit(&target, repo); - cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, 0, NULL)); + cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, 0)); cl_git_pass(git_oid_cmp(git_reference_target(branch), git_commit_id(target))); } @@ -53,14 +53,14 @@ void test_refs_branches_create__can_not_create_a_branch_if_its_name_collide_with { retrieve_known_commit(&target, repo); - cl_assert_equal_i(GIT_EEXISTS, git_branch_create(&branch, repo, "br2", target, 0, NULL)); + cl_assert_equal_i(GIT_EEXISTS, git_branch_create(&branch, repo, "br2", target, 0)); } void test_refs_branches_create__can_force_create_over_an_existing_branch(void) { retrieve_known_commit(&target, repo); - cl_git_pass(git_branch_create(&branch, repo, "br2", target, 1, NULL)); + cl_git_pass(git_branch_create(&branch, repo, "br2", target, 1)); cl_git_pass(git_oid_cmp(git_reference_target(branch), git_commit_id(target))); cl_assert_equal_s("refs/heads/br2", git_reference_name(branch)); } @@ -76,7 +76,7 @@ void test_refs_branches_create__cannot_force_create_over_current_branch(void) cl_assert_equal_i(true, git_branch_is_head(branch2)); oid = git_reference_target(branch2); - cl_git_fail_with(-1, git_branch_create(&branch, repo, "master", target, 1, NULL)); + cl_git_fail_with(-1, git_branch_create(&branch, repo, "master", target, 1)); branch = NULL; cl_git_pass(git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL)); cl_assert_equal_s("refs/heads/master", git_reference_name(branch)); @@ -89,32 +89,13 @@ void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_E retrieve_known_commit(&target, repo); cl_assert_equal_i(GIT_EINVALIDSPEC, - git_branch_create(&branch, repo, "inv@{id", target, 0, NULL)); -} - -void test_refs_branches_create__creation_creates_new_reflog(void) -{ - git_reflog *log; - const git_reflog_entry *entry; - git_signature *sig; - - cl_git_pass(git_signature_now(&sig, "me", "foo@example.com")); - - retrieve_known_commit(&target, repo); - cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false, "create!")); - cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME)); - - cl_assert_equal_i(1, git_reflog_entrycount(log)); - entry = git_reflog_entry_byindex(log, 0); - cl_assert_equal_s("create!", git_reflog_entry_message(entry)); - - git_reflog_free(log); - git_signature_free(sig); + git_branch_create(&branch, repo, "inv@{id", target, 0)); } void test_refs_branches_create__default_reflog_message(void) { git_reflog *log; + git_buf buf = GIT_BUF_INIT; const git_reflog_entry *entry; git_signature *sig; git_config *cfg; @@ -127,13 +108,15 @@ void test_refs_branches_create__default_reflog_message(void) cl_git_pass(git_signature_default(&sig, repo)); retrieve_known_commit(&target, repo); - cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false, NULL)); + cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false)); cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME)); entry = git_reflog_entry_byindex(log, 0); - cl_assert_equal_s("Branch: created", git_reflog_entry_message(entry)); + cl_git_pass(git_buf_printf(&buf, "Branch: created from %s", git_oid_tostr_s(git_commit_id(target)))); + cl_assert_equal_s(git_buf_cstr(&buf), git_reflog_entry_message(entry)); cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email); + git_buf_free(&buf); git_reflog_free(log); git_signature_free(sig); } @@ -180,7 +163,7 @@ void test_refs_branches_create__can_create_branch_with_unicode(void) for (i = 0; i < ARRAY_SIZE(names); ++i) { const char *name; cl_git_pass(git_branch_create( - &branch, repo, names[i], target, 0, NULL)); + &branch, repo, names[i], target, 0)); cl_git_pass(git_oid_cmp( git_reference_target(branch), git_commit_id(target))); @@ -238,7 +221,7 @@ void test_refs_branches_create__name_vs_namespace(void) retrieve_known_commit(&target, repo); for (p=item; p->first; p++) { - cl_git_pass(git_branch_create(&branch, repo, p->first, target, 0, NULL)); + cl_git_pass(git_branch_create(&branch, repo, p->first, target, 0)); cl_git_pass(git_oid_cmp(git_reference_target(branch), git_commit_id(target))); cl_git_pass(git_branch_name(&name, branch)); cl_assert_equal_s(name, p->first); @@ -247,7 +230,7 @@ void test_refs_branches_create__name_vs_namespace(void) git_reference_free(branch); branch = NULL; - cl_git_pass(git_branch_create(&branch, repo, p->second, target, 0, NULL)); + cl_git_pass(git_branch_create(&branch, repo, p->second, target, 0)); git_reference_free(branch); branch = NULL; } @@ -276,7 +259,7 @@ void test_refs_branches_create__name_vs_namespace_fail(void) retrieve_known_commit(&target, repo); for (p=item; p->first; p++) { - cl_git_pass(git_branch_create(&branch, repo, p->first, target, 0, NULL)); + cl_git_pass(git_branch_create(&branch, repo, p->first, target, 0)); cl_git_pass(git_oid_cmp(git_reference_target(branch), git_commit_id(target))); cl_git_pass(git_branch_name(&name, branch)); cl_assert_equal_s(name, p->first); @@ -285,7 +268,7 @@ void test_refs_branches_create__name_vs_namespace_fail(void) git_reference_free(branch); branch = NULL; - cl_git_pass(git_branch_create(&branch, repo, p->first_alternate, target, 0, NULL)); + cl_git_pass(git_branch_create(&branch, repo, p->first_alternate, target, 0)); cl_git_pass(git_oid_cmp(git_reference_target(branch), git_commit_id(target))); cl_git_pass(git_branch_name(&name, branch)); cl_assert_equal_s(name, p->first_alternate); @@ -294,7 +277,7 @@ void test_refs_branches_create__name_vs_namespace_fail(void) git_reference_free(branch); branch = NULL; - cl_git_fail(git_branch_create(&branch, repo, p->second, target, 0, NULL)); + cl_git_fail(git_branch_create(&branch, repo, p->second, target, 0)); git_reference_free(branch); branch = NULL; } diff --git a/tests/refs/branches/move.c b/tests/refs/branches/move.c index b78daa2e4..c1d1ae396 100644 --- a/tests/refs/branches/move.c +++ b/tests/refs/branches/move.c @@ -22,7 +22,7 @@ void test_refs_branches_move__can_move_a_local_branch(void) cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2")); - cl_git_pass(git_branch_move(&new_ref, original_ref, NEW_BRANCH_NAME, 0, NULL)); + cl_git_pass(git_branch_move(&new_ref, original_ref, NEW_BRANCH_NAME, 0)); cl_assert_equal_s(GIT_REFS_HEADS_DIR NEW_BRANCH_NAME, git_reference_name(new_ref)); git_reference_free(original_ref); @@ -36,11 +36,11 @@ void test_refs_branches_move__can_move_a_local_branch_to_a_different_namespace(v cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2")); /* Downward */ - cl_git_pass(git_branch_move(&new_ref, original_ref, "somewhere/" NEW_BRANCH_NAME, 0, NULL)); + cl_git_pass(git_branch_move(&new_ref, original_ref, "somewhere/" NEW_BRANCH_NAME, 0)); git_reference_free(original_ref); /* Upward */ - cl_git_pass(git_branch_move(&newer_ref, new_ref, "br2", 0, NULL)); + cl_git_pass(git_branch_move(&newer_ref, new_ref, "br2", 0)); git_reference_free(new_ref); git_reference_free(newer_ref); @@ -53,11 +53,11 @@ void test_refs_branches_move__can_move_a_local_branch_to_a_partially_colliding_n cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2")); /* Downward */ - cl_git_pass(git_branch_move(&new_ref, original_ref, "br2/" NEW_BRANCH_NAME, 0, NULL)); + cl_git_pass(git_branch_move(&new_ref, original_ref, "br2/" NEW_BRANCH_NAME, 0)); git_reference_free(original_ref); /* Upward */ - cl_git_pass(git_branch_move(&newer_ref, new_ref, "br2", 0, NULL)); + cl_git_pass(git_branch_move(&newer_ref, new_ref, "br2", 0)); git_reference_free(new_ref); git_reference_free(newer_ref); @@ -81,7 +81,7 @@ void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_coll cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2")); cl_assert_equal_i(GIT_EEXISTS, - git_branch_move(&new_ref, original_ref, "master", 0, NULL)); + git_branch_move(&new_ref, original_ref, "master", 0)); cl_assert(giterr_last()->message != NULL); cl_git_pass(git_config_get_entry(&ce, config, "branch.master.remote")); @@ -91,7 +91,7 @@ void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_coll cl_assert_equal_i(GIT_EEXISTS, - git_branch_move(&new_ref, original_ref, "cannot-fetch", 0, NULL)); + git_branch_move(&new_ref, original_ref, "cannot-fetch", 0)); cl_assert(giterr_last()->message != NULL); cl_git_pass(git_config_get_entry(&ce, config, "branch.master.remote")); @@ -103,7 +103,7 @@ void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_coll cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/track-local")); cl_assert_equal_i(GIT_EEXISTS, - git_branch_move(&new_ref, original_ref, "master", 0, NULL)); + git_branch_move(&new_ref, original_ref, "master", 0)); cl_assert(giterr_last()->message != NULL); cl_git_pass(git_config_get_entry(&ce, config, "branch.master.remote")); @@ -122,7 +122,7 @@ void test_refs_branches_move__moving_a_branch_with_an_invalid_name_returns_EINVA cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2")); - cl_assert_equal_i(GIT_EINVALIDSPEC, git_branch_move(&new_ref, original_ref, "Inv@{id", 0, NULL)); + cl_assert_equal_i(GIT_EINVALIDSPEC, git_branch_move(&new_ref, original_ref, "Inv@{id", 0)); git_reference_free(original_ref); } @@ -132,7 +132,7 @@ void test_refs_branches_move__can_not_move_a_non_branch(void) git_reference *tag, *new_ref; cl_git_pass(git_reference_lookup(&tag, repo, "refs/tags/e90810b")); - cl_git_fail(git_branch_move(&new_ref, tag, NEW_BRANCH_NAME, 0, NULL)); + cl_git_fail(git_branch_move(&new_ref, tag, NEW_BRANCH_NAME, 0)); git_reference_free(tag); } @@ -143,7 +143,7 @@ void test_refs_branches_move__can_force_move_over_an_existing_branch(void) cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2")); - cl_git_pass(git_branch_move(&new_ref, original_ref, "master", 1, NULL)); + cl_git_pass(git_branch_move(&new_ref, original_ref, "master", 1)); git_reference_free(original_ref); git_reference_free(new_ref); @@ -161,7 +161,7 @@ void test_refs_branches_move__moving_a_branch_moves_related_configuration_data(v assert_config_entry_existence(repo, "branch.moved.remote", false); assert_config_entry_existence(repo, "branch.moved.merge", false); - cl_git_pass(git_branch_move(&new_branch, branch, "moved", 0, NULL)); + cl_git_pass(git_branch_move(&new_branch, branch, "moved", 0)); git_reference_free(branch); assert_config_entry_existence(repo, "branch.track-local.remote", false); @@ -178,7 +178,7 @@ void test_refs_branches_move__moving_the_branch_pointed_at_by_HEAD_updates_HEAD( git_reference *new_branch; cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master")); - cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0, NULL)); + cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0)); git_reference_free(branch); git_reference_free(new_branch); @@ -187,29 +187,6 @@ void test_refs_branches_move__moving_the_branch_pointed_at_by_HEAD_updates_HEAD( git_reference_free(branch); } -void test_refs_branches_move__updates_the_reflog(void) -{ - git_reference *branch; - git_reference *new_branch; - git_reflog *log; - const git_reflog_entry *entry; - git_signature *sig; - - cl_git_pass(git_signature_now(&sig, "me", "foo@example.com")); - - cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master")); - cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0, "message")); - - cl_git_pass(git_reflog_read(&log, repo, git_reference_name(new_branch))); - entry = git_reflog_entry_byindex(log, 0); - cl_assert_equal_s("message", git_reflog_entry_message(entry)); - - git_reference_free(branch); - git_reference_free(new_branch); - git_reflog_free(log); - git_signature_free(sig); -} - void test_refs_branches_move__default_reflog_message(void) { git_reference *branch; @@ -227,7 +204,7 @@ void test_refs_branches_move__default_reflog_message(void) cl_git_pass(git_signature_default(&sig, repo)); cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master")); - cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0, NULL)); + cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0)); cl_git_pass(git_reflog_read(&log, repo, git_reference_name(new_branch))); entry = git_reflog_entry_byindex(log, 0); @@ -247,7 +224,7 @@ void test_refs_branches_move__can_move_with_unicode(void) const char *new_branch_name = "\x41\xCC\x8A\x73\x74\x72\x6F\xCC\x88\x6D"; cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2")); - cl_git_pass(git_branch_move(&new_ref, original_ref, new_branch_name, 0, NULL)); + cl_git_pass(git_branch_move(&new_ref, original_ref, new_branch_name, 0)); if (cl_repo_get_bool(repo, "core.precomposeunicode")) cl_assert_equal_s(GIT_REFS_HEADS_DIR "\xC3\x85\x73\x74\x72\xC3\xB6\x6D", git_reference_name(new_ref)); diff --git a/tests/refs/branches/upstream.c b/tests/refs/branches/upstream.c index f0aef5578..f44f563a3 100644 --- a/tests/refs/branches/upstream.c +++ b/tests/refs/branches/upstream.c @@ -91,7 +91,7 @@ static void assert_merge_and_or_remote_key_missing(git_repository *repository, c git_reference *branch; cl_assert_equal_i(GIT_OBJ_COMMIT, git_object_type((git_object*)target)); - cl_git_pass(git_branch_create(&branch, repository, entry_name, (git_commit*)target, 0, NULL)); + cl_git_pass(git_branch_create(&branch, repository, entry_name, (git_commit*)target, 0)); cl_assert_equal_i(GIT_ENOTFOUND, git_branch_upstream(&upstream, branch)); diff --git a/tests/refs/revparse.c b/tests/refs/revparse.c index ad468bbbe..3f89b5f77 100644 --- a/tests/refs/revparse.c +++ b/tests/refs/revparse.c @@ -634,7 +634,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void) test_object_inrepo("blah-7-gc47800c", "c47800c7266a2be04c571c04d5a6614691ea99bd", repo); cl_git_pass(git_revparse_single(&target, repo, "HEAD~3")); - cl_git_pass(git_branch_create(&branch, repo, "blah-7-gc47800c", (git_commit *)target, 0, NULL)); + cl_git_pass(git_branch_create(&branch, repo, "blah-7-gc47800c", (git_commit *)target, 0)); git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target)); @@ -672,7 +672,7 @@ void test_refs_revparse__try_to_retrieve_sha_before_branch(void) test_object_inrepo("a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", repo); cl_git_pass(git_revparse_single(&target, repo, "HEAD~3")); - cl_git_pass(git_branch_create(&branch, repo, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", (git_commit *)target, 0, NULL)); + cl_git_pass(git_branch_create(&branch, repo, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", (git_commit *)target, 0)); git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target)); @@ -708,7 +708,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void) test_object_inrepo("c47800", "c47800c7266a2be04c571c04d5a6614691ea99bd", repo); cl_git_pass(git_revparse_single(&target, repo, "HEAD~3")); - cl_git_pass(git_branch_create(&branch, repo, "c47800", (git_commit *)target, 0, NULL)); + cl_git_pass(git_branch_create(&branch, repo, "c47800", (git_commit *)target, 0)); git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));