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 <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed Sep 1, 2013 at 02:05 UTC 1d844ee7bd386347f71b7d49e3be8df690b641b5
1 file changed +10 -11
builtin/fast-export.c
+10 -11
@@ -30,6 +30,7 @@ static int fake_missing_tagger;
30 static int use_done_feature;
31 static int no_data;
32 static int full_tree;
33 +static struct string_list extra_refs = STRING_LIST_INIT_NODUP;
34
35 static int parse_opt_signed_tag_mode(const struct option *opt,
36 const char *arg, int unset)
@@ -484,8 +485,7 @@ static void handle_tag(const char *name, struct tag *tag)
485 (int)message_size, (int)message_size, message ? message : "");
486 }
487
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)
489 {
490 struct tag *tag;
491 int i;
@@ -512,7 +512,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info,
512 /* handle nested tags */
513 while (tag && tag->object.type == OBJ_TAG) {
514 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;
516 tag = (struct tag *)tag->tagged;
517 }
518 if (!tag)
@@ -542,20 +542,20 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info,
542 * sure it gets properly updated eventually.
543 */
544 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;
546 if (!commit->util)
547 commit->util = full_name;
548 }
549 }
550
551 -static void handle_tags_and_duplicates(struct string_list *extra_refs)
551 +static void handle_tags_and_duplicates(void)
552 {
553 struct commit *commit;
554 int i;
555
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;
559 switch (object->type) {
560 case OBJ_TAG:
561 handle_tag(name, (struct tag *)object);
@@ -657,7 +657,6 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
657 {
658 struct rev_info revs;
659 struct object_array commits = OBJECT_ARRAY_INIT;
660 - struct string_list extra_refs = STRING_LIST_INIT_NODUP;
660 struct commit *commit;
661 char *export_filename = NULL, *import_filename = NULL;
662 uint32_t lastimportid;
@@ -709,7 +708,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
708 if (import_filename && revs.prune_data.nr)
709 full_tree = 1;
710
712 - get_tags_and_duplicates(&revs.cmdline, &extra_refs);
711 + get_tags_and_duplicates(&revs.cmdline);
712
713 if (prepare_revision_walk(&revs))
714 die("revision walk setup failed");
@@ -725,7 +724,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
724 }
725 }
726
728 - handle_tags_and_duplicates(&extra_refs);
727 + handle_tags_and_duplicates();
728
729 if (export_filename && lastimportid != last_idnum)
730 export_marks(export_filename);