Skip to content

Commit 910650d

Browse files
bk2204gitster
authored andcommitted
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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 1b7ba79 commit 910650d

31 files changed

+155
-155
lines changed

bisect.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "sha1-array.h"
1313
#include "argv-array.h"
1414

15-
static struct sha1_array good_revs;
16-
static struct sha1_array skipped_revs;
15+
static struct oid_array good_revs;
16+
static struct oid_array skipped_revs;
1717

1818
static struct object_id *current_bad_oid;
1919

@@ -413,9 +413,9 @@ static int register_ref(const char *refname, const struct object_id *oid,
413413
current_bad_oid = xmalloc(sizeof(*current_bad_oid));
414414
oidcpy(current_bad_oid, oid);
415415
} else if (starts_with(refname, good_prefix.buf)) {
416-
sha1_array_append(&good_revs, oid);
416+
oid_array_append(&good_revs, oid);
417417
} else if (starts_with(refname, "skip-")) {
418-
sha1_array_append(&skipped_revs, oid);
418+
oid_array_append(&skipped_revs, oid);
419419
}
420420

421421
strbuf_release(&good_prefix);
@@ -451,7 +451,7 @@ static void read_bisect_paths(struct argv_array *array)
451451
fclose(fp);
452452
}
453453

454-
static char *join_sha1_array_hex(struct sha1_array *array, char delim)
454+
static char *join_sha1_array_hex(struct oid_array *array, char delim)
455455
{
456456
struct strbuf joined_hexs = STRBUF_INIT;
457457
int i;
@@ -499,7 +499,7 @@ struct commit_list *filter_skipped(struct commit_list *list,
499499
while (list) {
500500
struct commit_list *next = list->next;
501501
list->next = NULL;
502-
if (0 <= sha1_array_lookup(&skipped_revs, &list->item->object.oid)) {
502+
if (0 <= oid_array_lookup(&skipped_revs, &list->item->object.oid)) {
503503
if (skipped_first && !*skipped_first)
504504
*skipped_first = 1;
505505
/* Move current to tried list */
@@ -789,9 +789,9 @@ static void check_merge_bases(int no_checkout)
789789
const struct object_id *mb = &result->item->object.oid;
790790
if (!oidcmp(mb, current_bad_oid)) {
791791
handle_bad_merge_base();
792-
} else if (0 <= sha1_array_lookup(&good_revs, mb)) {
792+
} else if (0 <= oid_array_lookup(&good_revs, mb)) {
793793
continue;
794-
} else if (0 <= sha1_array_lookup(&skipped_revs, mb)) {
794+
} else if (0 <= oid_array_lookup(&skipped_revs, mb)) {
795795
handle_skipped_merge_base(mb);
796796
} else {
797797
printf(_("Bisecting: a merge base must be tested\n"));

builtin/cat-file.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static int batch_loose_object(const struct object_id *oid,
413413
const char *path,
414414
void *data)
415415
{
416-
sha1_array_append(data, oid);
416+
oid_array_append(data, oid);
417417
return 0;
418418
}
419419

@@ -422,7 +422,7 @@ static int batch_packed_object(const struct object_id *oid,
422422
uint32_t pos,
423423
void *data)
424424
{
425-
sha1_array_append(data, oid);
425+
oid_array_append(data, oid);
426426
return 0;
427427
}
428428

@@ -462,17 +462,17 @@ static int batch_objects(struct batch_options *opt)
462462
data.info.typep = &data.type;
463463

464464
if (opt->all_objects) {
465-
struct sha1_array sa = SHA1_ARRAY_INIT;
465+
struct oid_array sa = OID_ARRAY_INIT;
466466
struct object_cb_data cb;
467467

468468
for_each_loose_object(batch_loose_object, &sa, 0);
469469
for_each_packed_object(batch_packed_object, &sa, 0);
470470

471471
cb.opt = opt;
472472
cb.expand = &data;
473-
sha1_array_for_each_unique(&sa, batch_object_cb, &cb);
473+
oid_array_for_each_unique(&sa, batch_object_cb, &cb);
474474

475-
sha1_array_clear(&sa);
475+
oid_array_clear(&sa);
476476
return 0;
477477
}
478478

builtin/diff.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static int builtin_diff_combined(struct rev_info *revs,
184184
struct object_array_entry *ent,
185185
int ents)
186186
{
187-
struct sha1_array parents = SHA1_ARRAY_INIT;
187+
struct oid_array parents = OID_ARRAY_INIT;
188188
int i;
189189

190190
if (argc > 1)
@@ -193,10 +193,10 @@ static int builtin_diff_combined(struct rev_info *revs,
193193
if (!revs->dense_combined_merges && !revs->combine_merges)
194194
revs->dense_combined_merges = revs->combine_merges = 1;
195195
for (i = 1; i < ents; i++)
196-
sha1_array_append(&parents, &ent[i].item->oid);
196+
oid_array_append(&parents, &ent[i].item->oid);
197197
diff_tree_combined(ent[0].item->oid.hash, &parents,
198198
revs->dense_combined_merges, revs);
199-
sha1_array_clear(&parents);
199+
oid_array_clear(&parents);
200200
return 0;
201201
}
202202

builtin/fetch-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
5050
char **pack_lockfile_ptr = NULL;
5151
struct child_process *conn;
5252
struct fetch_pack_args args;
53-
struct sha1_array shallow = SHA1_ARRAY_INIT;
53+
struct oid_array shallow = OID_ARRAY_INIT;
5454
struct string_list deepen_not = STRING_LIST_INIT_DUP;
5555

5656
packet_trace_identity("fetch-pack");

builtin/pack-objects.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,7 +2668,7 @@ static int has_sha1_pack_kept_or_nonlocal(const unsigned char *sha1)
26682668
*
26692669
* This is filled by get_object_list.
26702670
*/
2671-
static struct sha1_array recent_objects;
2671+
static struct oid_array recent_objects;
26722672

26732673
static int loosened_object_can_be_discarded(const struct object_id *oid,
26742674
unsigned long mtime)
@@ -2677,7 +2677,7 @@ static int loosened_object_can_be_discarded(const struct object_id *oid,
26772677
return 0;
26782678
if (mtime > unpack_unreachable_expiration)
26792679
return 0;
2680-
if (sha1_array_lookup(&recent_objects, oid) >= 0)
2680+
if (oid_array_lookup(&recent_objects, oid) >= 0)
26812681
return 0;
26822682
return 1;
26832683
}
@@ -2739,12 +2739,12 @@ static void record_recent_object(struct object *obj,
27392739
const char *name,
27402740
void *data)
27412741
{
2742-
sha1_array_append(&recent_objects, &obj->oid);
2742+
oid_array_append(&recent_objects, &obj->oid);
27432743
}
27442744

27452745
static void record_recent_commit(struct commit *commit, void *data)
27462746
{
2747-
sha1_array_append(&recent_objects, &commit->object.oid);
2747+
oid_array_append(&recent_objects, &commit->object.oid);
27482748
}
27492749

27502750
static void get_object_list(int ac, const char **av)
@@ -2812,7 +2812,7 @@ static void get_object_list(int ac, const char **av)
28122812
if (unpack_unreachable)
28132813
loosen_unused_packed_objects(&revs);
28142814

2815-
sha1_array_clear(&recent_objects);
2815+
oid_array_clear(&recent_objects);
28162816
}
28172817

28182818
static int option_parse_index_version(const struct option *opt,

builtin/pull.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ static int git_pull_config(const char *var, const char *value, void *cb)
330330
* Appends merge candidates from FETCH_HEAD that are not marked not-for-merge
331331
* into merge_heads.
332332
*/
333-
static void get_merge_heads(struct sha1_array *merge_heads)
333+
static void get_merge_heads(struct oid_array *merge_heads)
334334
{
335335
const char *filename = git_path("FETCH_HEAD");
336336
FILE *fp;
@@ -344,7 +344,7 @@ static void get_merge_heads(struct sha1_array *merge_heads)
344344
continue; /* invalid line: does not start with SHA1 */
345345
if (starts_with(sb.buf + GIT_SHA1_HEXSZ, "\tnot-for-merge\t"))
346346
continue; /* ref is not-for-merge */
347-
sha1_array_append(merge_heads, &oid);
347+
oid_array_append(merge_heads, &oid);
348348
}
349349
fclose(fp);
350350
strbuf_release(&sb);
@@ -769,7 +769,7 @@ static int run_rebase(const struct object_id *curr_head,
769769
int cmd_pull(int argc, const char **argv, const char *prefix)
770770
{
771771
const char *repo, **refspecs;
772-
struct sha1_array merge_heads = SHA1_ARRAY_INIT;
772+
struct oid_array merge_heads = OID_ARRAY_INIT;
773773
struct object_id orig_head, curr_head;
774774
struct object_id rebase_fork_point;
775775

builtin/receive-pack.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ static int command_singleton_iterator(void *cb_data, unsigned char sha1[20]);
831831
static int update_shallow_ref(struct command *cmd, struct shallow_info *si)
832832
{
833833
static struct lock_file shallow_lock;
834-
struct sha1_array extra = SHA1_ARRAY_INIT;
834+
struct oid_array extra = OID_ARRAY_INIT;
835835
struct check_connected_options opt = CHECK_CONNECTED_INIT;
836836
uint32_t mask = 1 << (cmd->index % 32);
837837
int i;
@@ -842,13 +842,13 @@ static int update_shallow_ref(struct command *cmd, struct shallow_info *si)
842842
if (si->used_shallow[i] &&
843843
(si->used_shallow[i][cmd->index / 32] & mask) &&
844844
!delayed_reachability_test(si, i))
845-
sha1_array_append(&extra, &si->shallow->oid[i]);
845+
oid_array_append(&extra, &si->shallow->oid[i]);
846846

847847
opt.env = tmp_objdir_env(tmp_objdir);
848848
setup_alternate_shallow(&shallow_lock, &opt.shallow_file, &extra);
849849
if (check_connected(command_singleton_iterator, cmd, &opt)) {
850850
rollback_lock_file(&shallow_lock);
851-
sha1_array_clear(&extra);
851+
oid_array_clear(&extra);
852852
return -1;
853853
}
854854

@@ -862,7 +862,7 @@ static int update_shallow_ref(struct command *cmd, struct shallow_info *si)
862862
register_shallow(extra.oid[i].hash);
863863

864864
si->shallow_ref[cmd->index] = 0;
865-
sha1_array_clear(&extra);
865+
oid_array_clear(&extra);
866866
return 0;
867867
}
868868

@@ -1529,7 +1529,7 @@ static void queue_commands_from_cert(struct command **tail,
15291529
}
15301530
}
15311531

1532-
static struct command *read_head_info(struct sha1_array *shallow)
1532+
static struct command *read_head_info(struct oid_array *shallow)
15331533
{
15341534
struct command *commands = NULL;
15351535
struct command **p = &commands;
@@ -1546,7 +1546,7 @@ static struct command *read_head_info(struct sha1_array *shallow)
15461546
if (get_oid_hex(line + 8, &oid))
15471547
die("protocol error: expected shallow sha, got '%s'",
15481548
line + 8);
1549-
sha1_array_append(shallow, &oid);
1549+
oid_array_append(shallow, &oid);
15501550
continue;
15511551
}
15521552

@@ -1804,7 +1804,7 @@ static void prepare_shallow_update(struct command *commands,
18041804

18051805
static void update_shallow_info(struct command *commands,
18061806
struct shallow_info *si,
1807-
struct sha1_array *ref)
1807+
struct oid_array *ref)
18081808
{
18091809
struct command *cmd;
18101810
int *ref_status;
@@ -1817,7 +1817,7 @@ static void update_shallow_info(struct command *commands,
18171817
for (cmd = commands; cmd; cmd = cmd->next) {
18181818
if (is_null_oid(&cmd->new_oid))
18191819
continue;
1820-
sha1_array_append(ref, &cmd->new_oid);
1820+
oid_array_append(ref, &cmd->new_oid);
18211821
cmd->index = ref->nr - 1;
18221822
}
18231823
si->ref = ref;
@@ -1878,8 +1878,8 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
18781878
{
18791879
int advertise_refs = 0;
18801880
struct command *commands;
1881-
struct sha1_array shallow = SHA1_ARRAY_INIT;
1882-
struct sha1_array ref = SHA1_ARRAY_INIT;
1881+
struct oid_array shallow = OID_ARRAY_INIT;
1882+
struct oid_array ref = OID_ARRAY_INIT;
18831883
struct shallow_info si;
18841884

18851885
struct option options[] = {
@@ -1971,8 +1971,8 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
19711971
}
19721972
if (use_sideband)
19731973
packet_flush(1);
1974-
sha1_array_clear(&shallow);
1975-
sha1_array_clear(&ref);
1974+
oid_array_clear(&shallow);
1975+
oid_array_clear(&ref);
19761976
free((void *)push_cert_nonce);
19771977
return 0;
19781978
}

builtin/send-pack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
131131
const char *dest = NULL;
132132
int fd[2];
133133
struct child_process *conn;
134-
struct sha1_array extra_have = SHA1_ARRAY_INIT;
135-
struct sha1_array shallow = SHA1_ARRAY_INIT;
134+
struct oid_array extra_have = OID_ARRAY_INIT;
135+
struct oid_array shallow = OID_ARRAY_INIT;
136136
struct ref *remote_refs, *local_refs;
137137
int ret;
138138
int helper_status = 0;

combine-diff.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ static const char *path_path(void *obj)
13111311

13121312
/* find set of paths that every parent touches */
13131313
static struct combine_diff_path *find_paths_generic(const unsigned char *sha1,
1314-
const struct sha1_array *parents, struct diff_options *opt)
1314+
const struct oid_array *parents, struct diff_options *opt)
13151315
{
13161316
struct combine_diff_path *paths = NULL;
13171317
int i, num_parent = parents->nr;
@@ -1359,7 +1359,7 @@ static struct combine_diff_path *find_paths_generic(const unsigned char *sha1,
13591359
* rename/copy detection, etc, comparing all trees simultaneously (= faster).
13601360
*/
13611361
static struct combine_diff_path *find_paths_multitree(
1362-
const unsigned char *sha1, const struct sha1_array *parents,
1362+
const unsigned char *sha1, const struct oid_array *parents,
13631363
struct diff_options *opt)
13641364
{
13651365
int i, nparent = parents->nr;
@@ -1384,7 +1384,7 @@ static struct combine_diff_path *find_paths_multitree(
13841384

13851385

13861386
void diff_tree_combined(const unsigned char *sha1,
1387-
const struct sha1_array *parents,
1387+
const struct oid_array *parents,
13881388
int dense,
13891389
struct rev_info *rev)
13901390
{
@@ -1532,12 +1532,12 @@ void diff_tree_combined_merge(const struct commit *commit, int dense,
15321532
struct rev_info *rev)
15331533
{
15341534
struct commit_list *parent = get_saved_parents(rev, commit);
1535-
struct sha1_array parents = SHA1_ARRAY_INIT;
1535+
struct oid_array parents = OID_ARRAY_INIT;
15361536

15371537
while (parent) {
1538-
sha1_array_append(&parents, &parent->item->object.oid);
1538+
oid_array_append(&parents, &parent->item->object.oid);
15391539
parent = parent->next;
15401540
}
15411541
diff_tree_combined(commit->object.oid.hash, &parents, dense, rev);
1542-
sha1_array_clear(&parents);
1542+
oid_array_clear(&parents);
15431543
}

commit.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ extern struct commit_list *get_merge_bases_many_dirty(struct commit *one, int n,
261261
/* largest positive number a signed 32-bit integer can contain */
262262
#define INFINITE_DEPTH 0x7fffffff
263263

264-
struct sha1_array;
264+
struct oid_array;
265265
struct ref;
266266
extern int register_shallow(const unsigned char *sha1);
267267
extern int unregister_shallow(const unsigned char *sha1);
@@ -273,18 +273,18 @@ extern struct commit_list *get_shallow_commits_by_rev_list(
273273
int ac, const char **av, int shallow_flag, int not_shallow_flag);
274274
extern void set_alternate_shallow_file(const char *path, int override);
275275
extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol,
276-
const struct sha1_array *extra);
276+
const struct oid_array *extra);
277277
extern void setup_alternate_shallow(struct lock_file *shallow_lock,
278278
const char **alternate_shallow_file,
279-
const struct sha1_array *extra);
280-
extern const char *setup_temporary_shallow(const struct sha1_array *extra);
279+
const struct oid_array *extra);
280+
extern const char *setup_temporary_shallow(const struct oid_array *extra);
281281
extern void advertise_shallow_grafts(int);
282282

283283
struct shallow_info {
284-
struct sha1_array *shallow;
284+
struct oid_array *shallow;
285285
int *ours, nr_ours;
286286
int *theirs, nr_theirs;
287-
struct sha1_array *ref;
287+
struct oid_array *ref;
288288

289289
/* for receive-pack */
290290
uint32_t **used_shallow;
@@ -295,7 +295,7 @@ struct shallow_info {
295295
int nr_commits;
296296
};
297297

298-
extern void prepare_shallow_info(struct shallow_info *, struct sha1_array *);
298+
extern void prepare_shallow_info(struct shallow_info *, struct oid_array *);
299299
extern void clear_shallow_info(struct shallow_info *);
300300
extern void remove_nonexistent_theirs_shallow(struct shallow_info *);
301301
extern void assign_shallow_commits_to_refs(struct shallow_info *info,

0 commit comments

Comments
 (0)