summaryrefslogtreecommitdiff
path: root/tests/refs/settargetwithlog.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-11-13 18:15:20 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2013-11-23 14:55:02 +0100
commita57dd3b7a46c9a2f87f203f1ab372fa28e10e571 (patch)
treece76f383edaa14bee45a687453223613c1c1ee9c /tests/refs/settargetwithlog.c
parent110df89317b56267b956574216d6611637860446 (diff)
downloadlibgit2-a57dd3b7a46c9a2f87f203f1ab372fa28e10e571.tar.gz
reflog: integrate into the ref writing
Whenever a reference is created or updated, we need to write to the reflog regardless of whether the user gave us a message, so we shouldn't leave that to the ref frontend, but integrate it into the backend. This also eliminates the race between ref update and writing to the reflog, as we protect the reflog with the ref lock. As an additional benefit, this reflog append on the backend happens by appending to the file instead of parsing and rewriting it.
Diffstat (limited to 'tests/refs/settargetwithlog.c')
-rw-r--r--tests/refs/settargetwithlog.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/tests/refs/settargetwithlog.c b/tests/refs/settargetwithlog.c
index 99377dad7..cfa1c99d5 100644
--- a/tests/refs/settargetwithlog.c
+++ b/tests/refs/settargetwithlog.c
@@ -53,42 +53,3 @@ void test_refs_settargetwithlog__updating_a_direct_reference_adds_a_reflog_entry
git_reference_free(reference);
git_signature_free(signature);
}
-
-void test_refs_settargetwithlog__updating_a_symbolic_reference_adds_a_reflog_entry(void)
-{
- git_reference *reference, *reference_out;
- git_oid id;
- git_signature *signature;
- git_reflog *reflog;
- const git_reflog_entry *entry;
-
- const char *name = "HEAD";
- const char *message = "You've been logged, mate!";
-
- git_oid_fromstr(&id, br2_tip);
-
- cl_git_pass(git_signature_now(&signature, "foo", "foo@bar"));
-
- cl_git_pass(git_reference_lookup(&reference, g_repo, name));
-
- cl_assert_equal_s(
- "refs/heads/master", git_reference_symbolic_target(reference));
-
- cl_git_pass(git_reference_symbolic_set_target_with_log(&reference_out,
- reference, br2_name, signature, message));
-
- cl_assert_equal_s(
- br2_name, git_reference_symbolic_target(reference_out));
-
- cl_git_pass(git_reflog_read(&reflog, g_repo, name));
-
- entry = git_reflog_entry_byindex(reflog, 0);
- cl_assert(git_oid_streq(&entry->oid_old, master_tip) == 0);
- cl_assert(git_oid_streq(&entry->oid_cur, br2_tip) == 0);
- cl_assert_equal_s(message, entry->msg);
-
- git_reflog_free(reflog);
- git_reference_free(reference_out);
- git_reference_free(reference);
- git_signature_free(signature);
-}