Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d556f3

Browse files
author
Edward Thomson
committed
reflog: test reflog is deleted when ref is deleted
1 parent db1edf9 commit 2d556f3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/refs/reflog/reflog.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,24 @@ void test_refs_reflog_reflog__renaming_the_reference_moves_the_reflog(void)
125125
git_buf_free(&master_log_path);
126126
}
127127

128+
void test_refs_reflog_reflog__deleting_the_reference_deletes_the_reflog(void)
129+
{
130+
git_reference *master;
131+
git_buf master_log_path = GIT_BUF_INIT;
132+
133+
git_buf_joinpath(&master_log_path, git_repository_path(g_repo), GIT_REFLOG_DIR);
134+
git_buf_joinpath(&master_log_path, git_buf_cstr(&master_log_path), "refs/heads/master");
135+
136+
cl_assert_equal_i(true, git_path_isfile(git_buf_cstr(&master_log_path)));
137+
138+
cl_git_pass(git_reference_lookup(&master, g_repo, "refs/heads/master"));
139+
cl_git_pass(git_reference_delete(master));
140+
git_reference_free(master);
141+
142+
cl_assert_equal_i(false, git_path_isfile(git_buf_cstr(&master_log_path)));
143+
git_buf_free(&master_log_path);
144+
}
145+
128146
static void assert_has_reflog(bool expected_result, const char *name)
129147
{
130148
cl_assert_equal_i(expected_result, git_reference_has_log(g_repo, name));

0 commit comments

Comments
 (0)