summaryrefslogtreecommitdiff
path: root/ref-filter.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-04-20 04:37:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-20 04:37:13 (GMT)
commitb1081e4004091947b6c6a806625addd1cbba61b7 (patch)
tree2cf8dfc6a5e33499b5dbcc8b3e94dbe311e2acfa /ref-filter.c
parentc703555cc89cf6aedf549a1233b242d8cb8e0f20 (diff)
parente239dabb1465d3ff927840b4fff15150a2170b4e (diff)
downloadgit-b1081e4004091947b6c6a806625addd1cbba61b7.zip
git-b1081e4004091947b6c6a806625addd1cbba61b7.tar.gz
git-b1081e4004091947b6c6a806625addd1cbba61b7.tar.bz2
Merge branch 'bc/object-id'
Conversion from unsigned char [40] to struct object_id continues. * bc/object-id: Documentation: update and rename api-sha1-array.txt Rename sha1_array to oid_array Convert sha1_array_for_each_unique and for_each_abbrev to object_id Convert sha1_array_lookup to take struct object_id Convert remaining callers of sha1_array_lookup to object_id Make sha1_array_append take a struct object_id * sha1-array: convert internal storage for struct sha1_array to object_id builtin/pull: convert to struct object_id submodule: convert check_for_new_submodule_commits to object_id sha1_name: convert disambiguate_hint_fn to take object_id sha1_name: convert struct disambiguate_state to object_id test-sha1-array: convert most code to struct object_id parse-options-cb: convert sha1_array_append caller to struct object_id fsck: convert init_skiplist to struct object_id builtin/receive-pack: convert portions to struct object_id builtin/pull: convert portions to struct object_id builtin/diff: convert to struct object_id Convert GIT_SHA1_RAWSZ used for allocation to GIT_MAX_RAWSZ Convert GIT_SHA1_HEXSZ used for allocation to GIT_MAX_HEXSZ Define new hash-size constants for allocating memory
Diffstat (limited to 'ref-filter.c')
-rw-r--r--ref-filter.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/ref-filter.c b/ref-filter.c
index 1e39273..3a64044 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1678,22 +1678,22 @@ static int filter_pattern_match(struct ref_filter *filter, const char *refname)
* the need to parse the object via parse_object(). peel_ref() might be a
* more efficient alternative to obtain the pointee.
*/
-static const unsigned char *match_points_at(struct sha1_array *points_at,
- const unsigned char *sha1,
- const char *refname)
+static const struct object_id *match_points_at(struct oid_array *points_at,
+ const struct object_id *oid,
+ const char *refname)
{
- const unsigned char *tagged_sha1 = NULL;
+ const struct object_id *tagged_oid = NULL;
struct object *obj;
- if (sha1_array_lookup(points_at, sha1) >= 0)
- return sha1;
- obj = parse_object(sha1);
+ if (oid_array_lookup(points_at, oid) >= 0)
+ return oid;
+ obj = parse_object(oid->hash);
if (!obj)
die(_("malformed object at '%s'"), refname);
if (obj->type == OBJ_TAG)
- tagged_sha1 = ((struct tag *)obj)->tagged->oid.hash;
- if (tagged_sha1 && sha1_array_lookup(points_at, tagged_sha1) >= 0)
- return tagged_sha1;
+ tagged_oid = &((struct tag *)obj)->tagged->oid;
+ if (tagged_oid && oid_array_lookup(points_at, tagged_oid) >= 0)
+ return tagged_oid;
return NULL;
}
@@ -1773,7 +1773,7 @@ static int ref_filter_handler(const char *refname, const struct object_id *oid,
if (!filter_pattern_match(filter, refname))
return 0;
- if (filter->points_at.nr && !match_points_at(&filter->points_at, oid->hash, refname))
+ if (filter->points_at.nr && !match_points_at(&filter->points_at, oid, refname))
return 0;
/*