diff options
author | Brandon Williams <bmwill@google.com> | 2018-05-17 00:57:59 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-17 23:19:42 +0200 |
commit | 16eefc8eb37dfb26c83bbd0a393b494e3734cb97 (patch) | |
tree | 2856bb1a3e7d931ea6369d222d859a62d349509f | |
parent | clone: convert cmd_clone to use refspec_item_init (diff) | |
download | git-16eefc8eb37dfb26c83bbd0a393b494e3734cb97.tar.xz git-16eefc8eb37dfb26c83bbd0a393b494e3734cb97.zip |
fast-export: convert to use struct refspec
Convert fast-export to use 'struct refspec' instead of using a list of
refspec_item's.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/fast-export.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 6f105dc798..143999738e 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -36,8 +36,7 @@ static int use_done_feature; static int no_data; static int full_tree; static struct string_list extra_refs = STRING_LIST_INIT_NODUP; -static struct refspec_item *refspecs; -static int refspecs_nr; +static struct refspec refspecs = REFSPEC_INIT_FETCH; static int anonymize; static int parse_opt_signed_tag_mode(const struct option *opt, @@ -830,9 +829,9 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info) if (dwim_ref(e->name, strlen(e->name), &oid, &full_name) != 1) continue; - if (refspecs) { + if (refspecs.nr) { char *private; - private = apply_refspecs(refspecs, refspecs_nr, full_name); + private = apply_refspecs(refspecs.items, refspecs.nr, full_name); if (private) { free(full_name); full_name = private; @@ -978,8 +977,8 @@ static void import_marks(char *input_file) static void handle_deletes(void) { int i; - for (i = 0; i < refspecs_nr; i++) { - struct refspec_item *refspec = &refspecs[i]; + for (i = 0; i < refspecs.nr; i++) { + struct refspec_item *refspec = &refspecs.items[i]; if (*refspec->src) continue; @@ -1040,18 +1039,12 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) usage_with_options (fast_export_usage, options); if (refspecs_list.nr) { - const char **refspecs_str; int i; - ALLOC_ARRAY(refspecs_str, refspecs_list.nr); for (i = 0; i < refspecs_list.nr; i++) - refspecs_str[i] = refspecs_list.items[i].string; - - refspecs_nr = refspecs_list.nr; - refspecs = parse_fetch_refspec(refspecs_nr, refspecs_str); + refspec_append(&refspecs, refspecs_list.items[i].string); string_list_clear(&refspecs_list, 1); - free(refspecs_str); } if (use_done_feature) @@ -1090,7 +1083,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) if (use_done_feature) printf("done\n"); - free_refspec(refspecs_nr, refspecs); + refspec_clear(&refspecs); return 0; } |