int gpg_verify_tag(const struct object_id *oid, const char *name_to_report, unsigned flags) { enum object_type type; char *buf; unsigned long size; int ret; type = oid_object_info(the_repository, oid, NULL); if (type != OBJ_TAG) return error("%s: cannot verify a non-tag object of type %s.", name_to_report ? name_to_report : find_unique_abbrev(oid, DEFAULT_ABBREV), type_name(type)); buf = read_object_file(oid, &type, &size); if (!buf) return error("%s: unable to read file.", name_to_report ? name_to_report : find_unique_abbrev(oid, DEFAULT_ABBREV)); ret = run_gpg_verify(buf, size, flags); free(buf); return ret; }
static int verify_tag(const char *name, int verbose) { enum object_type type; unsigned char sha1[20]; char *buf; unsigned long size; int ret; if (get_sha1(name, sha1)) return error("tag '%s' not found.", name); type = sha1_object_info(sha1, NULL); if (type != OBJ_TAG) return error("%s: cannot verify a non-tag object of type %s.", name, typename(type)); buf = read_sha1_file(sha1, &type, &size); if (!buf) return error("%s: unable to read file.", name); ret = run_gpg_verify(buf, size, verbose); free(buf); return ret; }
static int verify_commit(const char *name, unsigned flags) { enum object_type type; unsigned char sha1[20]; char *buf; unsigned long size; int ret; if (get_sha1(name, sha1)) return error("commit '%s' not found.", name); buf = read_sha1_file(sha1, &type, &size); if (!buf) 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)); ret = run_gpg_verify(sha1, buf, size, flags); free(buf); return ret; }