summaryrefslogtreecommitdiff
path: root/shallow.c
diff options
context:
space:
mode:
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 cdd0775..d08d264 100644
--- a/shallow.c
+++ b/shallow.c
@@ -22,7 +22,7 @@ void set_alternate_shallow_file(const char *path, int override)
if (alternate_shallow_file && !override)
return;
free(alternate_shallow_file);
- alternate_shallow_file = path ? xstrdup(path) : NULL;
+ alternate_shallow_file = xstrdup_or_null(path);
}
int register_shallow(const unsigned char *sha1)
@@ -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;
@@ -137,7 +137,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
return result;
}
-void check_shallow_file_for_update(void)
+static void check_shallow_file_for_update(void)
{
if (is_shallow == -1)
die("BUG: shallow must be initialized by now");
@@ -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;
}