summaryrefslogtreecommitdiff
path: root/shallow.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-05-06 22:10:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-08 06:12:57 (GMT)
commite92b848cb6a77172d2fbd2bda39a32e371d40eea (patch)
tree57161abfe9d8b50f2c4af07fd0bb363444eccd75 /shallow.c
parent68ab61dd099a2ce9f700fa68b9b7cc7722304407 (diff)
downloadgit-e92b848cb6a77172d2fbd2bda39a32e371d40eea.zip
git-e92b848cb6a77172d2fbd2bda39a32e371d40eea.tar.gz
git-e92b848cb6a77172d2fbd2bda39a32e371d40eea.tar.bz2
shallow: convert shallow registration functions to object_id
Convert register_shallow and unregister_shallow to take struct object_id. register_shallow is a caller of lookup_commit, which we will convert later. It doesn't make sense for the registration and unregistration functions to have incompatible interfaces, so convert them both. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'shallow.c')
-rw-r--r--shallow.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/shallow.c b/shallow.c
index 25b6db9..c520ae3 100644
--- a/shallow.c
+++ b/shallow.c
@@ -27,13 +27,13 @@ void set_alternate_shallow_file(const char *path, int override)
alternate_shallow_file = xstrdup_or_null(path);
}
-int register_shallow(const unsigned char *sha1)
+int register_shallow(const struct object_id *oid)
{
struct commit_graft *graft =
xmalloc(sizeof(struct commit_graft));
- struct commit *commit = lookup_commit(sha1);
+ struct commit *commit = lookup_commit(oid->hash);
- hashcpy(graft->oid.hash, sha1);
+ oidcpy(&graft->oid, oid);
graft->nr_parent = -1;
if (commit && commit->object.parsed)
commit->parents = NULL;
@@ -65,10 +65,10 @@ int is_repository_shallow(void)
is_shallow = 1;
while (fgets(buf, sizeof(buf), fp)) {
- unsigned char sha1[20];
- if (get_sha1_hex(buf, sha1))
+ struct object_id oid;
+ if (get_oid_hex(buf, &oid))
die("bad shallow line: %s", buf);
- register_shallow(sha1);
+ register_shallow(&oid);
}
fclose(fp);
return is_shallow;