mirror of
https://github.com/git/git.git
synced 2024-11-23 09:56:28 +08:00
object: rename function 'typename' to 'type_name'
Rename C++ keyword in order to bring the codebase closer to being able to be compiled with a C++ compiler. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
6ca32f4714
commit
debca9d2fe
@ -229,7 +229,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,
|
||||
if (data->mark_query)
|
||||
data->info.typep = &data->type;
|
||||
else
|
||||
strbuf_addstr(sb, typename(data->type));
|
||||
strbuf_addstr(sb, type_name(data->type));
|
||||
} else if (is_atom("objectsize", atom, len)) {
|
||||
if (data->mark_query)
|
||||
data->info.sizep = &data->size;
|
||||
|
@ -76,7 +76,7 @@ static int diff_tree_stdin(char *line)
|
||||
if (obj->type == OBJ_TREE)
|
||||
return stdin_diff_trees((struct tree *)obj, p);
|
||||
error("Object %s is a %s, not a commit or tree",
|
||||
oid_to_hex(&oid), typename(obj->type));
|
||||
oid_to_hex(&oid), type_name(obj->type));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ static void export_blob(const struct object_id *oid)
|
||||
buf = read_sha1_file(oid->hash, &type, &size);
|
||||
if (!buf)
|
||||
die ("Could not read blob %s", oid_to_hex(oid));
|
||||
if (check_sha1_signature(oid->hash, buf, size, typename(type)) < 0)
|
||||
if (check_sha1_signature(oid->hash, buf, size, type_name(type)) < 0)
|
||||
die("sha1 mismatch in blob %s", oid_to_hex(oid));
|
||||
object = parse_object_buffer(oid, type, size, buf, &eaten);
|
||||
}
|
||||
@ -757,7 +757,7 @@ static void handle_tag(const char *name, struct tag *tag)
|
||||
if (tagged->type != OBJ_COMMIT) {
|
||||
die ("Tag %s tags unexported %s!",
|
||||
oid_to_hex(&tag->object.oid),
|
||||
typename(tagged->type));
|
||||
type_name(tagged->type));
|
||||
}
|
||||
p = (struct commit *)tagged;
|
||||
for (;;) {
|
||||
@ -839,7 +839,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
|
||||
if (!commit) {
|
||||
warning("%s: Unexpected object of type %s, skipping.",
|
||||
e->name,
|
||||
typename(e->item->type));
|
||||
type_name(e->item->type));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -851,7 +851,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
|
||||
continue;
|
||||
default: /* OBJ_TAG (nested tags) is already handled */
|
||||
warning("Tag points to object of unexpected type %s, skipping.",
|
||||
typename(commit->object.type));
|
||||
type_name(commit->object.type));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ static const char *printable_type(struct object *obj)
|
||||
object_as_type(obj, type, 0);
|
||||
}
|
||||
|
||||
ret = typename(obj->type);
|
||||
ret = type_name(obj->type);
|
||||
if (!ret)
|
||||
ret = "unknown";
|
||||
|
||||
@ -137,7 +137,7 @@ static int mark_object(struct object *obj, int type, void *data, struct fsck_opt
|
||||
printf("broken link from %7s %s\n",
|
||||
printable_type(parent), describe_object(parent));
|
||||
printf("broken link from %7s %s\n",
|
||||
(type == OBJ_ANY ? "unknown" : typename(type)), "unknown");
|
||||
(type == OBJ_ANY ? "unknown" : type_name(type)), "unknown");
|
||||
errors_found |= ERROR_REACHABLE;
|
||||
return 1;
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
|
||||
free(data);
|
||||
return hit;
|
||||
}
|
||||
die(_("unable to grep from object of type %s"), typename(obj->type));
|
||||
die(_("unable to grep from object of type %s"), type_name(obj->type));
|
||||
}
|
||||
|
||||
static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,
|
||||
|
@ -228,7 +228,7 @@ static unsigned check_object(struct object *obj)
|
||||
if (type != obj->type)
|
||||
die(_("object %s: expected type %s, found %s"),
|
||||
oid_to_hex(&obj->oid),
|
||||
typename(obj->type), typename(type));
|
||||
type_name(obj->type), type_name(type));
|
||||
obj->flags |= FLAG_CHECKED;
|
||||
return 1;
|
||||
}
|
||||
@ -448,7 +448,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size,
|
||||
int hdrlen;
|
||||
|
||||
if (!is_delta_type(type)) {
|
||||
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), size) + 1;
|
||||
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), size) + 1;
|
||||
git_SHA1_Init(&c);
|
||||
git_SHA1_Update(&c, hdr, hdrlen);
|
||||
} else
|
||||
@ -849,7 +849,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
|
||||
obj = parse_object_buffer(oid, type, size, buf,
|
||||
&eaten);
|
||||
if (!obj)
|
||||
die(_("invalid %s"), typename(type));
|
||||
die(_("invalid %s"), type_name(type));
|
||||
if (do_fsck_object &&
|
||||
fsck_object(obj, buf, size, &fsck_options))
|
||||
die(_("Error in object"));
|
||||
@ -959,7 +959,7 @@ static void resolve_delta(struct object_entry *delta_obj,
|
||||
if (!result->data)
|
||||
bad_object(delta_obj->idx.offset, _("failed to apply delta"));
|
||||
hash_sha1_file(result->data, result->size,
|
||||
typename(delta_obj->real_type),
|
||||
type_name(delta_obj->real_type),
|
||||
delta_obj->idx.oid.hash);
|
||||
sha1_object(result->data, NULL, result->size, delta_obj->real_type,
|
||||
&delta_obj->idx.oid);
|
||||
@ -1379,7 +1379,7 @@ static void fix_unresolved_deltas(struct sha1file *f)
|
||||
continue;
|
||||
|
||||
if (check_sha1_signature(d->sha1, base_obj->data,
|
||||
base_obj->size, typename(type)))
|
||||
base_obj->size, type_name(type)))
|
||||
die(_("local object %s is corrupt"), sha1_to_hex(d->sha1));
|
||||
base_obj->obj = append_obj_to_pack(f, d->sha1,
|
||||
base_obj->data, base_obj->size, type);
|
||||
@ -1588,7 +1588,7 @@ static void show_pack_info(int stat_only)
|
||||
continue;
|
||||
printf("%s %-6s %lu %lu %"PRIuMAX,
|
||||
oid_to_hex(&obj->idx.oid),
|
||||
typename(obj->real_type), obj->size,
|
||||
type_name(obj->real_type), obj->size,
|
||||
(unsigned long)(obj[1].idx.offset - obj->idx.offset),
|
||||
(uintmax_t)obj->idx.offset);
|
||||
if (is_delta_type(obj->type)) {
|
||||
|
@ -520,7 +520,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
|
||||
if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
|
||||
strbuf_addf(msg, "%s\t\t%s '%s'\n",
|
||||
oid_to_hex(&desc->obj->oid),
|
||||
typename(desc->obj->type),
|
||||
type_name(desc->obj->type),
|
||||
remote);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
|
||||
mode_type = object_type(mode);
|
||||
if (mode_type != type_from_string(ptr)) {
|
||||
die("entry '%s' object type (%s) doesn't match mode type (%s)",
|
||||
path, ptr, typename(mode_type));
|
||||
path, ptr, type_name(mode_type));
|
||||
}
|
||||
|
||||
/* Check the type of object identified by sha1 */
|
||||
@ -131,7 +131,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
|
||||
* because the new tree entry will never be correct.
|
||||
*/
|
||||
die("entry '%s' object %s is a %s but specified type was (%s)",
|
||||
path, sha1_to_hex(sha1), typename(obj_type), typename(mode_type));
|
||||
path, sha1_to_hex(sha1), type_name(obj_type), type_name(mode_type));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
|
||||
if (show_only || verbose) {
|
||||
enum object_type type = sha1_object_info(oid->hash, NULL);
|
||||
printf("%s %s\n", oid_to_hex(oid),
|
||||
(type > 0) ? typename(type) : "unknown");
|
||||
(type > 0) ? type_name(type) : "unknown");
|
||||
}
|
||||
if (!show_only)
|
||||
unlink_or_warn(fullpath);
|
||||
|
@ -56,8 +56,8 @@ static int show_reference(const char *refname, const struct object_id *oid,
|
||||
obj_type = sha1_object_info(object.hash, NULL);
|
||||
repl_type = sha1_object_info(oid->hash, NULL);
|
||||
|
||||
printf("%s (%s) -> %s (%s)\n", refname, typename(obj_type),
|
||||
oid_to_hex(oid), typename(repl_type));
|
||||
printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
|
||||
oid_to_hex(oid), type_name(repl_type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,8 +168,8 @@ static int replace_object_oid(const char *object_ref,
|
||||
die("Objects must be of the same type.\n"
|
||||
"'%s' points to a replaced object of type '%s'\n"
|
||||
"while '%s' points to a replacement object of type '%s'.",
|
||||
object_ref, typename(obj_type),
|
||||
replace_ref, typename(repl_type));
|
||||
object_ref, type_name(obj_type),
|
||||
replace_ref, type_name(repl_type));
|
||||
|
||||
check_ref_valid(object, &prev, &ref, force);
|
||||
|
||||
@ -215,7 +215,7 @@ static void export_object(const struct object_id *oid, enum object_type type,
|
||||
argv_array_push(&cmd.args, "--no-replace-objects");
|
||||
argv_array_push(&cmd.args, "cat-file");
|
||||
if (raw)
|
||||
argv_array_push(&cmd.args, typename(type));
|
||||
argv_array_push(&cmd.args, type_name(type));
|
||||
else
|
||||
argv_array_push(&cmd.args, "-p");
|
||||
argv_array_push(&cmd.args, oid_to_hex(oid));
|
||||
@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,
|
||||
struct tag *tag;
|
||||
int i;
|
||||
|
||||
hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), tag_oid.hash);
|
||||
hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), tag_oid.hash);
|
||||
tag = lookup_tag(&tag_oid);
|
||||
if (!tag)
|
||||
die(_("bad mergetag in commit '%s'"), ref);
|
||||
|
@ -220,7 +220,7 @@ static void create_tag(const struct object_id *object, const char *tag,
|
||||
"tag %s\n"
|
||||
"tagger %s\n\n",
|
||||
oid_to_hex(object),
|
||||
typename(type),
|
||||
type_name(type),
|
||||
tag,
|
||||
git_committer_info(IDENT_STRICT));
|
||||
|
||||
|
@ -172,7 +172,7 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
|
||||
{
|
||||
struct object_id oid;
|
||||
|
||||
if (write_sha1_file(obj_buf->buffer, obj_buf->size, typename(obj->type), oid.hash) < 0)
|
||||
if (write_sha1_file(obj_buf->buffer, obj_buf->size, type_name(obj->type), oid.hash) < 0)
|
||||
die("failed to write object %s", oid_to_hex(&obj->oid));
|
||||
obj->flags |= FLAG_WRITTEN;
|
||||
}
|
||||
@ -237,14 +237,14 @@ static void write_object(unsigned nr, enum object_type type,
|
||||
void *buf, unsigned long size)
|
||||
{
|
||||
if (!strict) {
|
||||
if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)
|
||||
if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
|
||||
die("failed to write object");
|
||||
added_object(nr, type, buf, size);
|
||||
free(buf);
|
||||
obj_list[nr].obj = NULL;
|
||||
} else if (type == OBJ_BLOB) {
|
||||
struct blob *blob;
|
||||
if (write_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash) < 0)
|
||||
if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
|
||||
die("failed to write object");
|
||||
added_object(nr, type, buf, size);
|
||||
free(buf);
|
||||
@ -258,12 +258,12 @@ static void write_object(unsigned nr, enum object_type type,
|
||||
} else {
|
||||
struct object *obj;
|
||||
int eaten;
|
||||
hash_sha1_file(buf, size, typename(type), obj_list[nr].oid.hash);
|
||||
hash_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash);
|
||||
added_object(nr, type, buf, size);
|
||||
obj = parse_object_buffer(&obj_list[nr].oid, type, size, buf,
|
||||
&eaten);
|
||||
if (!obj)
|
||||
die("invalid %s", typename(type));
|
||||
die("invalid %s", type_name(type));
|
||||
add_object_buffer(obj, buf, size);
|
||||
obj->flags |= FLAG_OPEN;
|
||||
obj_list[nr].obj = obj;
|
||||
|
@ -49,7 +49,7 @@ static int verify_commit(const char *name, unsigned flags)
|
||||
return error("%s: unable to read file.", name);
|
||||
if (type != OBJ_COMMIT)
|
||||
return error("%s: cannot verify a non-commit object of type %s.",
|
||||
name, typename(type));
|
||||
name, type_name(type));
|
||||
|
||||
ret = run_gpg_verify(&oid, buf, size, flags);
|
||||
|
||||
|
@ -203,7 +203,7 @@ static int deflate_to_pack(struct bulk_checkin_state *state,
|
||||
return error("cannot find the current offset");
|
||||
|
||||
header_len = xsnprintf((char *)obuf, sizeof(obuf), "%s %" PRIuMAX,
|
||||
typename(type), (uintmax_t)size) + 1;
|
||||
type_name(type), (uintmax_t)size) + 1;
|
||||
git_SHA1_Init(&ctx);
|
||||
git_SHA1_Update(&ctx, obuf, header_len);
|
||||
|
||||
|
2
commit.c
2
commit.c
@ -274,7 +274,7 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)
|
||||
oid_to_hex(&commit->object.oid));
|
||||
if (type != OBJ_COMMIT)
|
||||
die("expected commit for %s, got %s",
|
||||
oid_to_hex(&commit->object.oid), typename(type));
|
||||
oid_to_hex(&commit->object.oid), type_name(type));
|
||||
if (sizep)
|
||||
*sizep = size;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ static char *get_stdin(void)
|
||||
|
||||
static void show_new(enum object_type type, unsigned char *sha1_new)
|
||||
{
|
||||
fprintf(stderr, " %s: %s\n", typename(type),
|
||||
fprintf(stderr, " %s: %s\n", type_name(type),
|
||||
find_unique_abbrev(sha1_new, DEFAULT_ABBREV));
|
||||
}
|
||||
|
||||
|
@ -1096,7 +1096,7 @@ static int store_object(
|
||||
git_zstream s;
|
||||
|
||||
hdrlen = xsnprintf((char *)hdr, sizeof(hdr), "%s %lu",
|
||||
typename(type), (unsigned long)dat->len) + 1;
|
||||
type_name(type), (unsigned long)dat->len) + 1;
|
||||
git_SHA1_Init(&c);
|
||||
git_SHA1_Update(&c, hdr, hdrlen);
|
||||
git_SHA1_Update(&c, dat->buf, dat->len);
|
||||
@ -2421,7 +2421,7 @@ static void file_change_m(const char *p, struct branch *b)
|
||||
else if (oe) {
|
||||
if (oe->type != OBJ_COMMIT)
|
||||
die("Not a commit (actually a %s): %s",
|
||||
typename(oe->type), command_buf.buf);
|
||||
type_name(oe->type), command_buf.buf);
|
||||
}
|
||||
/*
|
||||
* Accept the sha1 without checking; it expected to be in
|
||||
@ -2448,7 +2448,7 @@ static void file_change_m(const char *p, struct branch *b)
|
||||
command_buf.buf);
|
||||
if (type != expected)
|
||||
die("Not a %s (actually a %s): %s",
|
||||
typename(expected), typename(type),
|
||||
type_name(expected), type_name(type),
|
||||
command_buf.buf);
|
||||
}
|
||||
|
||||
@ -2599,14 +2599,14 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
|
||||
} else if (oe) {
|
||||
if (oe->type != OBJ_BLOB)
|
||||
die("Not a blob (actually a %s): %s",
|
||||
typename(oe->type), command_buf.buf);
|
||||
type_name(oe->type), command_buf.buf);
|
||||
} else if (!is_null_oid(&oid)) {
|
||||
enum object_type type = sha1_object_info(oid.hash, NULL);
|
||||
if (type < 0)
|
||||
die("Blob not found: %s", command_buf.buf);
|
||||
if (type != OBJ_BLOB)
|
||||
die("Not a blob (actually a %s): %s",
|
||||
typename(type), command_buf.buf);
|
||||
type_name(type), command_buf.buf);
|
||||
}
|
||||
|
||||
construct_path_with_fanout(oid_to_hex(&commit_oid), *old_fanout, path);
|
||||
@ -2914,7 +2914,7 @@ static void parse_new_tag(const char *arg)
|
||||
"object %s\n"
|
||||
"type %s\n"
|
||||
"tag %s\n",
|
||||
oid_to_hex(&oid), typename(type), t->name);
|
||||
oid_to_hex(&oid), type_name(type), t->name);
|
||||
if (tagger)
|
||||
strbuf_addf(&new_data,
|
||||
"tagger %s\n", tagger);
|
||||
@ -2985,10 +2985,10 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
|
||||
die("Can't read object %s", oid_to_hex(oid));
|
||||
if (type != OBJ_BLOB)
|
||||
die("Object %s is a %s but a blob was expected.",
|
||||
oid_to_hex(oid), typename(type));
|
||||
oid_to_hex(oid), type_name(type));
|
||||
strbuf_reset(&line);
|
||||
strbuf_addf(&line, "%s %s %lu\n", oid_to_hex(oid),
|
||||
typename(type), size);
|
||||
type_name(type), size);
|
||||
cat_blob_write(line.buf, line.len);
|
||||
strbuf_release(&line);
|
||||
cat_blob_write(buf, size);
|
||||
|
2
fsck.c
2
fsck.c
@ -821,7 +821,7 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
|
||||
ret = report(options, &tag->object,
|
||||
FSCK_MSG_TAG_OBJECT_NOT_TAG,
|
||||
"expected tag got %s",
|
||||
typename(type));
|
||||
type_name(type));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ static void start_put(struct transfer_request *request)
|
||||
git_zstream stream;
|
||||
|
||||
unpacked = read_sha1_file(request->obj->oid.hash, &type, &len);
|
||||
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
|
||||
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
|
||||
|
||||
/* Set it up */
|
||||
git_deflate_init(&stream, zlib_compression_level);
|
||||
|
@ -499,7 +499,7 @@ static void show_one_mergetag(struct commit *commit,
|
||||
int status, nth;
|
||||
size_t payload_size, gpg_message_offset;
|
||||
|
||||
hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);
|
||||
hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), oid.hash);
|
||||
tag = lookup_tag(&oid);
|
||||
if (!tag)
|
||||
return; /* error message already given */
|
||||
|
6
object.c
6
object.c
@ -26,7 +26,7 @@ static const char *object_type_strings[] = {
|
||||
"tag", /* OBJ_TAG = 4 */
|
||||
};
|
||||
|
||||
const char *typename(unsigned int type)
|
||||
const char *type_name(unsigned int type)
|
||||
{
|
||||
if (type >= ARRAY_SIZE(object_type_strings))
|
||||
return NULL;
|
||||
@ -166,7 +166,7 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet)
|
||||
if (!quiet)
|
||||
error("object %s is a %s, not a %s",
|
||||
oid_to_hex(&obj->oid),
|
||||
typename(obj->type), typename(type));
|
||||
type_name(obj->type), type_name(type));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -265,7 +265,7 @@ struct object *parse_object(const struct object_id *oid)
|
||||
|
||||
buffer = read_sha1_file(oid->hash, &type, &size);
|
||||
if (buffer) {
|
||||
if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {
|
||||
if (check_sha1_signature(repl, buffer, size, type_name(type)) < 0) {
|
||||
free(buffer);
|
||||
error("sha1 mismatch %s", sha1_to_hex(repl));
|
||||
return NULL;
|
||||
|
2
object.h
2
object.h
@ -53,7 +53,7 @@ struct object {
|
||||
struct object_id oid;
|
||||
};
|
||||
|
||||
extern const char *typename(unsigned int type);
|
||||
extern const char *type_name(unsigned int type);
|
||||
extern int type_from_string_gently(const char *str, ssize_t, int gentle);
|
||||
#define type_from_string(str) type_from_string_gently(str, -1, 0)
|
||||
|
||||
|
@ -141,7 +141,7 @@ static int verify_packfile(struct packed_git *p,
|
||||
err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
|
||||
oid_to_hex(entries[i].oid.oid), p->pack_name,
|
||||
(uintmax_t)entries[i].offset);
|
||||
else if (check_sha1_signature(entries[i].oid.hash, data, size, typename(type)))
|
||||
else if (check_sha1_signature(entries[i].oid.hash, data, size, type_name(type)))
|
||||
err = error("packed %s from %s is corrupt",
|
||||
oid_to_hex(entries[i].oid.oid), p->pack_name);
|
||||
else if (fn) {
|
||||
|
@ -1357,7 +1357,7 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,
|
||||
if (oi->typep)
|
||||
*oi->typep = ptot;
|
||||
if (oi->type_name) {
|
||||
const char *tn = typename(ptot);
|
||||
const char *tn = type_name(ptot);
|
||||
if (tn)
|
||||
strbuf_addstr(oi->type_name, tn);
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ static void add_recent_object(const struct object_id *oid,
|
||||
break;
|
||||
default:
|
||||
die("unknown object type for %s: %s",
|
||||
oid_to_hex(oid), typename(type));
|
||||
oid_to_hex(oid), type_name(type));
|
||||
}
|
||||
|
||||
if (!obj)
|
||||
|
@ -769,7 +769,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
|
||||
if (deref)
|
||||
name++;
|
||||
if (!strcmp(name, "objecttype"))
|
||||
v->s = typename(obj->type);
|
||||
v->s = type_name(obj->type);
|
||||
else if (!strcmp(name, "objectsize")) {
|
||||
v->value = sz;
|
||||
v->s = xstrfmt("%lu", sz);
|
||||
@ -795,7 +795,7 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
|
||||
if (!strcmp(name, "tag"))
|
||||
v->s = tag->tag;
|
||||
else if (!strcmp(name, "type") && tag->tagged)
|
||||
v->s = typename(tag->tagged->type);
|
||||
v->s = type_name(tag->tagged->type);
|
||||
else if (!strcmp(name, "object") && tag->tagged)
|
||||
v->s = xstrdup(oid_to_hex(&tag->tagged->oid));
|
||||
}
|
||||
|
@ -2348,7 +2348,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
|
||||
if (!lookup_commit_reference_gently(&oid, 1)) {
|
||||
enum object_type type = sha1_object_info(oid.hash, NULL);
|
||||
return error(_("%s: can't cherry-pick a %s"),
|
||||
name, typename(type));
|
||||
name, type_name(type));
|
||||
}
|
||||
} else
|
||||
return error(_("%s: bad revision"), name);
|
||||
|
20
sha1_file.c
20
sha1_file.c
@ -805,7 +805,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map,
|
||||
return -1;
|
||||
|
||||
/* Generate the header */
|
||||
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(obj_type), size) + 1;
|
||||
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(obj_type), size) + 1;
|
||||
|
||||
/* Sha1.. */
|
||||
git_SHA1_Init(&c);
|
||||
@ -1240,7 +1240,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
|
||||
if (oi->delta_base_sha1)
|
||||
hashclr(oi->delta_base_sha1);
|
||||
if (oi->type_name)
|
||||
strbuf_addstr(oi->type_name, typename(co->type));
|
||||
strbuf_addstr(oi->type_name, type_name(co->type));
|
||||
if (oi->contentp)
|
||||
*oi->contentp = xmemdupz(co->buf, co->size);
|
||||
oi->whence = OI_CACHED;
|
||||
@ -1317,7 +1317,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,
|
||||
{
|
||||
struct cached_object *co;
|
||||
|
||||
hash_sha1_file(buf, len, typename(type), sha1);
|
||||
hash_sha1_file(buf, len, type_name(type), sha1);
|
||||
if (has_sha1_file(sha1) || find_cached_object(sha1))
|
||||
return 0;
|
||||
ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
|
||||
@ -1683,7 +1683,7 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)
|
||||
buf = read_object(sha1, &type, &len);
|
||||
if (!buf)
|
||||
return error("cannot read sha1_file for %s", sha1_to_hex(sha1));
|
||||
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
|
||||
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
|
||||
ret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
|
||||
free(buf);
|
||||
|
||||
@ -1767,9 +1767,9 @@ static int index_mem(struct object_id *oid, void *buf, size_t size,
|
||||
}
|
||||
|
||||
if (write_object)
|
||||
ret = write_sha1_file(buf, size, typename(type), oid->hash);
|
||||
ret = write_sha1_file(buf, size, type_name(type), oid->hash);
|
||||
else
|
||||
ret = hash_sha1_file(buf, size, typename(type), oid->hash);
|
||||
ret = hash_sha1_file(buf, size, type_name(type), oid->hash);
|
||||
if (re_allocated)
|
||||
free(buf);
|
||||
return ret;
|
||||
@ -1789,10 +1789,10 @@ static int index_stream_convert_blob(struct object_id *oid, int fd,
|
||||
get_safe_crlf(flags));
|
||||
|
||||
if (write_object)
|
||||
ret = write_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
|
||||
ret = write_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
|
||||
oid->hash);
|
||||
else
|
||||
ret = hash_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
|
||||
ret = hash_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
|
||||
oid->hash);
|
||||
strbuf_release(&sbuf);
|
||||
return ret;
|
||||
@ -1942,7 +1942,7 @@ void assert_sha1_type(const unsigned char *sha1, enum object_type expect)
|
||||
die("%s is not a valid object", sha1_to_hex(sha1));
|
||||
if (type != expect)
|
||||
die("%s is not a valid '%s' object", sha1_to_hex(sha1),
|
||||
typename(expect));
|
||||
type_name(expect));
|
||||
}
|
||||
|
||||
int for_each_file_in_obj_subdir(unsigned int subdir_nr,
|
||||
@ -2187,7 +2187,7 @@ int read_loose_object(const char *path,
|
||||
goto out;
|
||||
}
|
||||
if (check_sha1_signature(expected_sha1, *contents,
|
||||
*size, typename(*type))) {
|
||||
*size, type_name(*type))) {
|
||||
error("sha1 mismatch for %s (expected %s)", path,
|
||||
sha1_to_hex(expected_sha1));
|
||||
free(*contents);
|
||||
|
@ -381,7 +381,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
|
||||
|
||||
advise(" %s %s%s",
|
||||
find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
|
||||
typename(type) ? typename(type) : "unknown type",
|
||||
type_name(type) ? type_name(type) : "unknown type",
|
||||
desc.buf);
|
||||
|
||||
strbuf_release(&desc);
|
||||
@ -901,8 +901,8 @@ struct object *peel_to_type(const char *name, int namelen,
|
||||
if (name)
|
||||
error("%.*s: expected %s type, but the object "
|
||||
"dereferences to %s type",
|
||||
namelen, name, typename(expected_type),
|
||||
typename(o->type));
|
||||
namelen, name, type_name(expected_type),
|
||||
type_name(o->type));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -831,7 +831,7 @@ static int check_has_commit(const struct object_id *oid, void *data)
|
||||
return 0;
|
||||
default:
|
||||
die(_("submodule entry '%s' (%s) is a %s, not a commit"),
|
||||
cb->path, oid_to_hex(oid), typename(type));
|
||||
cb->path, oid_to_hex(oid), type_name(type));
|
||||
}
|
||||
}
|
||||
|
||||
|
2
tag.c
2
tag.c
@ -47,7 +47,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
|
||||
name_to_report ?
|
||||
name_to_report :
|
||||
find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
|
||||
typename(type));
|
||||
type_name(type));
|
||||
|
||||
buf = read_sha1_file(oid->hash, &type, &size);
|
||||
if (!buf)
|
||||
|
4
walker.c
4
walker.c
@ -22,7 +22,7 @@ void walker_say(struct walker *walker, const char *fmt, ...)
|
||||
static void report_missing(const struct object *obj)
|
||||
{
|
||||
fprintf(stderr, "Cannot obtain needed %s %s\n",
|
||||
obj->type ? typename(obj->type): "object",
|
||||
obj->type ? type_name(obj->type): "object",
|
||||
oid_to_hex(&obj->oid));
|
||||
if (!is_null_oid(¤t_commit_oid))
|
||||
fprintf(stderr, "while processing commit %s.\n",
|
||||
@ -134,7 +134,7 @@ static int process_object(struct walker *walker, struct object *obj)
|
||||
}
|
||||
return error("Unable to determine requirements "
|
||||
"of type %s for %s",
|
||||
typename(obj->type), oid_to_hex(&obj->oid));
|
||||
type_name(obj->type), oid_to_hex(&obj->oid));
|
||||
}
|
||||
|
||||
static int process(struct walker *walker, struct object *obj)
|
||||
|
Loading…
Reference in New Issue
Block a user