summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-11-03 14:48:31 -0500
committerEdward Thomson <ethomson@microsoft.com>2015-11-03 14:48:31 -0500
commit2d556f31665e9fde0310f4ae89cd3f01a5810b1c (patch)
treeeb33a1f74385b24651bb89264c3e58a40dba75cf
parentdb1edf91e9ba9e82e6534c445008703766b5a6da (diff)
downloadlibgit2-2d556f31665e9fde0310f4ae89cd3f01a5810b1c.tar.gz
reflog: test reflog is deleted when ref is deleted
-rw-r--r--tests/refs/reflog/reflog.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/refs/reflog/reflog.c b/tests/refs/reflog/reflog.c
index 3fbf412e4..ba40c76b8 100644
--- a/tests/refs/reflog/reflog.c
+++ b/tests/refs/reflog/reflog.c
@@ -125,6 +125,24 @@ void test_refs_reflog_reflog__renaming_the_reference_moves_the_reflog(void)
git_buf_free(&master_log_path);
}
+void test_refs_reflog_reflog__deleting_the_reference_deletes_the_reflog(void)
+{
+ git_reference *master;
+ git_buf master_log_path = GIT_BUF_INIT;
+
+ git_buf_joinpath(&master_log_path, git_repository_path(g_repo), GIT_REFLOG_DIR);
+ git_buf_joinpath(&master_log_path, git_buf_cstr(&master_log_path), "refs/heads/master");
+
+ cl_assert_equal_i(true, git_path_isfile(git_buf_cstr(&master_log_path)));
+
+ cl_git_pass(git_reference_lookup(&master, g_repo, "refs/heads/master"));
+ cl_git_pass(git_reference_delete(master));
+ git_reference_free(master);
+
+ cl_assert_equal_i(false, git_path_isfile(git_buf_cstr(&master_log_path)));
+ git_buf_free(&master_log_path);
+}
+
static void assert_has_reflog(bool expected_result, const char *name)
{
cl_assert_equal_i(expected_result, git_reference_has_log(g_repo, name));