static int fetch_with_import(struct transport *transport, int nr_heads, struct ref **to_fetch) { struct child_process fastimport; struct helper_data *data = transport->data; int i; struct ref *posn; struct strbuf buf = STRBUF_INIT; get_helper(transport); if (get_importer(transport, &fastimport)) die("Couldn't run fast-import"); for (i = 0; i < nr_heads; i++) { posn = to_fetch[i]; if (posn->status & REF_STATUS_UPTODATE) continue; strbuf_addf(&buf, "import %s\n", posn->name); sendline(data, &buf); strbuf_reset(&buf); } disconnect_helper(transport); finish_command(&fastimport); free(fastimport.argv); fastimport.argv = NULL; for (i = 0; i < nr_heads; i++) { char *private; posn = to_fetch[i]; if (posn->status & REF_STATUS_UPTODATE) continue; if (data->refspecs) private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name); else private = strdup(posn->name); read_ref(private, posn->old_sha1); free(private); }
static void get_tags_and_duplicates(struct rev_cmdline_info *info) { int i; for (i = 0; i < info->nr; i++) { struct rev_cmdline_entry *e = info->rev + i; struct object_id oid; struct commit *commit; char *full_name; if (e->flags & UNINTERESTING) continue; if (dwim_ref(e->name, strlen(e->name), &oid, &full_name) != 1) continue; if (refspecs.nr) { char *private; private = apply_refspecs(&refspecs, full_name); if (private) { free(full_name); full_name = private; } }