From 7683e2e6e301835236539a33b2fba936dd1a0a2b Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Fri, 13 Mar 2015 23:39:34 +0000 Subject: commit: convert parts to struct object_id Convert struct commit_graft and necessary local parts of commit.c. Also, convert several constants based on the hex length of an SHA-1 to use GIT_SHA1_HEXSZ, and move several magic constants into variables for readability. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- shallow.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'shallow.c') diff --git a/shallow.c b/shallow.c index f5e67204a4..24872034ef 100644 --- a/shallow.c +++ b/shallow.c @@ -31,7 +31,7 @@ int register_shallow(const unsigned char *sha1) xmalloc(sizeof(struct commit_graft)); struct commit *commit = lookup_commit(sha1); - hashcpy(graft->sha1, sha1); + hashcpy(graft->oid.hash, sha1); graft->nr_parent = -1; if (commit && commit->object.parsed) commit->parents = NULL; @@ -159,11 +159,11 @@ struct write_shallow_data { static int write_one_shallow(const struct commit_graft *graft, void *cb_data) { struct write_shallow_data *data = cb_data; - const char *hex = sha1_to_hex(graft->sha1); + const char *hex = oid_to_hex(&graft->oid); if (graft->nr_parent != -1) return 0; if (data->flags & SEEN_ONLY) { - struct commit *c = lookup_commit(graft->sha1); + struct commit *c = lookup_commit(graft->oid.hash); if (!c || !(c->object.flags & SEEN)) { if (data->flags & VERBOSE) printf("Removing %s from .git/shallow\n", @@ -282,7 +282,7 @@ static int advertise_shallow_grafts_cb(const struct commit_graft *graft, void *c { int fd = *(int *)cb; if (graft->nr_parent == -1) - packet_write(fd, "shallow %s\n", sha1_to_hex(graft->sha1)); + packet_write(fd, "shallow %s\n", oid_to_hex(&graft->oid)); return 0; } -- cgit v1.2.1