From 910650d2f8755359ab7b1f0e2a2d576c06a68091 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Fri, 31 Mar 2017 01:40:00 +0000 Subject: 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 Signed-off-by: Junio C Hamano --- builtin/cat-file.c | 10 +++++----- builtin/diff.c | 6 +++--- builtin/fetch-pack.c | 2 +- builtin/pack-objects.c | 10 +++++----- builtin/pull.c | 6 +++--- builtin/receive-pack.c | 24 ++++++++++++------------ builtin/send-pack.c | 4 ++-- 7 files changed, 31 insertions(+), 31 deletions(-) (limited to 'builtin') diff --git a/builtin/cat-file.c b/builtin/cat-file.c index eb0043231..1890d7a63 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -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; } diff --git a/builtin/diff.c b/builtin/diff.c index a5b34eb15..d184aafab 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -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; } diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 2a1c1c213..366b9d13f 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -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"); diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 028c7be9a..4fc032e3e 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -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, diff --git a/builtin/pull.c b/builtin/pull.c index 183e37714..d8aa26d8a 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -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; diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 51b52a604..bec46a5a9 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -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; } diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 1ff5a6753..b64619442 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -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; -- cgit v1.2.1