Commit cf323cb9d94022e0301b5bb3bebdf2f6a5b4e338

Edward Thomson 2021-05-16T11:09:44

refs: test git_reference_create_matching failure for zero oid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/tests/refs/races.c b/tests/refs/races.c
index 9880727..9134bf9 100644
--- a/tests/refs/races.c
+++ b/tests/refs/races.c
@@ -30,7 +30,10 @@ void test_refs_races__create_matching_zero_old(void)
 	git_oid_fromstr(&id, commit_id);
 	git_oid_fromstr(&zero_id, "0000000000000000000000000000000000000000");
 
+	cl_git_fail(git_reference_create_matching(&ref, g_repo, refname, &id, 1, &zero_id, NULL));
+
 	cl_git_pass(git_reference_create_matching(&ref, g_repo, other_refname, &id, 1, &zero_id, NULL));
+	cl_git_fail(git_reference_create_matching(&ref, g_repo, other_refname, &id, 1, &zero_id, NULL));
 
 	git_reference_free(ref);
 }