summaryrefslogtreecommitdiff
path: root/tests-clar/refs
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-07-21 19:19:46 +0200
committernulltoken <emeric.fermas@gmail.com>2012-07-25 08:01:13 +0200
commitc3be5c5af089683b6c61d1d37d8c2c40ff48e9a8 (patch)
treeee2f7b8615da1c6f85a096ea09697c798a525f8b /tests-clar/refs
parent40c75652d075f87f20ddfbb715667f82644bc760 (diff)
downloadlibgit2-c3be5c5af089683b6c61d1d37d8c2c40ff48e9a8.tar.gz
reflog: keep the reflog name in sync with the reference name
Diffstat (limited to 'tests-clar/refs')
-rw-r--r--tests-clar/refs/reflog/reflog.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests-clar/refs/reflog/reflog.c b/tests-clar/refs/reflog/reflog.c
index ed3b31563..20f08f523 100644
--- a/tests-clar/refs/reflog/reflog.c
+++ b/tests-clar/refs/reflog/reflog.c
@@ -149,3 +149,24 @@ void test_refs_reflog_reflog__reading_the_reflog_from_a_reference_with_no_log_re
git_reference_free(subtrees);
git_buf_free(&subtrees_log_path);
}
+
+void test_refs_reflog_reflog__cannot_write_a_moved_reflog(void)
+{
+ git_reference *master;
+ git_buf master_log_path = GIT_BUF_INIT, moved_log_path = GIT_BUF_INIT;
+ git_reflog *reflog;
+
+ cl_git_pass(git_reference_lookup(&master, g_repo, "refs/heads/master"));
+ cl_git_pass(git_reflog_read(&reflog, master));
+
+ cl_git_pass(git_reflog_write(reflog));
+
+ cl_git_pass(git_reference_rename(master, "refs/moved", 0));
+
+ cl_git_fail(git_reflog_write(reflog));
+
+ git_reflog_free(reflog);
+ git_reference_free(master);
+ git_buf_free(&moved_log_path);
+ git_buf_free(&master_log_path);
+}