Skip to content

Commit 1d844ee

Browse files
felipecgitster
authored andcommitted
fast-export: make extra_refs global
There's no need to pass it around everywhere. This would make easier further refactoring that makes use of this variable. Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e230c56 commit 1d844ee

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

builtin/fast-export.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static int fake_missing_tagger;
3030
static int use_done_feature;
3131
static int no_data;
3232
static int full_tree;
33+
static struct string_list extra_refs = STRING_LIST_INIT_NODUP;
3334

3435
static int parse_opt_signed_tag_mode(const struct option *opt,
3536
const char *arg, int unset)
@@ -484,8 +485,7 @@ static void handle_tag(const char *name, struct tag *tag)
484485
(int)message_size, (int)message_size, message ? message : "");
485486
}
486487

487-
static void get_tags_and_duplicates(struct rev_cmdline_info *info,
488-
struct string_list *extra_refs)
488+
static void get_tags_and_duplicates(struct rev_cmdline_info *info)
489489
{
490490
struct tag *tag;
491491
int i;
@@ -512,7 +512,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info,
512512
/* handle nested tags */
513513
while (tag && tag->object.type == OBJ_TAG) {
514514
parse_object(tag->object.sha1);
515-
string_list_append(extra_refs, full_name)->util = tag;
515+
string_list_append(&extra_refs, full_name)->util = tag;
516516
tag = (struct tag *)tag->tagged;
517517
}
518518
if (!tag)
@@ -542,20 +542,20 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info,
542542
* sure it gets properly updated eventually.
543543
*/
544544
if (commit->util || commit->object.flags & SHOWN)
545-
string_list_append(extra_refs, full_name)->util = commit;
545+
string_list_append(&extra_refs, full_name)->util = commit;
546546
if (!commit->util)
547547
commit->util = full_name;
548548
}
549549
}
550550

551-
static void handle_tags_and_duplicates(struct string_list *extra_refs)
551+
static void handle_tags_and_duplicates(void)
552552
{
553553
struct commit *commit;
554554
int i;
555555

556-
for (i = extra_refs->nr - 1; i >= 0; i--) {
557-
const char *name = extra_refs->items[i].string;
558-
struct object *object = extra_refs->items[i].util;
556+
for (i = extra_refs.nr - 1; i >= 0; i--) {
557+
const char *name = extra_refs.items[i].string;
558+
struct object *object = extra_refs.items[i].util;
559559
switch (object->type) {
560560
case OBJ_TAG:
561561
handle_tag(name, (struct tag *)object);
@@ -657,7 +657,6 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
657657
{
658658
struct rev_info revs;
659659
struct object_array commits = OBJECT_ARRAY_INIT;
660-
struct string_list extra_refs = STRING_LIST_INIT_NODUP;
661660
struct commit *commit;
662661
char *export_filename = NULL, *import_filename = NULL;
663662
uint32_t lastimportid;
@@ -709,7 +708,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
709708
if (import_filename && revs.prune_data.nr)
710709
full_tree = 1;
711710

712-
get_tags_and_duplicates(&revs.cmdline, &extra_refs);
711+
get_tags_and_duplicates(&revs.cmdline);
713712

714713
if (prepare_revision_walk(&revs))
715714
die("revision walk setup failed");
@@ -725,7 +724,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
725724
}
726725
}
727726

728-
handle_tags_and_duplicates(&extra_refs);
727+
handle_tags_and_duplicates();
729728

730729
if (export_filename && lastimportid != last_idnum)
731730
export_marks(export_filename);

0 commit comments

Comments
 (0)