summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-10-24 10:26:43 +0200
committerGitHub <noreply@github.com>2019-10-24 10:26:43 +0200
commitc405f2312c4c0679d81892fac7dd286ab03f7533 (patch)
treeb86bc788eb4fbb5816b65467716eb0bd82ee9d4b /tests
parentb246bed5ab83035d8aef95f1b7ff10dd746db7cb (diff)
parent47531f47334d8b14f6f3ad30a780565c657e4698 (diff)
downloadlibgit2-c405f2312c4c0679d81892fac7dd286ab03f7533.tar.gz
Merge pull request #5264 from henkesn/refs-unlock-on-commit
refs: unlock unmodified refs on transaction commit
Diffstat (limited to 'tests')
-rw-r--r--tests/refs/transactions.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/refs/transactions.c b/tests/refs/transactions.c
index d4ddf459f..50c102ad0 100644
--- a/tests/refs/transactions.c
+++ b/tests/refs/transactions.c
@@ -129,3 +129,29 @@ void test_refs_transactions__error_on_locking_locked_ref(void)
git_transaction_free(g_tx_with_lock);
git_repository_free(g_repo_with_locking_tx);
}
+
+void test_refs_transactions__commit_unlocks_unmodified_ref(void)
+{
+ git_transaction *second_tx;
+
+ cl_git_pass(git_transaction_new(&second_tx, g_repo));
+ cl_git_pass(git_transaction_lock_ref(second_tx, "refs/heads/master"));
+ cl_git_pass(git_transaction_commit(second_tx));
+
+ /* a transaction must now be able to get the lock */
+ cl_git_pass(git_transaction_lock_ref(g_tx, "refs/heads/master"));
+
+ git_transaction_free(second_tx);
+}
+
+void test_refs_transactions__free_unlocks_unmodified_ref(void)
+{
+ git_transaction *second_tx;
+
+ cl_git_pass(git_transaction_new(&second_tx, g_repo));
+ cl_git_pass(git_transaction_lock_ref(second_tx, "refs/heads/master"));
+ git_transaction_free(second_tx);
+
+ /* a transaction must now be able to get the lock */
+ cl_git_pass(git_transaction_lock_ref(g_tx, "refs/heads/master"));
+}