* If packfile URIs were provided, pass a non-NULL pointer to index_pack_args. * The strings to pass as the --index-pack-arg arguments to http-fetch will be * stored there. (It must be freed by the caller.) */
| 956 | * stored there. (It must be freed by the caller.) |
| 957 | */ |
| 958 | static int get_pack(struct fetch_pack_args *args, |
| 959 | int xd[2], struct string_list *pack_lockfiles, |
| 960 | struct strvec *index_pack_args, |
| 961 | struct ref **sought, int nr_sought, |
| 962 | struct oidset *gitmodules_oids) |
| 963 | { |
| 964 | struct async demux; |
| 965 | int do_keep = args->keep_pack; |
| 966 | const char *cmd_name; |
| 967 | struct pack_header header; |
| 968 | int pass_header = 0; |
| 969 | struct child_process cmd = CHILD_PROCESS_INIT; |
| 970 | int fsck_objects = 0; |
| 971 | int ret; |
| 972 | |
| 973 | memset(&demux, 0, sizeof(demux)); |
| 974 | if (use_sideband) { |
| 975 | /* xd[] is talking with upload-pack; subprocess reads from |
| 976 | * xd[0], spits out band#2 to stderr, and feeds us band#1 |
| 977 | * through demux->out. |
| 978 | */ |
| 979 | demux.proc = sideband_demux; |
| 980 | demux.data = xd; |
| 981 | demux.out = -1; |
| 982 | demux.isolate_sigpipe = 1; |
| 983 | if (start_async(&demux)) |
| 984 | die(_("fetch-pack: unable to fork off sideband demultiplexer")); |
| 985 | } |
| 986 | else |
| 987 | demux.out = xd[0]; |
| 988 | |
| 989 | if (!args->keep_pack && unpack_limit && !index_pack_args) { |
| 990 | |
| 991 | if (read_pack_header(demux.out, &header)) |
| 992 | die(_("protocol error: bad pack header")); |
| 993 | pass_header = 1; |
| 994 | if (ntohl(header.hdr_entries) < unpack_limit) |
| 995 | do_keep = 0; |
| 996 | else |
| 997 | do_keep = 1; |
| 998 | } |
| 999 | |
| 1000 | if (alternate_shallow_file) { |
| 1001 | strvec_push(&cmd.args, "--shallow-file"); |
| 1002 | strvec_push(&cmd.args, alternate_shallow_file); |
| 1003 | } |
| 1004 | |
| 1005 | fsck_objects = fetch_pack_fsck_objects(); |
| 1006 | |
| 1007 | if (do_keep || args->from_promisor || index_pack_args || fsck_objects) { |
| 1008 | if (pack_lockfiles || fsck_objects) |
| 1009 | cmd.out = -1; |
| 1010 | cmd_name = "index-pack"; |
| 1011 | strvec_push(&cmd.args, cmd_name); |
| 1012 | strvec_push(&cmd.args, "--stdin"); |
| 1013 | if (!args->quiet && !args->no_progress) |
| 1014 | strvec_push(&cmd.args, "-v"); |
| 1015 | if (args->use_thin_pack) |
no test coverage detected