Skip to content

Commit eee886c

Browse files
bk2204gitster
authored andcommitted
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>
1 parent 4322478 commit eee886c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

builtin/verify-commit.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ static const char * const verify_commit_usage[] = {
1818
NULL
1919
};
2020

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)
2222
{
2323
struct signature_check signature_check;
2424
int ret;
2525

2626
memset(&signature_check, 0, sizeof(signature_check));
2727

28-
ret = check_commit_signature(lookup_commit(sha1), &signature_check);
28+
ret = check_commit_signature(lookup_commit(oid->hash), &signature_check);
2929
print_signature_buffer(&signature_check, flags);
3030

3131
signature_check_clear(&signature_check);
@@ -35,22 +35,22 @@ static int run_gpg_verify(const unsigned char *sha1, const char *buf, unsigned l
3535
static int verify_commit(const char *name, unsigned flags)
3636
{
3737
enum object_type type;
38-
unsigned char sha1[20];
38+
struct object_id oid;
3939
char *buf;
4040
unsigned long size;
4141
int ret;
4242

43-
if (get_sha1(name, sha1))
43+
if (get_oid(name, &oid))
4444
return error("commit '%s' not found.", name);
4545

46-
buf = read_sha1_file(sha1, &type, &size);
46+
buf = read_sha1_file(oid.hash, &type, &size);
4747
if (!buf)
4848
return error("%s: unable to read file.", name);
4949
if (type != OBJ_COMMIT)
5050
return error("%s: cannot verify a non-commit object of type %s.",
5151
name, typename(type));
5252

53-
ret = run_gpg_verify(sha1, buf, size, flags);
53+
ret = run_gpg_verify(&oid, buf, size, flags);
5454

5555
free(buf);
5656
return ret;

0 commit comments

Comments
 (0)