| 3932 | } |
| 3933 | |
| 3934 | int cmd_fast_import(int argc, |
| 3935 | const char **argv, |
| 3936 | const char *prefix, |
| 3937 | struct repository *repo) |
| 3938 | { |
| 3939 | unsigned int i; |
| 3940 | |
| 3941 | show_usage_if_asked(argc, argv, fast_import_usage); |
| 3942 | |
| 3943 | reset_pack_idx_option(&pack_idx_opts); |
| 3944 | git_pack_config(); |
| 3945 | |
| 3946 | alloc_objects(object_entry_alloc); |
| 3947 | strbuf_init(&command_buf, 0); |
| 3948 | CALLOC_ARRAY(atom_table, atom_table_sz); |
| 3949 | CALLOC_ARRAY(branch_table, branch_table_sz); |
| 3950 | CALLOC_ARRAY(avail_tree_table, avail_tree_table_sz); |
| 3951 | marks = mem_pool_calloc(&fi_mem_pool, 1, sizeof(struct mark_set)); |
| 3952 | |
| 3953 | hashmap_init(&object_table, object_entry_hashcmp, NULL, 0); |
| 3954 | |
| 3955 | /* |
| 3956 | * We don't parse most options until after we've seen the set of |
| 3957 | * "feature" lines at the start of the stream (which allows the command |
| 3958 | * line to override stream data). But we must do an early parse of any |
| 3959 | * command-line options that impact how we interpret the feature lines. |
| 3960 | */ |
| 3961 | for (i = 1; i < argc; i++) { |
| 3962 | const char *arg = argv[i]; |
| 3963 | if (*arg != '-' || !strcmp(arg, "--")) |
| 3964 | break; |
| 3965 | if (!strcmp(arg, "--allow-unsafe-features")) |
| 3966 | allow_unsafe_features = 1; |
| 3967 | } |
| 3968 | |
| 3969 | global_argc = argc; |
| 3970 | global_argv = argv; |
| 3971 | global_prefix = prefix; |
| 3972 | |
| 3973 | rc_free = mem_pool_alloc(&fi_mem_pool, cmd_save * sizeof(*rc_free)); |
| 3974 | for (i = 0; i < (cmd_save - 1); i++) |
| 3975 | rc_free[i].next = &rc_free[i + 1]; |
| 3976 | rc_free[cmd_save - 1].next = NULL; |
| 3977 | |
| 3978 | start_packfile(); |
| 3979 | set_die_routine(die_nicely); |
| 3980 | set_checkpoint_signal(); |
| 3981 | while (read_next_command() != EOF) { |
| 3982 | const char *v; |
| 3983 | if (!strcmp("blob", command_buf.buf)) |
| 3984 | parse_new_blob(); |
| 3985 | else if (skip_prefix(command_buf.buf, "commit ", &v)) |
| 3986 | parse_new_commit(v); |
| 3987 | else if (skip_prefix(command_buf.buf, "tag ", &v)) |
| 3988 | parse_new_tag(v); |
| 3989 | else if (skip_prefix(command_buf.buf, "reset ", &v)) |
| 3990 | parse_reset_branch(v); |
| 3991 | else if (skip_prefix(command_buf.buf, "ls ", &v)) |
nothing calls this directly
no test coverage detected