current_bad_oid = xmalloc(sizeof(*current_bad_oid));
oidcpy(current_bad_oid, oid);
} else if (starts_with(refname, good_prefix.buf)) {
- sha1_array_append(&good_revs, oid->hash);
+ sha1_array_append(&good_revs, oid);
} else if (starts_with(refname, "skip-")) {
- sha1_array_append(&skipped_revs, oid->hash);
+ sha1_array_append(&skipped_revs, oid);
}
strbuf_release(&good_prefix);
const char *path,
void *data)
{
- sha1_array_append(data, oid->hash);
+ sha1_array_append(data, oid);
return 0;
}
uint32_t pos,
void *data)
{
- sha1_array_append(data, oid->hash);
+ sha1_array_append(data, oid);
return 0;
}
if (!revs->dense_combined_merges && !revs->combine_merges)
revs->dense_combined_merges = revs->combine_merges = 1;
for (i = 1; i < ents; i++)
- sha1_array_append(&parents, ent[i].item->oid.hash);
+ sha1_array_append(&parents, &ent[i].item->oid);
diff_tree_combined(ent[0].item->oid.hash, &parents,
revs->dense_combined_merges, revs);
sha1_array_clear(&parents);
const char *name,
void *data)
{
- sha1_array_append(&recent_objects, obj->oid.hash);
+ sha1_array_append(&recent_objects, &obj->oid);
}
static void record_recent_commit(struct commit *commit, void *data)
{
- sha1_array_append(&recent_objects, commit->object.oid.hash);
+ sha1_array_append(&recent_objects, &commit->object.oid);
}
static void get_object_list(int ac, const char **av)
continue; /* invalid line: does not start with SHA1 */
if (starts_with(sb.buf + GIT_SHA1_HEXSZ, "\tnot-for-merge\t"))
continue; /* ref is not-for-merge */
- sha1_array_append(merge_heads, oid.hash);
+ sha1_array_append(merge_heads, &oid);
}
fclose(fp);
strbuf_release(&sb);
if (si->used_shallow[i] &&
(si->used_shallow[i][cmd->index / 32] & mask) &&
!delayed_reachability_test(si, i))
- sha1_array_append(&extra, si->shallow->oid[i].hash);
+ sha1_array_append(&extra, &si->shallow->oid[i]);
opt.env = tmp_objdir_env(tmp_objdir);
setup_alternate_shallow(&shallow_lock, &opt.shallow_file, &extra);
if (get_oid_hex(line + 8, &oid))
die("protocol error: expected shallow sha, got '%s'",
line + 8);
- sha1_array_append(shallow, oid.hash);
+ sha1_array_append(shallow, &oid);
continue;
}
for (cmd = commands; cmd; cmd = cmd->next) {
if (is_null_oid(&cmd->new_oid))
continue;
- sha1_array_append(ref, cmd->new_oid.hash);
+ sha1_array_append(ref, &cmd->new_oid);
cmd->index = ref->nr - 1;
}
si->ref = ref;
struct sha1_array parents = SHA1_ARRAY_INIT;
while (parent) {
- sha1_array_append(&parents, parent->item->object.oid.hash);
+ sha1_array_append(&parents, &parent->item->object.oid);
parent = parent->next;
}
diff_tree_combined(commit->object.oid.hash, &parents, dense, rev);
die("protocol error: expected shallow sha-1, got '%s'", arg);
if (!shallow_points)
die("repository on the other end cannot be shallow");
- sha1_array_append(shallow_points, old_oid.hash);
+ sha1_array_append(shallow_points, &old_oid);
continue;
}
}
if (extra_have && !strcmp(name, ".have")) {
- sha1_array_append(extra_have, old_oid.hash);
+ sha1_array_append(extra_have, &old_oid);
continue;
}
struct object_id *oid = si->shallow->oid;
for (i = 0; i < si->shallow->nr; i++)
if (has_object_file(&oid[i]))
- sha1_array_append(&extra, oid[i].hash);
+ sha1_array_append(&extra, &oid[i]);
if (extra.nr) {
setup_alternate_shallow(&shallow_lock,
&alternate_shallow_file,
if (!si->nr_ours && !si->nr_theirs)
return;
for (i = 0; i < nr_sought; i++)
- sha1_array_append(&ref, sought[i]->old_oid.hash);
+ sha1_array_append(&ref, &sought[i]->old_oid);
si->ref = &ref;
if (args->update_shallow) {
return;
}
for (i = 0; i < si->nr_ours; i++)
- sha1_array_append(&extra, oid[si->ours[i]].hash);
+ sha1_array_append(&extra, &oid[si->ours[i]]);
for (i = 0; i < si->nr_theirs; i++)
- sha1_array_append(&extra, oid[si->theirs[i]].hash);
+ sha1_array_append(&extra, &oid[si->theirs[i]]);
setup_alternate_shallow(&shallow_lock,
&alternate_shallow_file,
&extra);
break;
if (parse_oid_hex(buffer, &oid, &p) || *p != '\n')
die("Invalid SHA-1: %s", buffer);
- sha1_array_append(&skiplist, oid.hash);
+ sha1_array_append(&skiplist, &oid);
if (sorted && skiplist.nr > 1 &&
oidcmp(&skiplist.oid[skiplist.nr - 2],
&oid) > 0)
return -1;
if (get_oid(arg, &oid))
return error(_("malformed object name '%s'"), arg);
- sha1_array_append(opt->value, oid.hash);
+ sha1_array_append(opt->value, &oid);
return 0;
}
#include "sha1-array.h"
#include "sha1-lookup.h"
-void sha1_array_append(struct sha1_array *array, const unsigned char *sha1)
+void sha1_array_append(struct sha1_array *array, const struct object_id *oid)
{
ALLOC_GROW(array->oid, array->nr + 1, array->alloc);
- hashcpy(array->oid[array->nr++].hash, sha1);
+ oidcpy(&array->oid[array->nr++], oid);
array->sorted = 0;
}
#define SHA1_ARRAY_INIT { NULL, 0, 0, 0 }
-void sha1_array_append(struct sha1_array *array, const unsigned char *sha1);
+void sha1_array_append(struct sha1_array *array, const struct object_id *oid);
int sha1_array_lookup(struct sha1_array *array, const unsigned char *sha1);
void sha1_array_clear(struct sha1_array *array);
static int collect_ambiguous(const struct object_id *oid, void *data)
{
- sha1_array_append(data, oid->hash);
+ sha1_array_append(data, oid);
return 0;
}
if (!S_ISGITLINK(p->two->mode))
continue;
commits = submodule_commits(submodules, p->two->path);
- sha1_array_append(commits, p->two->oid.hash);
+ sha1_array_append(commits, &p->two->oid);
}
}
static int add_sha1_to_array(const char *ref, const struct object_id *oid,
int flags, void *data)
{
- sha1_array_append(data, oid->hash);
+ sha1_array_append(data, oid);
return 0;
}
initialized_fetch_ref_tips = 1;
}
- sha1_array_append(&ref_tips_after_fetch, oid->hash);
+ sha1_array_append(&ref_tips_after_fetch, oid);
}
static int add_sha1_to_argv(const unsigned char sha1[20], void *data)
if (skip_prefix(line.buf, "append ", &arg)) {
if (get_oid_hex(arg, &oid))
die("not a hexadecimal SHA1: %s", arg);
- sha1_array_append(&array, oid.hash);
+ sha1_array_append(&array, &oid);
} else if (skip_prefix(line.buf, "lookup ", &arg)) {
if (get_oid_hex(arg, &oid))
die("not a hexadecimal SHA1: %s", arg);
for (; ref; ref = ref->next)
if (!is_null_oid(&ref->new_oid))
- sha1_array_append(&commits, ref->new_oid.hash);
+ sha1_array_append(&commits,
+ &ref->new_oid);
if (!push_unpushed_submodules(&commits,
transport->remote->name,
for (; ref; ref = ref->next)
if (!is_null_oid(&ref->new_oid))
- sha1_array_append(&commits, ref->new_oid.hash);
+ sha1_array_append(&commits,
+ &ref->new_oid);
if (find_unpushed_submodules(&commits, transport->remote->name,
&needs_pushing)) {