MCPcopy Create free account
hub / github.com/git/git / async_query_available_blobs

Function async_query_available_blobs

convert.c:937–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

935
936
937int async_query_available_blobs(const char *cmd, struct string_list *available_paths)
938{
939 int err;
940 char *line;
941 struct cmd2process *entry;
942 struct child_process *process;
943 struct strbuf filter_status = STRBUF_INIT;
944
945 assert(subprocess_map_initialized);
946 entry = (struct cmd2process *)subprocess_find_entry(&subprocess_map, cmd);
947 if (!entry) {
948 error(_("external filter '%s' is not available anymore although "
949 "not all paths have been filtered"), cmd);
950 return 0;
951 }
952 process = &entry->subprocess.process;
953 sigchain_push(SIGPIPE, SIG_IGN);
954
955 err = packet_write_fmt_gently(
956 process->in, "command=list_available_blobs\n");
957 if (err)
958 goto done;
959
960 err = packet_flush_gently(process->in);
961 if (err)
962 goto done;
963
964 while ((line = packet_read_line(process->out, NULL))) {
965 const char *path;
966 if (skip_prefix(line, "pathname=", &path))
967 string_list_insert(available_paths, path);
968 else
969 ; /* ignore unknown keys */
970 }
971
972 err = subprocess_read_status(process->out, &filter_status);
973 if (err)
974 goto done;
975
976 err = strcmp(filter_status.buf, "success");
977
978done:
979 sigchain_pop(SIGPIPE);
980
981 if (err)
982 handle_filter_error(&filter_status, entry, 0);
983 strbuf_release(&filter_status);
984 return !err;
985}
986
987static struct convert_driver {
988 const char *name;

Callers 1

finish_delayed_checkoutFunction · 0.85

Calls 11

subprocess_find_entryFunction · 0.85
errorFunction · 0.85
sigchain_pushFunction · 0.85
packet_write_fmt_gentlyFunction · 0.85
packet_flush_gentlyFunction · 0.85
packet_read_lineFunction · 0.85
string_list_insertFunction · 0.85
subprocess_read_statusFunction · 0.85
sigchain_popFunction · 0.85
handle_filter_errorFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected