Commit d4384977c32ffbd55541fd7888ffd4dfe8990bce

Edward Thomson 2020-04-05T14:38:20

clone: use GIT_ASSERT

diff --git a/src/clone.c b/src/clone.c
index a93ec47..7ae90b0 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -231,7 +231,7 @@ static int update_head_to_remote(
 
 	/* We know we have HEAD, let's see where it points */
 	remote_head = refs[0];
-	assert(remote_head);
+	GIT_ASSERT(remote_head);
 
 	remote_head_id = &remote_head->oid;
 
@@ -267,7 +267,8 @@ static int update_head_to_branch(
 	git_buf remote_branch_name = GIT_BUF_INIT;
 	git_reference* remote_ref = NULL;
 
-	assert(remote_name && branch);
+	GIT_ASSERT_ARG(remote_name);
+	GIT_ASSERT_ARG(branch);
 
 	if ((retcode = git_buf_printf(&remote_branch_name, GIT_REFS_REMOTES_DIR "%s/%s",
 		remote_name, branch)) < 0 )
@@ -385,7 +386,8 @@ static int clone_into(git_repository *repo, git_remote *_remote, const git_fetch
 	git_fetch_options fetch_opts;
 	git_remote *remote;
 
-	assert(repo && _remote);
+	GIT_ASSERT_ARG(repo);
+	GIT_ASSERT_ARG(_remote);
 
 	if (!git_repository_is_empty(repo)) {
 		git_error_set(GIT_ERROR_INVALID, "the repository is not empty");
@@ -452,7 +454,9 @@ static int git__clone(
 	uint32_t rmdir_flags = GIT_RMDIR_REMOVE_FILES;
 	git_repository_create_cb repository_cb;
 
-	assert(out && url && local_path);
+	GIT_ASSERT_ARG(out);
+	GIT_ASSERT_ARG(url);
+	GIT_ASSERT_ARG(local_path);
 
 	if (_options)
 		memcpy(&options, _options, sizeof(git_clone_options));
@@ -575,7 +579,8 @@ static int clone_local_into(git_repository *repo, git_remote *remote, const git_
 	git_buf src_odb = GIT_BUF_INIT, dst_odb = GIT_BUF_INIT, src_path = GIT_BUF_INIT;
 	git_buf reflog_message = GIT_BUF_INIT;
 
-	assert(repo && remote);
+	GIT_ASSERT_ARG(repo);
+	GIT_ASSERT_ARG(remote);
 
 	if (!git_repository_is_empty(repo)) {
 		git_error_set(GIT_ERROR_INVALID, "the repository is not empty");