diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-01-07 12:23:05 +0000 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-03-03 14:40:50 +0100 |
commit | 659cf2029f322ea876d663d85783b48945227e8f (patch) | |
tree | 435e9185c38d96656e21db83fc736b5294499b10 /tests/rebase | |
parent | 99b68a2aecfaa24f252f265d61b230b8e2576dd2 (diff) | |
download | libgit2-659cf2029f322ea876d663d85783b48945227e8f.tar.gz |
Remove the signature from ref-modifying functions
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.
In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
Diffstat (limited to 'tests/rebase')
-rw-r--r-- | tests/rebase/abort.c | 16 | ||||
-rw-r--r-- | tests/rebase/iterator.c | 2 | ||||
-rw-r--r-- | tests/rebase/merge.c | 16 | ||||
-rw-r--r-- | tests/rebase/setup.c | 20 |
4 files changed, 23 insertions, 31 deletions
diff --git a/tests/rebase/abort.c b/tests/rebase/abort.c index 71326433f..24af2d140 100644 --- a/tests/rebase/abort.c +++ b/tests/rebase/abort.c @@ -23,14 +23,12 @@ static void test_abort(git_annotated_commit *branch, git_annotated_commit *onto) { git_rebase *rebase; git_reference *head_ref, *branch_ref = NULL; - git_signature *signature; git_status_list *statuslist; git_reflog *reflog; const git_reflog_entry *reflog_entry; cl_git_pass(git_rebase_open(&rebase, repo)); - cl_git_pass(git_signature_new(&signature, "Rebaser", "rebaser@example.com", 1404157834, -400)); - cl_git_pass(git_rebase_abort(rebase, signature)); + cl_git_pass(git_rebase_abort(rebase)); cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo)); @@ -60,7 +58,6 @@ static void test_abort(git_annotated_commit *branch, git_annotated_commit *onto) git_reflog_free(reflog); git_reference_free(head_ref); git_reference_free(branch_ref); - git_signature_free(signature); git_rebase_free(rebase); } @@ -68,7 +65,6 @@ void test_rebase_abort__merge(void) { git_rebase *rebase; git_reference *branch_ref, *onto_ref; - git_signature *signature; git_annotated_commit *branch_head, *onto_head; cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/beef")); @@ -77,15 +73,11 @@ void test_rebase_abort__merge(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&onto_head, repo, onto_ref)); - cl_git_pass(git_signature_new(&signature, "Rebaser", "rebaser@example.com", 1404157834, -400)); - - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, NULL)); cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); test_abort(branch_head, onto_head); - git_signature_free(signature); - git_annotated_commit_free(branch_head); git_annotated_commit_free(onto_head); @@ -110,7 +102,7 @@ void test_rebase_abort__detached_head(void) cl_git_pass(git_signature_new(&signature, "Rebaser", "rebaser@example.com", 1404157834, -400)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, NULL)); cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); test_abort(branch_head, onto_head); @@ -139,7 +131,7 @@ void test_rebase_abort__old_style_head_file(void) cl_git_pass(git_signature_new(&signature, "Rebaser", "rebaser@example.com", 1404157834, -400)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, NULL)); cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); p_rename("rebase-merge/.git/rebase-merge/orig-head", diff --git a/tests/rebase/iterator.c b/tests/rebase/iterator.c index 8117a094a..2cff82ced 100644 --- a/tests/rebase/iterator.c +++ b/tests/rebase/iterator.c @@ -64,7 +64,7 @@ void test_rebase_iterator__iterates(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); test_operations(rebase, 0); git_rebase_free(rebase); diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c index 1b2ec96bc..f820e96c6 100644 --- a/tests/rebase/merge.c +++ b/tests/rebase/merge.c @@ -53,7 +53,7 @@ void test_rebase_merge__next(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts)); @@ -120,7 +120,7 @@ void test_rebase_merge__next_with_conflicts(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts)); @@ -165,7 +165,7 @@ void test_rebase_merge__next_stops_with_iterover(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts)); cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, @@ -221,7 +221,7 @@ void test_rebase_merge__commit(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts)); cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, @@ -279,7 +279,7 @@ void test_rebase_merge__commit_updates_rewritten(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts)); cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, @@ -319,7 +319,7 @@ void test_rebase_merge__commit_drops_already_applied(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts)); cl_git_fail(error = git_rebase_commit(&commit_id, rebase, NULL, signature, @@ -362,7 +362,7 @@ void test_rebase_merge__finish(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts)); cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, @@ -433,7 +433,7 @@ static void test_copy_note( git_commit_id(branch_commit), "This is a commit note.", 0)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, opts)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, opts)); cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts)); cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, diff --git a/tests/rebase/setup.c b/tests/rebase/setup.c index f1eb6a47d..93dc7ad47 100644 --- a/tests/rebase/setup.c +++ b/tests/rebase/setup.c @@ -39,12 +39,12 @@ void test_rebase_setup__blocked_when_in_progress(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); git_rebase_free(rebase); cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); - cl_git_fail(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_fail(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); git_annotated_commit_free(branch_head); git_annotated_commit_free(upstream_head); @@ -70,7 +70,7 @@ void test_rebase_setup__merge(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); @@ -118,7 +118,7 @@ void test_rebase_setup__merge_root(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&onto_head, repo, onto_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, NULL)); git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); @@ -168,7 +168,7 @@ void test_rebase_setup__merge_onto_and_upstream(void) cl_git_pass(git_annotated_commit_from_ref(&branch2_head, repo, branch2_ref)); cl_git_pass(git_annotated_commit_from_ref(&onto_head, repo, onto_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch1_head, branch2_head, onto_head, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch1_head, branch2_head, onto_head, NULL)); git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); @@ -215,7 +215,7 @@ void test_rebase_setup__branch_with_merges(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); @@ -263,7 +263,7 @@ void test_rebase_setup__orphan_branch(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL)); cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); @@ -308,13 +308,13 @@ 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, NULL)); + cl_git_pass(git_repository_set_head(repo, "refs/heads/beef", NULL)); cl_git_pass(git_checkout_head(repo, &checkout_opts)); cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master")); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - cl_git_pass(git_rebase_init(&rebase, repo, NULL, upstream_head, NULL, signature, NULL)); + cl_git_pass(git_rebase_init(&rebase, repo, NULL, upstream_head, NULL, NULL)); cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); @@ -358,7 +358,7 @@ static int rebase_is_blocked(void) cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - error = git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL); + error = git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL); git_annotated_commit_free(branch_head); git_annotated_commit_free(upstream_head); |