@@ -15,5 +15,5 @@ struct blob *lookup_blob(struct repository *r, const struct object_id *oid)
struct object *obj = lookup_object(r, oid);
if (!obj)
return create_blob(r, oid);
- return object_as_type(obj, OBJ_BLOB, 0);
+ return object_as_type(obj, OBJ_BLOB);
}
@@ -221,7 +221,7 @@ static void mark_unreachable_referents(const struct object_id *oid)
enum object_type type = oid_object_info(the_repository,
&obj->oid, NULL);
if (type > 0)
- object_as_type(obj, type, 0);
+ object_as_type(obj, type);
}
options.walk = mark_used;
@@ -76,7 +76,7 @@ struct commit *lookup_commit(struct repository *r, const struct object_id *oid)
struct object *obj = lookup_object(r, oid);
if (!obj)
return create_commit(r, oid);
- return object_as_type(obj, OBJ_COMMIT, 0);
+ return object_as_type(obj, OBJ_COMMIT);
}
struct commit *lookup_commit_reference_by_name(const char *name)
@@ -188,7 +188,7 @@ char* oid_is_type_or_die_msg(const struct object_id *oid,
return strbuf_detach(&sb, NULL);
}
-void *object_as_type(struct object *obj, enum object_type type, int quiet)
+void *object_as_type(struct object *obj, enum object_type type)
{
if (obj->type == type) {
return obj;
@@ -199,10 +199,9 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet)
obj->type = type;
return obj;
} else {
- if (!quiet)
- error(_(object_type_mismatch_msg),
- oid_to_hex(&obj->oid),
- type_name(obj->type), type_name(type));
+ error(_(object_type_mismatch_msg),
+ oid_to_hex(&obj->oid),
+ type_name(obj->type), type_name(type));
return NULL;
}
}
@@ -121,7 +121,7 @@ struct object *lookup_object(struct repository *r, const struct object_id *oid);
void *create_object(struct repository *r, const struct object_id *oid, void *obj);
-void *object_as_type(struct object *obj, enum object_type type, int quiet);
+void *object_as_type(struct object *obj, enum object_type type);
void oid_is_type_or_die(const struct object_id *oid, enum object_type want,
enum object_type *type);
@@ -341,7 +341,7 @@ enum peel_status peel_object(const struct object_id *name, struct object_id *oid
if (o->type == OBJ_NONE) {
int type = oid_object_info(the_repository, name, NULL);
- if (type < 0 || !object_as_type(o, type, 0))
+ if (type < 0 || !object_as_type(o, type))
return PEEL_INVALID;
}
@@ -67,7 +67,7 @@ int cmd__reach(int ac, const char **av)
die("failed to load commit for input %s resulting in oid %s\n",
buf.buf, oid_to_hex(&oid));
- c = object_as_type(peeled, OBJ_COMMIT, 0);
+ c = object_as_type(peeled, OBJ_COMMIT);
if (!c)
die("failed to load commit for input %s resulting in oid %s\n",
@@ -109,7 +109,7 @@ struct tag *lookup_tag(struct repository *r, const struct object_id *oid)
struct object *obj = lookup_object(r, oid);
if (!obj)
return create_tag(r, oid);
- return object_as_type(obj, OBJ_TAG, 0);
+ return object_as_type(obj, OBJ_TAG);
}
static timestamp_t parse_tag_date(const char *buf, const char *tail)
@@ -112,7 +112,7 @@ struct tree *lookup_tree(struct repository *r, const struct object_id *oid)
struct object *obj = lookup_object(r, oid);
if (!obj)
return create_tree(r, oid);
- return object_as_type(obj, OBJ_TREE, 0);
+ return object_as_type(obj, OBJ_TREE);
}
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
Remove the now-unused "quiet" parameter from object_as_type(). As shown in preceding commits the previous users of this parameter were better off with higher-level APIs. The "quiet" parameter was originally introduced when the object_as_type() function was added in 8ff226a9d5e (add object_as_type helper for casting objects,. 2014-07-13), but the commit.c use-case for it is now gone. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- blob.c | 2 +- builtin/fsck.c | 2 +- commit.c | 2 +- object.c | 9 ++++----- object.h | 2 +- refs.c | 2 +- t/helper/test-reach.c | 2 +- tag.c | 2 +- tree.c | 2 +- 9 files changed, 12 insertions(+), 13 deletions(-)