Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-01-07 15:23:05 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-03 16:40:50 +0300
commit659cf2029f322ea876d663d85783b48945227e8f (patch)
tree435e9185c38d96656e21db83fc736b5294499b10 /tests/reset
parent99b68a2aecfaa24f252f265d61b230b8e2576dd2 (diff)
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/reset')
-rw-r--r--tests/reset/hard.c14
-rw-r--r--tests/reset/mixed.c10
-rw-r--r--tests/reset/reset_helpers.c4
-rw-r--r--tests/reset/soft.c26
4 files changed, 27 insertions, 27 deletions
diff --git a/tests/reset/hard.c b/tests/reset/hard.c
index e8cf10071..c6bf7a8ac 100644
--- a/tests/reset/hard.c
+++ b/tests/reset/hard.c
@@ -71,7 +71,7 @@ void test_reset_hard__resetting_reverts_modified_files(void)
cl_git_pass(git_revparse_single(&target, repo, "26a125e"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
for (i = 0; i < 4; ++i) {
cl_git_pass(git_buf_joinpath(&path, wd, files[i]));
@@ -96,7 +96,7 @@ void test_reset_hard__cannot_reset_in_a_bare_repository(void)
cl_git_pass(git_revparse_single(&target, bare, KNOWN_COMMIT_IN_BARE_REPO));
- cl_assert_equal_i(GIT_EBAREREPO, git_reset(bare, target, GIT_RESET_HARD, NULL, NULL, NULL));
+ cl_assert_equal_i(GIT_EBAREREPO, git_reset(bare, target, GIT_RESET_HARD, NULL, NULL));
git_repository_free(bare);
}
@@ -152,7 +152,7 @@ void test_reset_hard__resetting_reverts_unmerged(void)
cl_git_pass(git_index_write(index));
cl_git_pass(git_revparse_single(&target, repo, "26a125e"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
cl_assert(git_path_exists("status/conflicting_file") == 0);
@@ -183,7 +183,7 @@ void test_reset_hard__cleans_up_merge(void)
cl_git_mkfile(git_buf_cstr(&orig_head_path), "0017bd4ab1ec30440b17bae1680cff124ab5f1f6");
cl_git_pass(git_revparse_single(&target, repo, "0017bd4"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
cl_assert(!git_path_exists(git_buf_cstr(&merge_head_path)));
cl_assert(!git_path_exists(git_buf_cstr(&merge_msg_path)));
@@ -208,7 +208,7 @@ void test_reset_hard__reflog_is_correct(void)
/* Branch not moving, no reflog entry */
cl_git_pass(git_revparse_single(&target, repo, "HEAD^{commit}"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
reflog_check(repo, "HEAD", 3, "emeric.fermas@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 3, "emeric.fermas@gmail.com", exp_msg);
@@ -217,7 +217,7 @@ void test_reset_hard__reflog_is_correct(void)
/* Moved branch, expect default message */
exp_msg = "reset: moving";
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
reflog_check(repo, "HEAD", 4, NULL, exp_msg);
reflog_check(repo, "refs/heads/master", 4, NULL, exp_msg);
@@ -226,7 +226,7 @@ void test_reset_hard__reflog_is_correct(void)
/* Moved branch, expect custom message */
exp_msg = "message1";
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL, "message1"));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, "message1"));
reflog_check(repo, "HEAD", 5, NULL, exp_msg);
reflog_check(repo, "refs/heads/master", 5, NULL, exp_msg);
}
diff --git a/tests/reset/mixed.c b/tests/reset/mixed.c
index cb7a44d5f..55b8a2f88 100644
--- a/tests/reset/mixed.c
+++ b/tests/reset/mixed.c
@@ -29,7 +29,7 @@ void test_reset_mixed__cannot_reset_in_a_bare_repository(void)
cl_git_pass(git_revparse_single(&target, bare, KNOWN_COMMIT_IN_BARE_REPO));
- cl_assert_equal_i(GIT_EBAREREPO, git_reset(bare, target, GIT_RESET_MIXED, NULL, NULL, NULL));
+ cl_assert_equal_i(GIT_EBAREREPO, git_reset(bare, target, GIT_RESET_MIXED, NULL, NULL));
git_repository_free(bare);
}
@@ -42,7 +42,7 @@ void test_reset_mixed__resetting_refreshes_the_index_to_the_commit_tree(void)
cl_assert(status == GIT_STATUS_CURRENT);
cl_git_pass(git_revparse_single(&target, repo, "605812a"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL));
cl_git_pass(git_status_file(&status, repo, "macro_bad"));
cl_assert(status == GIT_STATUS_WT_NEW);
@@ -57,7 +57,7 @@ void test_reset_mixed__reflog_is_correct(void)
/* Branch not moving, no reflog entry */
cl_git_pass(git_revparse_single(&target, repo, "HEAD^{commit}"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL));
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 9, "yoram.harmelin@gmail.com", exp_msg);
@@ -67,7 +67,7 @@ void test_reset_mixed__reflog_is_correct(void)
/* Moved branch, expect default message */
exp_msg = "reset: moving";
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL));
reflog_check(repo, "HEAD", 10, NULL, exp_msg);
reflog_check(repo, "refs/heads/master", 10, NULL, exp_msg);
@@ -77,7 +77,7 @@ void test_reset_mixed__reflog_is_correct(void)
/* Moved branch, expect custom message */
exp_msg = "message1";
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL, "message1"));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, "message1"));
reflog_check(repo, "HEAD", 11, NULL, exp_msg);
reflog_check(repo, "refs/heads/master", 11, NULL, exp_msg);
}
diff --git a/tests/reset/reset_helpers.c b/tests/reset/reset_helpers.c
index 7a335a600..ec67b8634 100644
--- a/tests/reset/reset_helpers.c
+++ b/tests/reset/reset_helpers.c
@@ -7,12 +7,12 @@ void reflog_check(git_repository *repo, const char *refname,
git_reflog *log;
const git_reflog_entry *entry;
+ exp_email = exp_email;
+
cl_git_pass(git_reflog_read(&log, repo, refname));
cl_assert_equal_i(exp_count, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
- if (exp_email)
- cl_assert_equal_s(exp_email, git_reflog_entry_committer(entry)->email);
if (exp_msg)
cl_assert_equal_s(exp_msg, git_reflog_entry_message(entry));
diff --git a/tests/reset/soft.c b/tests/reset/soft.c
index 95b86683a..8408da7a7 100644
--- a/tests/reset/soft.c
+++ b/tests/reset/soft.c
@@ -30,7 +30,7 @@ static void assert_reset_soft(bool should_be_detached)
cl_assert(git_repository_head_detached(repo) == should_be_detached);
- cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_assert(git_repository_head_detached(repo) == should_be_detached);
@@ -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, NULL);
+ git_repository_detach_head(repo, NULL);
assert_reset_soft(true);
}
@@ -61,7 +61,7 @@ void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_ch
cl_git_pass(git_revparse_single(&target, repo, raw_head_oid));
- cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
cl_git_pass(git_oid_streq(&oid, raw_head_oid));
@@ -74,7 +74,7 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void
/* b25fa35 is a tag, pointing to another tag which points to commit e90810b */
cl_git_pass(git_revparse_single(&target, repo, "b25fa35"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_assert(git_repository_head_detached(repo) == false);
cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
@@ -86,12 +86,12 @@ void test_reset_soft__cannot_reset_to_a_tag_not_pointing_at_a_commit(void)
/* 53fc32d is the tree of commit e90810b */
cl_git_pass(git_revparse_single(&target, repo, "53fc32d"));
- cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, NULL));
+ cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
git_object_free(target);
/* 521d87c is an annotated tag pointing to a blob */
cl_git_pass(git_revparse_single(&target, repo, "521d87c"));
- cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, NULL));
+ cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
}
void test_reset_soft__resetting_against_an_unborn_head_repo_makes_the_head_no_longer_unborn(void)
@@ -104,7 +104,7 @@ void test_reset_soft__resetting_against_an_unborn_head_repo_makes_the_head_no_lo
cl_assert_equal_i(true, git_repository_head_unborn(repo));
- cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_assert_equal_i(false, git_repository_head_unborn(repo));
@@ -118,13 +118,13 @@ 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, NULL));
+ cl_git_pass(git_repository_detach_head(repo, NULL));
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");
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, NULL, NULL, NULL));
+ cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_git_pass(p_unlink(git_buf_cstr(&merge_head_path)));
git_buf_free(&merge_head_path);
@@ -152,7 +152,7 @@ void test_reset_soft__fails_when_index_contains_conflicts_independently_of_MERGE
cl_git_pass(git_reference_peel(&target, head, GIT_OBJ_COMMIT));
git_reference_free(head);
- cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, NULL));
+ cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
}
void test_reset_soft_reflog_is_correct(void)
@@ -164,19 +164,19 @@ void test_reset_soft_reflog_is_correct(void)
/* Branch not moving, no reflog entry */
cl_git_pass(git_revparse_single(&target, repo, "HEAD^{commit}"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 9, "yoram.harmelin@gmail.com", exp_msg);
/* Moved branch, expect default message */
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, NULL));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 10, NULL, "reset: moving");
/* Moved branch, expect custom message */
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
- cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL, "message1"));
+ cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, "message1"));
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 11, NULL, "message1");
}