tests: add missing cl_git_pass to tests Reported by Coverity, CID 1393678-1393697.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
diff --git a/tests/checkout/conflict.c b/tests/checkout/conflict.c
index 9b86cfa..90603d4 100644
--- a/tests/checkout/conflict.c
+++ b/tests/checkout/conflict.c
@@ -93,7 +93,7 @@ static void create_index(struct checkout_index_entry *entries, size_t entries_le
if (entries[i].stage == 3 && (i == 0 || strcmp(entries[i-1].path, entries[i].path) != 0 || entries[i-1].stage != 2))
p_unlink(git_buf_cstr(&path));
- git_index_remove_bypath(g_index, entries[i].path);
+ cl_git_pass(git_index_remove_bypath(g_index, entries[i].path));
}
for (i = 0; i < entries_len; i++) {
@@ -133,7 +133,7 @@ static void create_conflicting_index(void)
};
create_index(checkout_index_entries, 3);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
}
static void ensure_workdir_contents(const char *path, const char *contents)
@@ -271,7 +271,7 @@ void test_checkout_conflict__automerge(void)
};
create_index(checkout_index_entries, 3);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
@@ -303,7 +303,7 @@ void test_checkout_conflict__directory_file(void)
opts.checkout_strategy |= GIT_CHECKOUT_SAFE;
create_index(checkout_index_entries, 12);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
@@ -344,7 +344,7 @@ void test_checkout_conflict__directory_file_with_custom_labels(void)
opts.their_label = "branch";
create_index(checkout_index_entries, 12);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
@@ -383,7 +383,7 @@ void test_checkout_conflict__link_file(void)
opts.checkout_strategy |= GIT_CHECKOUT_SAFE;
create_index(checkout_index_entries, 12);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
@@ -410,7 +410,7 @@ void test_checkout_conflict__links(void)
opts.checkout_strategy |= GIT_CHECKOUT_SAFE;
create_index(checkout_index_entries, 5);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
@@ -431,7 +431,7 @@ void test_checkout_conflict__add_add(void)
opts.checkout_strategy |= GIT_CHECKOUT_SAFE;
create_index(checkout_index_entries, 2);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
@@ -472,7 +472,7 @@ void test_checkout_conflict__mode_change(void)
opts.checkout_strategy |= GIT_CHECKOUT_SAFE;
create_index(checkout_index_entries, 18);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
@@ -604,7 +604,7 @@ void test_checkout_conflict__renames(void)
create_index(checkout_index_entries, 41);
create_index_names(checkout_name_entries, 9);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
@@ -789,7 +789,7 @@ void test_checkout_conflict__rename_keep_ours(void)
create_index(checkout_index_entries, 41);
create_index_names(checkout_name_entries, 9);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
@@ -922,7 +922,7 @@ void test_checkout_conflict__name_mangled_file_exists_in_workdir(void)
create_index(checkout_index_entries, 24);
create_index_names(checkout_name_entries, 6);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
/* Add some files on disk that conflict with the names that would be chosen
* for the files written for each side. */
@@ -1012,7 +1012,7 @@ void test_checkout_conflict__update_only(void)
opts.checkout_strategy |= GIT_CHECKOUT_UPDATE_ONLY;
create_index(checkout_index_entries, 3);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(p_mkdir("merge-resolve/directory_file-two", 0777));
cl_git_rewritefile("merge-resolve/directory_file-two/file", CONFLICTING_OURS_FILE);
@@ -1063,7 +1063,7 @@ void test_checkout_conflict__path_filters(void)
opts.paths = patharray;
create_index(checkout_index_entries, 12);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
@@ -1120,7 +1120,7 @@ void test_checkout_conflict__report_progress(void)
create_index(checkout_index_entries, 12);
- git_index_write(g_index);
+ cl_git_pass(git_index_write(g_index));
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index a78bf82..7ef00fa 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -954,7 +954,7 @@ static void create_conflict(const char *path)
git_oid_fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
cl_git_pass(git_index_add(index, &entry));
- git_index_write(index);
+ cl_git_pass(git_index_write(index));
git_index_free(index);
}
@@ -1127,7 +1127,7 @@ void test_checkout_tree__removes_conflicts(void)
create_conflict("other.txt");
cl_git_mkfile("testrepo/other.txt", "This is another conflict file.\n");
- git_index_write(index);
+ cl_git_pass(git_index_write(index));
cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts));
@@ -1172,7 +1172,7 @@ void test_checkout_tree__removes_conflicts_only_by_pathscope(void)
create_conflict("other.txt");
cl_git_mkfile("testrepo/other.txt", "This is another conflict file.\n");
- git_index_write(index);
+ cl_git_pass(git_index_write(index));
cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts));
diff --git a/tests/describe/t6120.c b/tests/describe/t6120.c
index 6df397e..d254de8 100644
--- a/tests/describe/t6120.c
+++ b/tests/describe/t6120.c
@@ -104,8 +104,8 @@ static void commit_and_tag(
cl_git_append2file("describe/file", "\n");
- git_index_add_bypath(index, "describe/file");
- git_index_write(index);
+ cl_git_pass(git_index_add_bypath(index, "describe/file"));
+ cl_git_pass(git_index_write(index));
*time += 10;
cl_repo_commit_from_index(&commit_id, repo, NULL, *time, commit_msg);
diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c
index d827062..dab6147 100644
--- a/tests/diff/workdir.c
+++ b/tests/diff/workdir.c
@@ -1910,7 +1910,7 @@ void test_diff_workdir__binary_detection(void)
cl_git_write2file(
b.ptr, data[i].ptr, data[i].size, O_WRONLY|O_TRUNC, 0664);
}
- git_index_write(idx);
+ cl_git_pass(git_index_write(idx));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, NULL));
@@ -1938,7 +1938,7 @@ void test_diff_workdir__binary_detection(void)
cl_git_write2file(b.ptr, "baseline\n", 9, O_WRONLY|O_TRUNC, 0664);
}
- git_index_write(idx);
+ cl_git_pass(git_index_write(idx));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, NULL));
diff --git a/tests/merge/workdir/dirty.c b/tests/merge/workdir/dirty.c
index 66301e1..dd7267b 100644
--- a/tests/merge/workdir/dirty.c
+++ b/tests/merge/workdir/dirty.c
@@ -337,7 +337,7 @@ void test_merge_workdir_dirty__identical_staged_files_allowed(void)
for (i = 0, content = result_contents[i]; content[0]; content = result_contents[++i]) {
stage_content(content);
- git_index_write(repo_index);
+ cl_git_pass(git_index_write(repo_index));
cl_git_pass(merge_branch());
}
}
diff --git a/tests/stash/apply.c b/tests/stash/apply.c
index 986eba0..55e093c 100644
--- a/tests/stash/apply.c
+++ b/tests/stash/apply.c
@@ -34,7 +34,7 @@ void test_stash_apply__initialize(void)
cl_git_pass(git_index_add_bypath(repo_index, "who"));
cl_git_pass(git_index_add_bypath(repo_index, "why"));
cl_git_pass(git_index_add_bypath(repo_index, "where"));
- git_index_write(repo_index);
+ cl_git_pass(git_index_write(repo_index));
cl_git_rewritefile("stash/where", "....\n");