Skip to content

Commit 59ffb51

Browse files
authored
Merge pull request libgit2#4298 from tiennou/gather-reflog-messages-tests
Gather the reflog entry content tests
2 parents 54510cc + da635ed commit 59ffb51

File tree

10 files changed

+537
-523
lines changed

10 files changed

+537
-523
lines changed

tests/refs/branches/create.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -116,51 +116,6 @@ void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_E
116116
git_branch_create(&branch, repo, "inv@{id", target, 0));
117117
}
118118

119-
void test_refs_branches_create__default_reflog_message(void)
120-
{
121-
git_reflog *log;
122-
git_buf buf = GIT_BUF_INIT;
123-
const git_reflog_entry *entry;
124-
git_annotated_commit *annotated;
125-
git_signature *sig;
126-
git_config *cfg;
127-
128-
cl_git_pass(git_repository_config(&cfg, repo));
129-
cl_git_pass(git_config_set_string(cfg, "user.name", "Foo Bar"));
130-
cl_git_pass(git_config_set_string(cfg, "user.email", "foo@example.com"));
131-
git_config_free(cfg);
132-
133-
cl_git_pass(git_signature_default(&sig, repo));
134-
135-
retrieve_known_commit(&target, repo);
136-
cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false));
137-
cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME));
138-
139-
entry = git_reflog_entry_byindex(log, 0);
140-
cl_git_pass(git_buf_printf(&buf, "branch: Created from %s", git_oid_tostr_s(git_commit_id(target))));
141-
cl_assert_equal_s(git_buf_cstr(&buf), git_reflog_entry_message(entry));
142-
cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email);
143-
144-
cl_git_pass(git_reference_remove(repo, "refs/heads/" NEW_BRANCH_NAME));
145-
git_reference_free(branch);
146-
git_reflog_free(log);
147-
git_buf_clear(&buf);
148-
149-
cl_git_pass(git_annotated_commit_from_revspec(&annotated, repo, "e90810b8df3"));
150-
cl_git_pass(git_branch_create_from_annotated(&branch, repo, NEW_BRANCH_NAME, annotated, true));
151-
cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME));
152-
153-
entry = git_reflog_entry_byindex(log, 0);
154-
cl_git_pass(git_buf_printf(&buf, "branch: Created from e90810b8df3"));
155-
cl_assert_equal_s(git_buf_cstr(&buf), git_reflog_entry_message(entry));
156-
cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email);
157-
158-
git_annotated_commit_free(annotated);
159-
git_buf_free(&buf);
160-
git_reflog_free(log);
161-
git_signature_free(sig);
162-
}
163-
164119
static void assert_branch_matches_name(
165120
const char *expected, const char *lookup_as)
166121
{

tests/refs/branches/move.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -195,41 +195,6 @@ void test_refs_branches_move__moving_the_branch_pointed_at_by_HEAD_updates_HEAD(
195195
git_reference_free(branch);
196196
}
197197

198-
void test_refs_branches_move__default_reflog_message(void)
199-
{
200-
git_reference *branch;
201-
git_reference *new_branch;
202-
git_reflog *log;
203-
const git_reflog_entry *entry;
204-
git_signature *sig;
205-
git_config *cfg;
206-
git_oid id;
207-
208-
cl_git_pass(git_repository_config(&cfg, repo));
209-
cl_git_pass(git_config_set_string(cfg, "user.name", "Foo Bar"));
210-
cl_git_pass(git_config_set_string(cfg, "user.email", "foo@example.com"));
211-
git_config_free(cfg);
212-
213-
cl_git_pass(git_signature_default(&sig, repo));
214-
215-
cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master"));
216-
git_oid_cpy(&id, git_reference_target(branch));
217-
cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0));
218-
219-
cl_git_pass(git_reflog_read(&log, repo, git_reference_name(new_branch)));
220-
entry = git_reflog_entry_byindex(log, 0);
221-
cl_assert_equal_s("branch: renamed refs/heads/master to refs/heads/master2",
222-
git_reflog_entry_message(entry));
223-
cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email);
224-
cl_assert_equal_oid(&id, git_reflog_entry_id_old(entry));
225-
cl_assert_equal_oid(&id, git_reflog_entry_id_new(entry));
226-
227-
git_reference_free(branch);
228-
git_reference_free(new_branch);
229-
git_reflog_free(log);
230-
git_signature_free(sig);
231-
}
232-
233198
void test_refs_branches_move__can_move_with_unicode(void)
234199
{
235200
git_reference *original_ref, *new_ref;

tests/refs/createwithlog.c

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)