| 921 | } |
| 922 | |
| 923 | static int batch_objects(struct batch_options *opt) |
| 924 | { |
| 925 | struct strbuf input = STRBUF_INIT; |
| 926 | struct strbuf output = STRBUF_INIT; |
| 927 | struct expand_data data = EXPAND_DATA_INIT; |
| 928 | struct repo_config_values *cfg = repo_config_values(the_repository); |
| 929 | int save_warning; |
| 930 | int retval = 0; |
| 931 | |
| 932 | /* |
| 933 | * Expand once with our special mark_query flag, which will prime the |
| 934 | * object_info to be handed to odb_read_object_info_extended for each |
| 935 | * object. |
| 936 | */ |
| 937 | data.mark_query = 1; |
| 938 | expand_format(&output, |
| 939 | opt->format ? opt->format : DEFAULT_FORMAT, |
| 940 | &data); |
| 941 | data.mark_query = 0; |
| 942 | strbuf_release(&output); |
| 943 | if (opt->transform_mode) |
| 944 | data.split_on_whitespace = 1; |
| 945 | |
| 946 | if (opt->format && !strcmp(opt->format, DEFAULT_FORMAT)) |
| 947 | opt->format = NULL; |
| 948 | /* |
| 949 | * If we are printing out the object, then always fill in the type, |
| 950 | * since we will want to decide whether or not to stream. |
| 951 | */ |
| 952 | if (opt->batch_mode == BATCH_MODE_CONTENTS) |
| 953 | data.info.typep = &data.type; |
| 954 | |
| 955 | if (opt->all_objects) { |
| 956 | struct object_cb_data cb; |
| 957 | struct object_info empty = OBJECT_INFO_INIT; |
| 958 | |
| 959 | if (!memcmp(&data.info, &empty, sizeof(empty)) && |
| 960 | opt->objects_filter.choice == LOFC_DISABLED) |
| 961 | data.skip_object_info = 1; |
| 962 | |
| 963 | if (repo_has_promisor_remote(the_repository)) |
| 964 | warning("This repository uses promisor remotes. Some objects may not be loaded."); |
| 965 | |
| 966 | disable_replace_refs(); |
| 967 | |
| 968 | cb.opt = opt; |
| 969 | cb.expand = &data; |
| 970 | cb.scratch = &output; |
| 971 | |
| 972 | if (opt->unordered) { |
| 973 | struct oidset seen = OIDSET_INIT; |
| 974 | |
| 975 | cb.seen = &seen; |
| 976 | |
| 977 | batch_each_object(opt, batch_unordered_object, |
| 978 | ODB_FOR_EACH_OBJECT_PACK_ORDER, &cb); |
| 979 | |
| 980 | oidset_clear(&seen); |
no test coverage detected