Commit 5d92e547 by Edward Thomson

oid: `is_zero` instead of `iszero`

The only function that is named `issomething` (without underscore) was
`git_oid_iszero`.  Rename it to `git_oid_is_zero` for consistency with
the rest of the library.
parent fef847ae
...@@ -72,7 +72,7 @@ int lg2_blame(git_repository *repo, int argc, char *argv[]) ...@@ -72,7 +72,7 @@ int lg2_blame(git_repository *repo, int argc, char *argv[])
* Get the raw data inside the blob for output. We use the * Get the raw data inside the blob for output. We use the
* `commitish:path/to/file.txt` format to find it. * `commitish:path/to/file.txt` format to find it.
*/ */
if (git_oid_iszero(&blameopts.newest_commit)) if (git_oid_is_zero(&blameopts.newest_commit))
strcpy(spec, "HEAD"); strcpy(spec, "HEAD");
else else
git_oid_tostr(spec, sizeof(spec), &blameopts.newest_commit); git_oid_tostr(spec, sizeof(spec), &blameopts.newest_commit);
...@@ -101,7 +101,7 @@ int lg2_blame(git_repository *repo, int argc, char *argv[]) ...@@ -101,7 +101,7 @@ int lg2_blame(git_repository *repo, int argc, char *argv[])
if (hunk) { if (hunk) {
char sig[128] = {0}; char sig[128] = {0};
break_on_null_hunk = 1; break_on_null_hunk = 1;
git_oid_tostr(oid, 10, &hunk->final_commit_id); git_oid_tostr(oid, 10, &hunk->final_commit_id);
snprintf(sig, 30, "%s <%s>", hunk->final_signature->name, hunk->final_signature->email); snprintf(sig, 30, "%s <%s>", hunk->final_signature->name, hunk->final_signature->email);
......
...@@ -21,7 +21,7 @@ static int update_cb(const char *refname, const git_oid *a, const git_oid *b, vo ...@@ -21,7 +21,7 @@ static int update_cb(const char *refname, const git_oid *a, const git_oid *b, vo
git_oid_fmt(b_str, b); git_oid_fmt(b_str, b);
b_str[GIT_OID_HEXSZ] = '\0'; b_str[GIT_OID_HEXSZ] = '\0';
if (git_oid_iszero(a)) { if (git_oid_is_zero(a)) {
printf("[new] %.20s %s\n", b_str, refname); printf("[new] %.20s %s\n", b_str, refname);
} else { } else {
git_oid_fmt(a_str, a); git_oid_fmt(a_str, a);
......
...@@ -271,7 +271,6 @@ GIT_EXTERN(void) giterr_set_oom(void); ...@@ -271,7 +271,6 @@ GIT_EXTERN(void) giterr_set_oom(void);
* There is no plan to remove these backward compatibility values at * There is no plan to remove these backward compatibility values at
* this time. * this time.
*/ */
/**@{*/
typedef git_cred_sign_cb git_cred_sign_callback; typedef git_cred_sign_cb git_cred_sign_callback;
typedef git_cred_ssh_interactive_cb git_cred_ssh_interactive_callback; typedef git_cred_ssh_interactive_cb git_cred_ssh_interactive_callback;
...@@ -292,6 +291,20 @@ typedef git_trace_cb git_trace_callback; ...@@ -292,6 +291,20 @@ typedef git_trace_cb git_trace_callback;
/**@}*/ /**@}*/
/** @name Deprecated Object ID Types
*
* These types are retained for backward compatibility. The newer
* versions of these values should be preferred in all new code.
*
* There is no plan to remove these backward compatibility values at
* this time.
*/
/**@{*/
GIT_EXTERN(int) git_oid_iszero(const git_oid *id);
/**@}*/
/** @name Deprecated Transfer Progress Types /** @name Deprecated Transfer Progress Types
* *
* These types are retained for backward compatibility. The newer * These types are retained for backward compatibility. The newer
......
...@@ -207,7 +207,7 @@ GIT_EXTERN(int) git_oid_strcmp(const git_oid *id, const char *str); ...@@ -207,7 +207,7 @@ GIT_EXTERN(int) git_oid_strcmp(const git_oid *id, const char *str);
* *
* @return 1 if all zeros, 0 otherwise. * @return 1 if all zeros, 0 otherwise.
*/ */
GIT_EXTERN(int) git_oid_iszero(const git_oid *id); GIT_EXTERN(int) git_oid_is_zero(const git_oid *id);
/** /**
* OID Shortener object * OID Shortener object
......
...@@ -204,7 +204,7 @@ static int normalize_options( ...@@ -204,7 +204,7 @@ static int normalize_options(
memcpy(out, in, sizeof(git_blame_options)); memcpy(out, in, sizeof(git_blame_options));
/* No newest_commit => HEAD */ /* No newest_commit => HEAD */
if (git_oid_iszero(&out->newest_commit)) { if (git_oid_is_zero(&out->newest_commit)) {
if (git_reference_name_to_id(&out->newest_commit, repo, "HEAD") < 0) { if (git_reference_name_to_id(&out->newest_commit, repo, "HEAD") < 0) {
return -1; return -1;
} }
...@@ -408,7 +408,7 @@ on_error: ...@@ -408,7 +408,7 @@ on_error:
static bool hunk_is_bufferblame(git_blame_hunk *hunk) static bool hunk_is_bufferblame(git_blame_hunk *hunk)
{ {
return git_oid_iszero(&hunk->final_commit_id); return git_oid_is_zero(&hunk->final_commit_id);
} }
static int buffer_hunk_cb( static int buffer_hunk_cb(
......
...@@ -232,7 +232,7 @@ static int diff_file_content_load_blob( ...@@ -232,7 +232,7 @@ static int diff_file_content_load_blob(
int error = 0; int error = 0;
git_odb_object *odb_obj = NULL; git_odb_object *odb_obj = NULL;
if (git_oid_iszero(&fc->file->id)) if (git_oid_is_zero(&fc->file->id))
return 0; return 0;
if (fc->file->mode == GIT_FILEMODE_COMMIT) if (fc->file->mode == GIT_FILEMODE_COMMIT)
......
...@@ -179,7 +179,7 @@ static int diff_delta__from_one( ...@@ -179,7 +179,7 @@ static int diff_delta__from_one(
delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID; delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
if (has_old || !git_oid_iszero(&delta->new_file.id)) if (has_old || !git_oid_is_zero(&delta->new_file.id))
delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID; delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
return diff_insert_delta(diff, delta, matched_pathspec); return diff_insert_delta(diff, delta, matched_pathspec);
...@@ -240,7 +240,7 @@ static int diff_delta__from_two( ...@@ -240,7 +240,7 @@ static int diff_delta__from_two(
delta->old_file.flags |= GIT_DIFF_FLAG_EXISTS; delta->old_file.flags |= GIT_DIFF_FLAG_EXISTS;
delta->new_file.flags |= GIT_DIFF_FLAG_EXISTS; delta->new_file.flags |= GIT_DIFF_FLAG_EXISTS;
if (!git_oid_iszero(&new_entry->id)) if (!git_oid_is_zero(&new_entry->id))
delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID; delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
} }
...@@ -797,13 +797,13 @@ static int maybe_modified( ...@@ -797,13 +797,13 @@ static int maybe_modified(
/* if oids and modes match (and are valid), then file is unmodified */ /* if oids and modes match (and are valid), then file is unmodified */
} else if (git_oid_equal(&oitem->id, &nitem->id) && } else if (git_oid_equal(&oitem->id, &nitem->id) &&
omode == nmode && omode == nmode &&
!git_oid_iszero(&oitem->id)) { !git_oid_is_zero(&oitem->id)) {
status = GIT_DELTA_UNMODIFIED; status = GIT_DELTA_UNMODIFIED;
/* if we have an unknown OID and a workdir iterator, then check some /* if we have an unknown OID and a workdir iterator, then check some
* circumstances that can accelerate things or need special handling * circumstances that can accelerate things or need special handling
*/ */
} else if (git_oid_iszero(&nitem->id) && new_is_workdir) { } else if (git_oid_is_zero(&nitem->id) && new_is_workdir) {
bool use_ctime = bool use_ctime =
((diff->diffcaps & GIT_DIFFCAPS_TRUST_CTIME) != 0); ((diff->diffcaps & GIT_DIFFCAPS_TRUST_CTIME) != 0);
git_index *index = git_iterator_index(info->new_iter); git_index *index = git_iterator_index(info->new_iter);
...@@ -843,7 +843,7 @@ static int maybe_modified( ...@@ -843,7 +843,7 @@ static int maybe_modified(
/* if we got here and decided that the files are modified, but we /* if we got here and decided that the files are modified, but we
* haven't calculated the OID of the new item, then calculate it now * haven't calculated the OID of the new item, then calculate it now
*/ */
if (modified_uncertain && git_oid_iszero(&nitem->id)) { if (modified_uncertain && git_oid_is_zero(&nitem->id)) {
const git_oid *update_check = const git_oid *update_check =
DIFF_FLAG_IS_SET(diff, GIT_DIFF_UPDATE_INDEX) && omode == nmode ? DIFF_FLAG_IS_SET(diff, GIT_DIFF_UPDATE_INDEX) && omode == nmode ?
&oitem->id : NULL; &oitem->id : NULL;
...@@ -877,7 +877,7 @@ static int maybe_modified( ...@@ -877,7 +877,7 @@ static int maybe_modified(
return diff_delta__from_two( return diff_delta__from_two(
diff, status, oitem, omode, nitem, nmode, diff, status, oitem, omode, nitem, nmode,
git_oid_iszero(&noid) ? NULL : &noid, matched_pathspec); git_oid_is_zero(&noid) ? NULL : &noid, matched_pathspec);
} }
static bool entry_is_prefixed( static bool entry_is_prefixed(
......
...@@ -325,10 +325,10 @@ static int diff_delta_format_with_paths( ...@@ -325,10 +325,10 @@ static int diff_delta_format_with_paths(
const char *oldpath, const char *oldpath,
const char *newpath) const char *newpath)
{ {
if (git_oid_iszero(&delta->old_file.id)) if (git_oid_is_zero(&delta->old_file.id))
oldpath = "/dev/null"; oldpath = "/dev/null";
if (git_oid_iszero(&delta->new_file.id)) if (git_oid_is_zero(&delta->new_file.id))
newpath = "/dev/null"; newpath = "/dev/null";
return git_buf_printf(out, template, oldpath, newpath); return git_buf_printf(out, template, oldpath, newpath);
...@@ -381,8 +381,8 @@ done: ...@@ -381,8 +381,8 @@ done:
static bool delta_is_unchanged(const git_diff_delta *delta) static bool delta_is_unchanged(const git_diff_delta *delta)
{ {
if (git_oid_iszero(&delta->old_file.id) && if (git_oid_is_zero(&delta->old_file.id) &&
git_oid_iszero(&delta->new_file.id)) git_oid_is_zero(&delta->new_file.id))
return true; return true;
if (delta->old_file.mode == GIT_FILEMODE_COMMIT || if (delta->old_file.mode == GIT_FILEMODE_COMMIT ||
......
...@@ -560,13 +560,13 @@ static int similarity_measure( ...@@ -560,13 +560,13 @@ static int similarity_measure(
/* if exact match is requested, force calculation of missing OIDs now */ /* if exact match is requested, force calculation of missing OIDs now */
if (exact_match) { if (exact_match) {
if (git_oid_iszero(&a_file->id) && if (git_oid_is_zero(&a_file->id) &&
diff->old_src == GIT_ITERATOR_TYPE_WORKDIR && diff->old_src == GIT_ITERATOR_TYPE_WORKDIR &&
!git_diff__oid_for_file(&a_file->id, !git_diff__oid_for_file(&a_file->id,
diff, a_file->path, a_file->mode, a_file->size)) diff, a_file->path, a_file->mode, a_file->size))
a_file->flags |= GIT_DIFF_FLAG_VALID_ID; a_file->flags |= GIT_DIFF_FLAG_VALID_ID;
if (git_oid_iszero(&b_file->id) && if (git_oid_is_zero(&b_file->id) &&
diff->new_src == GIT_ITERATOR_TYPE_WORKDIR && diff->new_src == GIT_ITERATOR_TYPE_WORKDIR &&
!git_diff__oid_for_file(&b_file->id, !git_diff__oid_for_file(&b_file->id,
diff, b_file->path, b_file->mode, b_file->size)) diff, b_file->path, b_file->mode, b_file->size))
......
...@@ -385,7 +385,7 @@ uint16_t git_filter_source_filemode(const git_filter_source *src) ...@@ -385,7 +385,7 @@ uint16_t git_filter_source_filemode(const git_filter_source *src)
const git_oid *git_filter_source_id(const git_filter_source *src) const git_oid *git_filter_source_id(const git_filter_source *src)
{ {
return git_oid_iszero(&src->oid) ? NULL : &src->oid; return git_oid_is_zero(&src->oid) ? NULL : &src->oid;
} }
git_filter_mode_t git_filter_source_mode(const git_filter_source *src) git_filter_mode_t git_filter_source_mode(const git_filter_source *src)
......
...@@ -766,7 +766,7 @@ int git_odb_exists(git_odb *db, const git_oid *id) ...@@ -766,7 +766,7 @@ int git_odb_exists(git_odb *db, const git_oid *id)
assert(db && id); assert(db && id);
if (git_oid_iszero(id)) if (git_oid_is_zero(id))
return 0; return 0;
if ((object = git_cache_get_raw(odb_cache(db), id)) != NULL) { if ((object = git_cache_get_raw(odb_cache(db), id)) != NULL) {
...@@ -994,7 +994,7 @@ int git_odb__read_header_or_object( ...@@ -994,7 +994,7 @@ int git_odb__read_header_or_object(
*out = NULL; *out = NULL;
if (git_oid_iszero(id)) if (git_oid_is_zero(id))
return error_null_oid(GIT_ENOTFOUND, "cannot read object"); return error_null_oid(GIT_ENOTFOUND, "cannot read object");
if ((object = git_cache_get_raw(odb_cache(db), id)) != NULL) { if ((object = git_cache_get_raw(odb_cache(db), id)) != NULL) {
...@@ -1099,7 +1099,7 @@ int git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id) ...@@ -1099,7 +1099,7 @@ int git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id)
assert(out && db && id); assert(out && db && id);
if (git_oid_iszero(id)) if (git_oid_is_zero(id))
return error_null_oid(GIT_ENOTFOUND, "cannot read object"); return error_null_oid(GIT_ENOTFOUND, "cannot read object");
*out = git_cache_get_raw(odb_cache(db), id); *out = git_cache_get_raw(odb_cache(db), id);
...@@ -1123,7 +1123,7 @@ static int odb_otype_fast(git_object_t *type_p, git_odb *db, const git_oid *id) ...@@ -1123,7 +1123,7 @@ static int odb_otype_fast(git_object_t *type_p, git_odb *db, const git_oid *id)
size_t _unused; size_t _unused;
int error; int error;
if (git_oid_iszero(id)) if (git_oid_is_zero(id))
return error_null_oid(GIT_ENOTFOUND, "cannot get object type"); return error_null_oid(GIT_ENOTFOUND, "cannot get object type");
if ((object = git_cache_get_raw(odb_cache(db), id)) != NULL) { if ((object = git_cache_get_raw(odb_cache(db), id)) != NULL) {
...@@ -1283,7 +1283,7 @@ int git_odb_write( ...@@ -1283,7 +1283,7 @@ int git_odb_write(
git_odb_hash(oid, data, len, type); git_odb_hash(oid, data, len, type);
if (git_oid_iszero(oid)) if (git_oid_is_zero(oid))
return error_null_oid(GIT_EINVALID, "cannot write object"); return error_null_oid(GIT_EINVALID, "cannot write object");
if (git_odb__freshen(db, oid)) if (git_odb__freshen(db, oid))
......
...@@ -237,7 +237,7 @@ int git_oid_streq(const git_oid *oid_a, const char *str) ...@@ -237,7 +237,7 @@ int git_oid_streq(const git_oid *oid_a, const char *str)
return git_oid_strcmp(oid_a, str) == 0 ? 0 : -1; return git_oid_strcmp(oid_a, str) == 0 ? 0 : -1;
} }
int git_oid_iszero(const git_oid *oid_a) int git_oid_is_zero(const git_oid *oid_a)
{ {
const unsigned char *a = oid_a->id; const unsigned char *a = oid_a->id;
unsigned int i; unsigned int i;
...@@ -247,6 +247,11 @@ int git_oid_iszero(const git_oid *oid_a) ...@@ -247,6 +247,11 @@ int git_oid_iszero(const git_oid *oid_a)
return 1; return 1;
} }
int git_oid_iszero(const git_oid *oid_a)
{
return git_oid_is_zero(oid_a);
}
typedef short node_index; typedef short node_index;
typedef union { typedef union {
......
...@@ -196,7 +196,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks) ...@@ -196,7 +196,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
continue; continue;
/* Update the remote ref */ /* Update the remote ref */
if (git_oid_iszero(&push_spec->loid)) { if (git_oid_is_zero(&push_spec->loid)) {
error = git_reference_lookup(&remote_ref, push->remote->repo, git_buf_cstr(&remote_ref_name)); error = git_reference_lookup(&remote_ref, push->remote->repo, git_buf_cstr(&remote_ref_name));
if (error >= 0) { if (error >= 0) {
...@@ -281,7 +281,7 @@ static int queue_objects(git_push *push) ...@@ -281,7 +281,7 @@ static int queue_objects(git_push *push)
git_object_t type; git_object_t type;
size_t size; size_t size;
if (git_oid_iszero(&spec->loid)) if (git_oid_is_zero(&spec->loid))
/* /*
* Delete reference on remote side; * Delete reference on remote side;
* nothing to do here. * nothing to do here.
...@@ -319,7 +319,7 @@ static int queue_objects(git_push *push) ...@@ -319,7 +319,7 @@ static int queue_objects(git_push *push)
if (!spec->refspec.force) { if (!spec->refspec.force) {
git_oid base; git_oid base;
if (git_oid_iszero(&spec->roid)) if (git_oid_is_zero(&spec->roid))
continue; continue;
if (!git_odb_exists(push->repo->_odb, &spec->roid)) { if (!git_odb_exists(push->repo->_odb, &spec->roid)) {
...@@ -346,7 +346,7 @@ static int queue_objects(git_push *push) ...@@ -346,7 +346,7 @@ static int queue_objects(git_push *push)
} }
git_vector_foreach(&push->remote->refs, i, head) { git_vector_foreach(&push->remote->refs, i, head) {
if (git_oid_iszero(&head->oid)) if (git_oid_is_zero(&head->oid))
continue; continue;
/* TODO */ /* TODO */
......
...@@ -386,7 +386,7 @@ const git_oid *git_reference_target_peel(const git_reference *ref) ...@@ -386,7 +386,7 @@ const git_oid *git_reference_target_peel(const git_reference *ref)
{ {
assert(ref); assert(ref);
if (ref->type != GIT_REFERENCE_DIRECT || git_oid_iszero(&ref->peel)) if (ref->type != GIT_REFERENCE_DIRECT || git_oid_is_zero(&ref->peel))
return NULL; return NULL;
return &ref->peel; return &ref->peel;
...@@ -1380,7 +1380,7 @@ int git_reference_peel( ...@@ -1380,7 +1380,7 @@ int git_reference_peel(
* to a commit. So we only want to use the peeled value * to a commit. So we only want to use the peeled value
* if it is not zero and the target is not a tag. * if it is not zero and the target is not a tag.
*/ */
if (target_type != GIT_OBJECT_TAG && !git_oid_iszero(&resolved->peel)) { if (target_type != GIT_OBJECT_TAG && !git_oid_is_zero(&resolved->peel)) {
error = git_object_lookup(&target, error = git_object_lookup(&target,
git_reference_owner(ref), &resolved->peel, GIT_OBJECT_ANY); git_reference_owner(ref), &resolved->peel, GIT_OBJECT_ANY);
} else { } else {
......
...@@ -86,14 +86,14 @@ static unsigned int workdir_delta2status( ...@@ -86,14 +86,14 @@ static unsigned int workdir_delta2status(
/* if OIDs don't match, we might need to calculate them now to /* if OIDs don't match, we might need to calculate them now to
* discern between RENAMED vs RENAMED+MODIFED * discern between RENAMED vs RENAMED+MODIFED
*/ */
if (git_oid_iszero(&idx2wd->old_file.id) && if (git_oid_is_zero(&idx2wd->old_file.id) &&
diff->old_src == GIT_ITERATOR_TYPE_WORKDIR && diff->old_src == GIT_ITERATOR_TYPE_WORKDIR &&
!git_diff__oid_for_file( !git_diff__oid_for_file(
&idx2wd->old_file.id, diff, idx2wd->old_file.path, &idx2wd->old_file.id, diff, idx2wd->old_file.path,
idx2wd->old_file.mode, idx2wd->old_file.size)) idx2wd->old_file.mode, idx2wd->old_file.size))
idx2wd->old_file.flags |= GIT_DIFF_FLAG_VALID_ID; idx2wd->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
if (git_oid_iszero(&idx2wd->new_file.id) && if (git_oid_is_zero(&idx2wd->new_file.id) &&
diff->new_src == GIT_ITERATOR_TYPE_WORKDIR && diff->new_src == GIT_ITERATOR_TYPE_WORKDIR &&
!git_diff__oid_for_file( !git_diff__oid_for_file(
&idx2wd->new_file.id, diff, idx2wd->new_file.path, &idx2wd->new_file.id, diff, idx2wd->new_file.path,
......
...@@ -309,7 +309,7 @@ static int local_push_update_remote_ref( ...@@ -309,7 +309,7 @@ static int local_push_update_remote_ref(
if (lref[0] != '\0') { if (lref[0] != '\0') {
/* Create or update a ref */ /* Create or update a ref */
error = git_reference_create(NULL, remote_repo, rref, loid, error = git_reference_create(NULL, remote_repo, rref, loid,
!git_oid_iszero(roid), NULL); !git_oid_is_zero(roid), NULL);
} else { } else {
/* Delete a ref */ /* Delete a ref */
if ((error = git_reference_lookup(&remote_ref, remote_repo, rref)) < 0) { if ((error = git_reference_lookup(&remote_ref, remote_repo, rref)) < 0) {
......
...@@ -286,7 +286,7 @@ static int git_smart__connect( ...@@ -286,7 +286,7 @@ static int git_smart__connect(
if ((error = git_smart__detect_caps(first, &t->caps, &symrefs)) == 0) { if ((error = git_smart__detect_caps(first, &t->caps, &symrefs)) == 0) {
/* If the only ref in the list is capabilities^{} with OID_ZERO, remove it */ /* If the only ref in the list is capabilities^{} with OID_ZERO, remove it */
if (1 == t->refs.length && !strcmp(first->head.name, "capabilities^{}") && if (1 == t->refs.length && !strcmp(first->head.name, "capabilities^{}") &&
git_oid_iszero(&first->head.oid)) { git_oid_is_zero(&first->head.oid)) {
git_vector_clear(&t->refs); git_vector_clear(&t->refs);
git_pkt_free((git_pkt *)first); git_pkt_free((git_pkt *)first);
} }
......
...@@ -963,7 +963,7 @@ static int update_refs_from_report( ...@@ -963,7 +963,7 @@ static int update_refs_from_report(
/* Remove any refs which we updated to have a zero OID. */ /* Remove any refs which we updated to have a zero OID. */
git_vector_rforeach(refs, i, ref) { git_vector_rforeach(refs, i, ref) {
if (git_oid_iszero(&ref->head.oid)) { if (git_oid_is_zero(&ref->head.oid)) {
git_vector_remove(refs, i); git_vector_remove(refs, i);
git_pkt_free((git_pkt *)ref); git_pkt_free((git_pkt *)ref);
} }
......
...@@ -479,7 +479,7 @@ static int check_entry(git_repository *repo, const char *filename, const git_oid ...@@ -479,7 +479,7 @@ static int check_entry(git_repository *repo, const char *filename, const git_oid
if (!valid_entry_name(repo, filename)) if (!valid_entry_name(repo, filename))
return tree_error("failed to insert entry: invalid name for a tree entry", filename); return tree_error("failed to insert entry: invalid name for a tree entry", filename);
if (git_oid_iszero(id)) if (git_oid_is_zero(id))
return tree_error("failed to insert entry: invalid null OID", filename); return tree_error("failed to insert entry: invalid null OID", filename);
if (filemode != GIT_FILEMODE_COMMIT && if (filemode != GIT_FILEMODE_COMMIT &&
......
...@@ -315,7 +315,7 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void) ...@@ -315,7 +315,7 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
cl_assert_equal_i(GIT_DELTA_DELETED, delta->status); cl_assert_equal_i(GIT_DELTA_DELETED, delta->status);
cl_assert_equal_oid(git_blob_id(d), &delta->old_file.id); cl_assert_equal_oid(git_blob_id(d), &delta->old_file.id);
cl_assert_equal_sz(git_blob_rawsize(d), delta->old_file.size); cl_assert_equal_sz(git_blob_rawsize(d), delta->old_file.size);
cl_assert(git_oid_iszero(&delta->new_file.id)); cl_assert(git_oid_is_zero(&delta->new_file.id));
cl_assert_equal_sz(0, delta->new_file.size); cl_assert_equal_sz(0, delta->new_file.size);
cl_assert_equal_i(1, (int)git_patch_num_hunks(p)); cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
...@@ -338,7 +338,7 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void) ...@@ -338,7 +338,7 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
delta = git_patch_get_delta(p); delta = git_patch_get_delta(p);
cl_assert(delta != NULL); cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_ADDED, delta->status); cl_assert_equal_i(GIT_DELTA_ADDED, delta->status);
cl_assert(git_oid_iszero(&delta->old_file.id)); cl_assert(git_oid_is_zero(&delta->old_file.id));
cl_assert_equal_sz(0, delta->old_file.size); cl_assert_equal_sz(0, delta->old_file.size);
cl_assert_equal_oid(git_blob_id(d), &delta->new_file.id); cl_assert_equal_oid(git_blob_id(d), &delta->new_file.id);
cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size); cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size);
...@@ -445,9 +445,9 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void) ...@@ -445,9 +445,9 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
cl_assert(delta != NULL); cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_UNMODIFIED, delta->status); cl_assert_equal_i(GIT_DELTA_UNMODIFIED, delta->status);
cl_assert_equal_sz(0, delta->old_file.size); cl_assert_equal_sz(0, delta->old_file.size);
cl_assert(git_oid_iszero(&delta->old_file.id)); cl_assert(git_oid_is_zero(&delta->old_file.id));
cl_assert_equal_sz(0, delta->new_file.size); cl_assert_equal_sz(0, delta->new_file.size);
cl_assert(git_oid_iszero(&delta->new_file.id)); cl_assert(git_oid_is_zero(&delta->new_file.id));
cl_assert_equal_i(0, (int)git_patch_num_hunks(p)); cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
git_patch_free(p); git_patch_free(p);
...@@ -520,19 +520,19 @@ void test_diff_blob__can_compare_a_binary_blob_and_a_text_blob(void) ...@@ -520,19 +520,19 @@ void test_diff_blob__can_compare_a_binary_blob_and_a_text_blob(void)
* +++ b/a0f7217 * +++ b/a0f7217
* @@ -1,6 +1,6 @@ * @@ -1,6 +1,6 @@
* Here is some stuff at the start * Here is some stuff at the start
* *
* -This should go in one hunk * -This should go in one hunk
* +This should go in one hunk (first) * +This should go in one hunk (first)
* *
* Some additional lines * Some additional lines
* *
* @@ -8,7 +8,7 @@ Down here below the other lines * @@ -8,7 +8,7 @@ Down here below the other lines
* *
* With even more at the end * With even more at the end
* *
* -Followed by a second hunk of stuff * -Followed by a second hunk of stuff
* +Followed by a second hunk of stuff (second) * +Followed by a second hunk of stuff (second)
* *
* That happens down here * That happens down here
*/ */
void test_diff_blob__comparing_two_text_blobs_honors_interhunkcontext(void) void test_diff_blob__comparing_two_text_blobs_honors_interhunkcontext(void)
......
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