Commit fd4e3b216c0881b5825c013a55b487ac2e8b8ab0

Edward Thomson 2018-11-13T15:33:20

Merge pull request #4885 from pks-t/pks/apply-test-fixups apply: small fixups in the test suite

diff --git a/tests/apply/both.c b/tests/apply/both.c
index 5091b8c..400df5e 100644
--- a/tests/apply/both.c
+++ b/tests/apply/both.c
@@ -244,7 +244,7 @@ void test_apply_both__application_failure_leaves_workdir_unmodified(void)
 	    "This is a modification.\n");
 
 	cl_git_pass(git_repository_index(&index, repo));
-	git_index_add_bypath(index, "veal.txt");
+	cl_git_pass(git_index_add_bypath(index, "veal.txt"));
 	cl_git_pass(git_index_write(index));
 	git_index_free(index);
 
@@ -291,7 +291,7 @@ void test_apply_both__keeps_nonconflicting_changes(void)
 	idx_entry.mode = 0100644;
 	idx_entry.path = "beef.txt";
 	cl_git_pass(git_oid_fromstr(&idx_entry.id, "898d12687fb35be271c27c795a6b32c8b51da79e"));
-	git_index_add(index, &idx_entry);
+	cl_git_pass(git_index_add(index, &idx_entry));
 
 	cl_git_pass(git_index_remove(index, "bouilli.txt", 0));
 	cl_git_pass(git_index_write(index));
@@ -337,7 +337,7 @@ void test_apply_both__can_apply_nonconflicting_file_changes(void)
 	    "This line is added in the index and the workdir.\n");
 
 	cl_git_pass(git_repository_index(&index, repo));
-	git_index_add_bypath(index, "asparagus.txt");
+	cl_git_pass(git_index_add_bypath(index, "asparagus.txt"));
 	cl_git_pass(git_index_write(index));
 	git_index_free(index);
 
diff --git a/tests/apply/partial.c b/tests/apply/partial.c
index 243dccf..466a927 100644
--- a/tests/apply/partial.c
+++ b/tests/apply/partial.c
@@ -104,8 +104,8 @@ static int apply_buf(
 	}
 
 	git__free(filename);
-	git_buf_free(&result);
-	git_buf_free(&patchbuf);
+	git_buf_dispose(&result);
+	git_buf_dispose(&patchbuf);
 	git_patch_free(patch);
 
 	return error;
diff --git a/tests/apply/workdir.c b/tests/apply/workdir.c
index 1a82925..d0d9c1a 100644
--- a/tests/apply/workdir.c
+++ b/tests/apply/workdir.c
@@ -167,7 +167,7 @@ void test_apply_workdir__modified_index_with_unmodified_workdir_is_ok(void)
 		sizeof(struct merge_index_entry);
 
 	/* mutate the index and leave the workdir matching HEAD */
-	git_repository_index(&index, repo);
+	cl_git_pass(git_repository_index(&index, repo));
 
 	idx_entry.mode = 0100644;
 	idx_entry.path = "veal.txt";