Commit 910650d2 authored by brian m. carlson's avatar brian m. carlson Committed by Junio C Hamano

Rename sha1_array to oid_array

Since this structure handles an array of object IDs, rename it to struct
oid_array.  Also rename the accessor functions and the initialization
constant.

This commit was produced mechanically by providing non-Documentation
files to the following Perl one-liners:

    perl -pi -E 's/struct sha1_array/struct oid_array/g'
    perl -pi -E 's/\bsha1_array_/oid_array_/g'
    perl -pi -E 's/SHA1_ARRAY_INIT/OID_ARRAY_INIT/g'
Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 1b7ba794
......@@ -12,8 +12,8 @@
#include "sha1-array.h"
#include "argv-array.h"
static struct sha1_array good_revs;
static struct sha1_array skipped_revs;
static struct oid_array good_revs;
static struct oid_array skipped_revs;
static struct object_id *current_bad_oid;
......@@ -413,9 +413,9 @@ static int register_ref(const char *refname, const struct object_id *oid,
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);
oid_array_append(&good_revs, oid);
} else if (starts_with(refname, "skip-")) {
sha1_array_append(&skipped_revs, oid);
oid_array_append(&skipped_revs, oid);
}
strbuf_release(&good_prefix);
......@@ -451,7 +451,7 @@ static void read_bisect_paths(struct argv_array *array)
fclose(fp);
}
static char *join_sha1_array_hex(struct sha1_array *array, char delim)
static char *join_sha1_array_hex(struct oid_array *array, char delim)
{
struct strbuf joined_hexs = STRBUF_INIT;
int i;
......@@ -499,7 +499,7 @@ struct commit_list *filter_skipped(struct commit_list *list,
while (list) {
struct commit_list *next = list->next;
list->next = NULL;
if (0 <= sha1_array_lookup(&skipped_revs, &list->item->object.oid)) {
if (0 <= oid_array_lookup(&skipped_revs, &list->item->object.oid)) {
if (skipped_first && !*skipped_first)
*skipped_first = 1;
/* Move current to tried list */
......@@ -789,9 +789,9 @@ static void check_merge_bases(int no_checkout)
const struct object_id *mb = &result->item->object.oid;
if (!oidcmp(mb, current_bad_oid)) {
handle_bad_merge_base();
} else if (0 <= sha1_array_lookup(&good_revs, mb)) {
} else if (0 <= oid_array_lookup(&good_revs, mb)) {
continue;
} else if (0 <= sha1_array_lookup(&skipped_revs, mb)) {
} else if (0 <= oid_array_lookup(&skipped_revs, mb)) {
handle_skipped_merge_base(mb);
} else {
printf(_("Bisecting: a merge base must be tested\n"));
......
......@@ -413,7 +413,7 @@ static int batch_loose_object(const struct object_id *oid,
const char *path,
void *data)
{
sha1_array_append(data, oid);
oid_array_append(data, oid);
return 0;
}
......@@ -422,7 +422,7 @@ static int batch_packed_object(const struct object_id *oid,
uint32_t pos,
void *data)
{
sha1_array_append(data, oid);
oid_array_append(data, oid);
return 0;
}
......@@ -462,7 +462,7 @@ static int batch_objects(struct batch_options *opt)
data.info.typep = &data.type;
if (opt->all_objects) {
struct sha1_array sa = SHA1_ARRAY_INIT;
struct oid_array sa = OID_ARRAY_INIT;
struct object_cb_data cb;
for_each_loose_object(batch_loose_object, &sa, 0);
......@@ -470,9 +470,9 @@ static int batch_objects(struct batch_options *opt)
cb.opt = opt;
cb.expand = &data;
sha1_array_for_each_unique(&sa, batch_object_cb, &cb);
oid_array_for_each_unique(&sa, batch_object_cb, &cb);
sha1_array_clear(&sa);
oid_array_clear(&sa);
return 0;
}
......
......@@ -184,7 +184,7 @@ static int builtin_diff_combined(struct rev_info *revs,
struct object_array_entry *ent,
int ents)
{
struct sha1_array parents = SHA1_ARRAY_INIT;
struct oid_array parents = OID_ARRAY_INIT;
int i;
if (argc > 1)
......@@ -193,10 +193,10 @@ static int builtin_diff_combined(struct rev_info *revs,
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);
oid_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);
oid_array_clear(&parents);
return 0;
}
......
......@@ -50,7 +50,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
char **pack_lockfile_ptr = NULL;
struct child_process *conn;
struct fetch_pack_args args;
struct sha1_array shallow = SHA1_ARRAY_INIT;
struct oid_array shallow = OID_ARRAY_INIT;
struct string_list deepen_not = STRING_LIST_INIT_DUP;
packet_trace_identity("fetch-pack");
......
......@@ -2668,7 +2668,7 @@ static int has_sha1_pack_kept_or_nonlocal(const unsigned char *sha1)
*
* This is filled by get_object_list.
*/
static struct sha1_array recent_objects;
static struct oid_array recent_objects;
static int loosened_object_can_be_discarded(const struct object_id *oid,
unsigned long mtime)
......@@ -2677,7 +2677,7 @@ static int loosened_object_can_be_discarded(const struct object_id *oid,
return 0;
if (mtime > unpack_unreachable_expiration)
return 0;
if (sha1_array_lookup(&recent_objects, oid) >= 0)
if (oid_array_lookup(&recent_objects, oid) >= 0)
return 0;
return 1;
}
......@@ -2739,12 +2739,12 @@ static void record_recent_object(struct object *obj,
const char *name,
void *data)
{
sha1_array_append(&recent_objects, &obj->oid);
oid_array_append(&recent_objects, &obj->oid);
}
static void record_recent_commit(struct commit *commit, void *data)
{
sha1_array_append(&recent_objects, &commit->object.oid);
oid_array_append(&recent_objects, &commit->object.oid);
}
static void get_object_list(int ac, const char **av)
......@@ -2812,7 +2812,7 @@ static void get_object_list(int ac, const char **av)
if (unpack_unreachable)
loosen_unused_packed_objects(&revs);
sha1_array_clear(&recent_objects);
oid_array_clear(&recent_objects);
}
static int option_parse_index_version(const struct option *opt,
......
......@@ -330,7 +330,7 @@ static int git_pull_config(const char *var, const char *value, void *cb)
* Appends merge candidates from FETCH_HEAD that are not marked not-for-merge
* into merge_heads.
*/
static void get_merge_heads(struct sha1_array *merge_heads)
static void get_merge_heads(struct oid_array *merge_heads)
{
const char *filename = git_path("FETCH_HEAD");
FILE *fp;
......@@ -344,7 +344,7 @@ static void get_merge_heads(struct sha1_array *merge_heads)
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);
oid_array_append(merge_heads, &oid);
}
fclose(fp);
strbuf_release(&sb);
......@@ -769,7 +769,7 @@ static int run_rebase(const struct object_id *curr_head,
int cmd_pull(int argc, const char **argv, const char *prefix)
{
const char *repo, **refspecs;
struct sha1_array merge_heads = SHA1_ARRAY_INIT;
struct oid_array merge_heads = OID_ARRAY_INIT;
struct object_id orig_head, curr_head;
struct object_id rebase_fork_point;
......
......@@ -831,7 +831,7 @@ static int command_singleton_iterator(void *cb_data, unsigned char sha1[20]);
static int update_shallow_ref(struct command *cmd, struct shallow_info *si)
{
static struct lock_file shallow_lock;
struct sha1_array extra = SHA1_ARRAY_INIT;
struct oid_array extra = OID_ARRAY_INIT;
struct check_connected_options opt = CHECK_CONNECTED_INIT;
uint32_t mask = 1 << (cmd->index % 32);
int i;
......@@ -842,13 +842,13 @@ static int update_shallow_ref(struct command *cmd, struct shallow_info *si)
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]);
oid_array_append(&extra, &si->shallow->oid[i]);
opt.env = tmp_objdir_env(tmp_objdir);
setup_alternate_shallow(&shallow_lock, &opt.shallow_file, &extra);
if (check_connected(command_singleton_iterator, cmd, &opt)) {
rollback_lock_file(&shallow_lock);
sha1_array_clear(&extra);
oid_array_clear(&extra);
return -1;
}
......@@ -862,7 +862,7 @@ static int update_shallow_ref(struct command *cmd, struct shallow_info *si)
register_shallow(extra.oid[i].hash);
si->shallow_ref[cmd->index] = 0;
sha1_array_clear(&extra);
oid_array_clear(&extra);
return 0;
}
......@@ -1529,7 +1529,7 @@ static void queue_commands_from_cert(struct command **tail,
}
}
static struct command *read_head_info(struct sha1_array *shallow)
static struct command *read_head_info(struct oid_array *shallow)
{
struct command *commands = NULL;
struct command **p = &commands;
......@@ -1546,7 +1546,7 @@ static struct command *read_head_info(struct sha1_array *shallow)
if (get_oid_hex(line + 8, &oid))
die("protocol error: expected shallow sha, got '%s'",
line + 8);
sha1_array_append(shallow, &oid);
oid_array_append(shallow, &oid);
continue;
}
......@@ -1804,7 +1804,7 @@ static void prepare_shallow_update(struct command *commands,
static void update_shallow_info(struct command *commands,
struct shallow_info *si,
struct sha1_array *ref)
struct oid_array *ref)
{
struct command *cmd;
int *ref_status;
......@@ -1817,7 +1817,7 @@ static void update_shallow_info(struct command *commands,
for (cmd = commands; cmd; cmd = cmd->next) {
if (is_null_oid(&cmd->new_oid))
continue;
sha1_array_append(ref, &cmd->new_oid);
oid_array_append(ref, &cmd->new_oid);
cmd->index = ref->nr - 1;
}
si->ref = ref;
......@@ -1878,8 +1878,8 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
{
int advertise_refs = 0;
struct command *commands;
struct sha1_array shallow = SHA1_ARRAY_INIT;
struct sha1_array ref = SHA1_ARRAY_INIT;
struct oid_array shallow = OID_ARRAY_INIT;
struct oid_array ref = OID_ARRAY_INIT;
struct shallow_info si;
struct option options[] = {
......@@ -1971,8 +1971,8 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
}
if (use_sideband)
packet_flush(1);
sha1_array_clear(&shallow);
sha1_array_clear(&ref);
oid_array_clear(&shallow);
oid_array_clear(&ref);
free((void *)push_cert_nonce);
return 0;
}
......@@ -131,8 +131,8 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
const char *dest = NULL;
int fd[2];
struct child_process *conn;
struct sha1_array extra_have = SHA1_ARRAY_INIT;
struct sha1_array shallow = SHA1_ARRAY_INIT;
struct oid_array extra_have = OID_ARRAY_INIT;
struct oid_array shallow = OID_ARRAY_INIT;
struct ref *remote_refs, *local_refs;
int ret;
int helper_status = 0;
......
......@@ -1311,7 +1311,7 @@ static const char *path_path(void *obj)
/* find set of paths that every parent touches */
static struct combine_diff_path *find_paths_generic(const unsigned char *sha1,
const struct sha1_array *parents, struct diff_options *opt)
const struct oid_array *parents, struct diff_options *opt)
{
struct combine_diff_path *paths = NULL;
int i, num_parent = parents->nr;
......@@ -1359,7 +1359,7 @@ static struct combine_diff_path *find_paths_generic(const unsigned char *sha1,
* rename/copy detection, etc, comparing all trees simultaneously (= faster).
*/
static struct combine_diff_path *find_paths_multitree(
const unsigned char *sha1, const struct sha1_array *parents,
const unsigned char *sha1, const struct oid_array *parents,
struct diff_options *opt)
{
int i, nparent = parents->nr;
......@@ -1384,7 +1384,7 @@ static struct combine_diff_path *find_paths_multitree(
void diff_tree_combined(const unsigned char *sha1,
const struct sha1_array *parents,
const struct oid_array *parents,
int dense,
struct rev_info *rev)
{
......@@ -1532,12 +1532,12 @@ void diff_tree_combined_merge(const struct commit *commit, int dense,
struct rev_info *rev)
{
struct commit_list *parent = get_saved_parents(rev, commit);
struct sha1_array parents = SHA1_ARRAY_INIT;
struct oid_array parents = OID_ARRAY_INIT;
while (parent) {
sha1_array_append(&parents, &parent->item->object.oid);
oid_array_append(&parents, &parent->item->object.oid);
parent = parent->next;
}
diff_tree_combined(commit->object.oid.hash, &parents, dense, rev);
sha1_array_clear(&parents);
oid_array_clear(&parents);
}
......@@ -261,7 +261,7 @@ extern struct commit_list *get_merge_bases_many_dirty(struct commit *one, int n,
/* largest positive number a signed 32-bit integer can contain */
#define INFINITE_DEPTH 0x7fffffff
struct sha1_array;
struct oid_array;
struct ref;
extern int register_shallow(const unsigned char *sha1);
extern int unregister_shallow(const unsigned char *sha1);
......@@ -273,18 +273,18 @@ extern struct commit_list *get_shallow_commits_by_rev_list(
int ac, const char **av, int shallow_flag, int not_shallow_flag);
extern void set_alternate_shallow_file(const char *path, int override);
extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol,
const struct sha1_array *extra);
const struct oid_array *extra);
extern void setup_alternate_shallow(struct lock_file *shallow_lock,
const char **alternate_shallow_file,
const struct sha1_array *extra);
extern const char *setup_temporary_shallow(const struct sha1_array *extra);
const struct oid_array *extra);
extern const char *setup_temporary_shallow(const struct oid_array *extra);
extern void advertise_shallow_grafts(int);
struct shallow_info {
struct sha1_array *shallow;
struct oid_array *shallow;
int *ours, nr_ours;
int *theirs, nr_theirs;
struct sha1_array *ref;
struct oid_array *ref;
/* for receive-pack */
uint32_t **used_shallow;
......@@ -295,7 +295,7 @@ struct shallow_info {
int nr_commits;
};
extern void prepare_shallow_info(struct shallow_info *, struct sha1_array *);
extern void prepare_shallow_info(struct shallow_info *, struct oid_array *);
extern void clear_shallow_info(struct shallow_info *);
extern void remove_nonexistent_theirs_shallow(struct shallow_info *);
extern void assign_shallow_commits_to_refs(struct shallow_info *info,
......
......@@ -111,8 +111,8 @@ static void annotate_refs_with_symref_info(struct ref *ref)
*/
struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
struct ref **list, unsigned int flags,
struct sha1_array *extra_have,
struct sha1_array *shallow_points)
struct oid_array *extra_have,
struct oid_array *shallow_points)
{
struct ref **orig_list = list;
......@@ -153,7 +153,7 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
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);
oid_array_append(shallow_points, &old_oid);
continue;
}
......@@ -169,7 +169,7 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
}
if (extra_have && !strcmp(name, ".have")) {
sha1_array_append(extra_have, &old_oid);
oid_array_append(extra_have, &old_oid);
continue;
}
......
......@@ -14,7 +14,7 @@ struct diff_queue_struct;
struct strbuf;
struct diff_filespec;
struct userdiff_driver;
struct sha1_array;
struct oid_array;
struct commit;
struct combine_diff_path;
......@@ -236,7 +236,7 @@ struct combine_diff_path {
extern void show_combined_diff(struct combine_diff_path *elem, int num_parent,
int dense, struct rev_info *);
extern void diff_tree_combined(const unsigned char *sha1, const struct sha1_array *parents, int dense, struct rev_info *rev);
extern void diff_tree_combined(const unsigned char *sha1, const struct oid_array *parents, int dense, struct rev_info *rev);
extern void diff_tree_combined_merge(const struct commit *commit, int dense, struct rev_info *rev);
......
......@@ -1015,7 +1015,7 @@ static void update_shallow(struct fetch_pack_args *args,
struct ref **sought, int nr_sought,
struct shallow_info *si)
{
struct sha1_array ref = SHA1_ARRAY_INIT;
struct oid_array ref = OID_ARRAY_INIT;
int *status;
int i;
......@@ -1038,18 +1038,18 @@ static void update_shallow(struct fetch_pack_args *args,
* shallow points that exist in the pack (iow in repo
* after get_pack() and reprepare_packed_git())
*/
struct sha1_array extra = SHA1_ARRAY_INIT;
struct oid_array extra = OID_ARRAY_INIT;
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]);
oid_array_append(&extra, &oid[i]);
if (extra.nr) {
setup_alternate_shallow(&shallow_lock,
&alternate_shallow_file,
&extra);
commit_lock_file(&shallow_lock);
}
sha1_array_clear(&extra);
oid_array_clear(&extra);
return;
}
......@@ -1060,7 +1060,7 @@ static void update_shallow(struct fetch_pack_args *args,
if (!si->nr_ours && !si->nr_theirs)
return;
for (i = 0; i < nr_sought; i++)
sha1_array_append(&ref, &sought[i]->old_oid);
oid_array_append(&ref, &sought[i]->old_oid);
si->ref = &ref;
if (args->update_shallow) {
......@@ -1070,23 +1070,23 @@ static void update_shallow(struct fetch_pack_args *args,
* shallow roots that are actually reachable from new
* refs.
*/
struct sha1_array extra = SHA1_ARRAY_INIT;
struct oid_array extra = OID_ARRAY_INIT;
struct object_id *oid = si->shallow->oid;
assign_shallow_commits_to_refs(si, NULL, NULL);
if (!si->nr_ours && !si->nr_theirs) {
sha1_array_clear(&ref);
oid_array_clear(&ref);
return;
}
for (i = 0; i < si->nr_ours; i++)
sha1_array_append(&extra, &oid[si->ours[i]]);
oid_array_append(&extra, &oid[si->ours[i]]);
for (i = 0; i < si->nr_theirs; i++)
sha1_array_append(&extra, &oid[si->theirs[i]]);
oid_array_append(&extra, &oid[si->theirs[i]]);
setup_alternate_shallow(&shallow_lock,
&alternate_shallow_file,
&extra);
commit_lock_file(&shallow_lock);
sha1_array_clear(&extra);
sha1_array_clear(&ref);
oid_array_clear(&extra);
oid_array_clear(&ref);
return;
}
......@@ -1102,7 +1102,7 @@ static void update_shallow(struct fetch_pack_args *args,
sought[i]->status = REF_STATUS_REJECT_SHALLOW;
}
free(status);
sha1_array_clear(&ref);
oid_array_clear(&ref);
}
struct ref *fetch_pack(struct fetch_pack_args *args,
......@@ -1110,7 +1110,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
const struct ref *ref,
const char *dest,
struct ref **sought, int nr_sought,
struct sha1_array *shallow,
struct oid_array *shallow,
char **pack_lockfile)
{
struct ref *ref_cpy;
......
......@@ -4,7 +4,7 @@
#include "string-list.h"
#include "run-command.h"
struct sha1_array;
struct oid_array;
struct fetch_pack_args {
const char *uploadpack;
......@@ -42,7 +42,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
const char *dest,
struct ref **sought,
int nr_sought,
struct sha1_array *shallow,
struct oid_array *shallow,
char **pack_lockfile);
/*
......
......@@ -132,7 +132,7 @@ static int fsck_msg_type(enum fsck_msg_id msg_id,
static void init_skiplist(struct fsck_options *options, const char *path)
{
static struct sha1_array skiplist = SHA1_ARRAY_INIT;
static struct oid_array skiplist = OID_ARRAY_INIT;
int sorted, fd;
char buffer[GIT_MAX_HEXSZ + 1];
struct object_id oid;
......@@ -156,7 +156,7 @@ static void init_skiplist(struct fsck_options *options, const char *path)
break;
if (parse_oid_hex(buffer, &oid, &p) || *p != '\n')
die("Invalid SHA-1: %s", buffer);
sha1_array_append(&skiplist, &oid);
oid_array_append(&skiplist, &oid);
if (sorted && skiplist.nr > 1 &&
oidcmp(&skiplist.oid[skiplist.nr - 2],
&oid) > 0)
......@@ -280,7 +280,7 @@ static int report(struct fsck_options *options, struct object *object,
return 0;
if (options->skiplist && object &&
sha1_array_lookup(options->skiplist, &object->oid) >= 0)
oid_array_lookup(options->skiplist, &object->oid) >= 0)
return 0;
if (msg_type == FSCK_FATAL)
......
......@@ -34,7 +34,7 @@ struct fsck_options {
fsck_error error_func;
unsigned strict:1;
int *msg_type;
struct sha1_array *skiplist;
struct oid_array *skiplist;
struct decoration *object_names;
};
......
......@@ -99,14 +99,14 @@ int parse_opt_object_name(const struct option *opt, const char *arg, int unset)
struct object_id oid;
if (unset) {
sha1_array_clear(opt->value);
oid_array_clear(opt->value);
return 0;
}
if (!arg)
return -1;
if (get_oid(arg, &oid))
return error(_("malformed object name '%s'"), arg);
sha1_array_append(opt->value, &oid);
oid_array_append(opt->value, &oid);
return 0;
}
......
......@@ -1677,21 +1677,21 @@ static int filter_pattern_match(struct ref_filter *filter, const char *refname)
* the need to parse the object via parse_object(). peel_ref() might be a
* more efficient alternative to obtain the pointee.
*/
static const struct object_id *match_points_at(struct sha1_array *points_at,
static const struct object_id *match_points_at(struct oid_array *points_at,
const struct object_id *oid,
const char *refname)
{
const struct object_id *tagged_oid = NULL;
struct object *obj;
if (sha1_array_lookup(points_at, oid) >= 0)
if (oid_array_lookup(points_at, oid) >= 0)
return oid;
obj = parse_object(oid->hash);
if (!obj)
die(_("malformed object at '%s'"), refname);
if (obj->type == OBJ_TAG)
tagged_oid = &((struct tag *)obj)->tagged->oid;
if (tagged_oid && sha1_array_lookup(points_at, tagged_oid) >= 0)
if (tagged_oid && oid_array_lookup(points_at, tagged_oid) >= 0)
return tagged_oid;
return NULL;
}
......
......@@ -51,7 +51,7 @@ struct ref_array {
struct ref_filter {
const char **name_patterns;
struct sha1_array points_at;
struct oid_array points_at;
struct commit_list *with_commit;
enum {
......
......@@ -163,7 +163,7 @@ struct discovery {
char *buf;
size_t len;
struct ref *refs;
struct sha1_array shallow;
struct oid_array shallow;
unsigned proto_git : 1;
};
static struct discovery *last_discovery;
......
......@@ -149,11 +149,11 @@ int check_ref_type(const struct ref *ref, int flags);
*/
void free_refs(struct ref *ref);
struct sha1_array;
struct oid_array;
extern struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
struct ref **list, unsigned int flags,
struct sha1_array *extra_have,
struct sha1_array *shallow);
struct oid_array *extra_have,
struct oid_array *shallow);
int resolve_remote_symref(struct ref *ref, struct ref *list);
int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid);
......
......@@ -50,7 +50,7 @@ static void feed_object(const unsigned char *sha1, FILE *fh, int negative)
/*
* Make a pack stream and spit it out into file descriptor fd
*/
static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, struct send_pack_args *args)
static int pack_objects(int fd, struct ref *refs, struct oid_array *extra, struct send_pack_args *args)
{
/*
* The child becomes pack-objects --revs; we feed
......@@ -376,7 +376,7 @@ static void reject_invalid_nonce(const char *nonce, int len)
int send_pack(struct send_pack_args *args,
int fd[], struct child_process *conn,
struct ref *remote_refs,
struct sha1_array *extra_have)
struct oid_array *extra_have)
{
int in = fd[0];
int out = fd[1];
......
......@@ -32,6 +32,6 @@ int option_parse_push_signed(const struct option *opt,
int send_pack(struct send_pack_args *args,
int fd[], struct child_process *conn,
struct ref *remote_refs, struct sha1_array *extra_have);
struct ref *remote_refs, struct oid_array *extra_have);
#endif
......@@ -2,7 +2,7 @@
#include "sha1-array.h"
#include "sha1-lookup.h"
void sha1_array_append(struct sha1_array *array, const struct object_id *oid)
void oid_array_append(struct oid_array *array, const struct object_id *oid)
{
ALLOC_GROW(array->oid, array->nr + 1, array->alloc);
oidcpy(&array->oid[array->nr++], oid);
......@@ -14,7 +14,7 @@ static int void_hashcmp(const void *a, const void *b)
return oidcmp(a, b);
}
static void sha1_array_sort(struct sha1_array *array)
static void oid_array_sort(struct oid_array *array)
{
QSORT(array->oid, array->nr, void_hashcmp);
array->sorted = 1;
......@@ -26,14 +26,14 @@ static const unsigned char *sha1_access(size_t index, void *table)
return array[index].hash;
}
int sha1_array_lookup(struct sha1_array *array, const struct object_id *oid)
int oid_array_lookup(struct oid_array *array, const struct object_id *oid)
{
if (!array->sorted)
sha1_array_sort(array);
oid_array_sort(array);
return sha1_pos(oid->hash, array->oid, array->nr, sha1_access);
}
void sha1_array_clear(struct sha1_array *array)
void oid_array_clear(struct oid_array *array)
{
free(array->oid);
array->oid = NULL;
......@@ -42,14 +42,14 @@ void sha1_array_clear(struct sha1_array *array)
array->sorted = 0;
}
int sha1_array_for_each_unique(struct sha1_array *array,
int oid_array_for_each_unique(struct oid_array *array,
for_each_oid_fn fn,
void *data)
{
int i;
if (!array->sorted)
sha1_array_sort(array);
oid_array_sort(array);
for (i = 0; i < array->nr; i++) {
int ret;
......
#ifndef SHA1_ARRAY_H
#define SHA1_ARRAY_H