Commit 266f26ed by Edward Thomson

checkout: use GIT_ASSERT

parent e0f3c33d
...@@ -1243,7 +1243,7 @@ static int checkout_conflict_append_remove( ...@@ -1243,7 +1243,7 @@ static int checkout_conflict_append_remove(
checkout_data *data = payload; checkout_data *data = payload;
const char *name; const char *name;
assert(ancestor || ours || theirs); GIT_ASSERT_ARG(ancestor || ours || theirs);
if (ancestor) if (ancestor)
name = git__strdup(ancestor->path); name = git__strdup(ancestor->path);
...@@ -1487,7 +1487,9 @@ static int checkout_stream_write( ...@@ -1487,7 +1487,9 @@ static int checkout_stream_write(
static int checkout_stream_close(git_writestream *s) static int checkout_stream_close(git_writestream *s)
{ {
struct checkout_stream *stream = (struct checkout_stream *)s; struct checkout_stream *stream = (struct checkout_stream *)s;
assert(stream && stream->open);
GIT_ASSERT_ARG(stream);
GIT_ASSERT_ARG(stream->open);
stream->open = 0; stream->open = 0;
return p_close(stream->fd); return p_close(stream->fd);
...@@ -1554,7 +1556,7 @@ static int blob_content_to_file( ...@@ -1554,7 +1556,7 @@ static int blob_content_to_file(
error = git_filter_list_stream_blob(fl, blob, &writer.base); error = git_filter_list_stream_blob(fl, blob, &writer.base);
assert(writer.open == 0); GIT_ASSERT(writer.open == 0);
git_filter_list_free(fl); git_filter_list_free(fl);
...@@ -1976,7 +1978,7 @@ static int checkout_write_entry( ...@@ -1976,7 +1978,7 @@ static int checkout_write_entry(
struct stat st; struct stat st;
int error; int error;
assert (side == conflict->ours || side == conflict->theirs); GIT_ASSERT(side == conflict->ours || side == conflict->theirs);
if (checkout_target_fullpath(&fullpath, data, side->path) < 0) if (checkout_target_fullpath(&fullpath, data, side->path) < 0)
return -1; return -1;
...@@ -2588,7 +2590,7 @@ int git_checkout_iterator( ...@@ -2588,7 +2590,7 @@ int git_checkout_iterator(
} }
/* Should not have case insensitivity mismatch */ /* Should not have case insensitivity mismatch */
assert(git_iterator_ignore_case(workdir) == git_iterator_ignore_case(baseline)); GIT_ASSERT(git_iterator_ignore_case(workdir) == git_iterator_ignore_case(baseline));
/* Generate baseline-to-target diff which will include an entry for /* Generate baseline-to-target diff which will include an entry for
* every possible update that might need to be made. * every possible update that might need to be made.
...@@ -2639,7 +2641,7 @@ int git_checkout_iterator( ...@@ -2639,7 +2641,7 @@ int git_checkout_iterator(
(error = checkout_extensions_update_index(&data)) < 0) (error = checkout_extensions_update_index(&data)) < 0)
goto cleanup; goto cleanup;
assert(data.completed_steps == data.total_steps); GIT_ASSERT(data.completed_steps == data.total_steps);
if (data.opts.perfdata_cb) if (data.opts.perfdata_cb)
data.opts.perfdata_cb(&data.perfdata, data.opts.perfdata_payload); data.opts.perfdata_cb(&data.perfdata, data.opts.perfdata_payload);
...@@ -2767,7 +2769,8 @@ int git_checkout_head( ...@@ -2767,7 +2769,8 @@ int git_checkout_head(
git_repository *repo, git_repository *repo,
const git_checkout_options *opts) const git_checkout_options *opts)
{ {
assert(repo); GIT_ASSERT_ARG(repo);
return git_checkout_tree(repo, NULL, opts); return git_checkout_tree(repo, NULL, opts);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment