builtin/verify-commit: convert to struct object_id
This is a prerequisite to convert to lookup_commit, which we will convert later. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
May 6, 2017 at 22:10 UTC
eee886cfb0de096a4b0144bba4fddaf1db0a4555
1 file changed
+6
-6
builtin/verify-commit.c
+6
-6
@@ -18,14 +18,14 @@ static const char * const verify_commit_usage[] = {
18
NULL
19
};
20
21
-static int run_gpg_verify(const unsigned char *sha1, const char *buf, unsigned long size, unsigned flags)
21
+static int run_gpg_verify(const struct object_id *oid, const char *buf, unsigned long size, unsigned flags)
22
{
23
struct signature_check signature_check;
24
int ret;
25
26
memset(&signature_check, 0, sizeof(signature_check));
27
28
- ret = check_commit_signature(lookup_commit(sha1), &signature_check);
28
+ ret = check_commit_signature(lookup_commit(oid->hash), &signature_check);
29
print_signature_buffer(&signature_check, flags);
30
31
signature_check_clear(&signature_check);
@@ -35,22 +35,22 @@ static int run_gpg_verify(const unsigned char *sha1, const char *buf, unsigned l
35
static int verify_commit(const char *name, unsigned flags)
36
{
37
enum object_type type;
38
- unsigned char sha1[20];
38
+ struct object_id oid;
39
char *buf;
40
unsigned long size;
41
int ret;
42
43
- if (get_sha1(name, sha1))
43
+ if (get_oid(name, &oid))
44
return error("commit '%s' not found.", name);
45
46
- buf = read_sha1_file(sha1, &type, &size);
46
+ buf = read_sha1_file(oid.hash, &type, &size);
47
if (!buf)
48
return error("%s: unable to read file.", name);
49
if (type != OBJ_COMMIT)
50
return error("%s: cannot verify a non-commit object of type %s.",
51
name, typename(type));
52
53
- ret = run_gpg_verify(sha1, buf, size, flags);
53
+ ret = run_gpg_verify(&oid, buf, size, flags);
54
55
free(buf);
56
return ret;