Commit 59f46913c0b53f2bb45a0f9dc9d390de6a4d7697

Edward Thomson 2020-04-05T21:55:13

reset: use GIT_ASSERT

diff --git a/src/reset.c b/src/reset.c
index ca6a5bd..dfae91d 100644
--- a/src/reset.c
+++ b/src/reset.c
@@ -33,7 +33,7 @@ int git_reset_default(
 	int error;
 	git_index *index = NULL;
 
-	assert(pathspecs != NULL && pathspecs->count > 0);
+	GIT_ASSERT_ARG(pathspecs && pathspecs->count > 0);
 
 	memset(&entry, 0, sizeof(git_index_entry));
 
@@ -62,10 +62,10 @@ int git_reset_default(
 	for (i = 0, max_i = git_diff_num_deltas(diff); i < max_i; ++i) {
 		const git_diff_delta *delta = git_diff_get_delta(diff, i);
 
-		assert(delta->status == GIT_DELTA_ADDED ||
-			delta->status == GIT_DELTA_MODIFIED ||
-			delta->status == GIT_DELTA_CONFLICTED ||
-			delta->status == GIT_DELTA_DELETED);
+		GIT_ASSERT(delta->status == GIT_DELTA_ADDED ||
+		           delta->status == GIT_DELTA_MODIFIED ||
+		           delta->status == GIT_DELTA_CONFLICTED ||
+		           delta->status == GIT_DELTA_DELETED);
 
 		error = git_index_conflict_remove(index, delta->old_file.path);
 		if (error < 0) {
@@ -113,7 +113,8 @@ static int reset(
 	git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
 	git_buf log_message = GIT_BUF_INIT;
 
-	assert(repo && target);
+	GIT_ASSERT_ARG(repo);
+	GIT_ASSERT_ARG(target);
 
 	if (checkout_opts)
 		opts = *checkout_opts;