MCPcopy Index your code
hub / github.com/git/git / parse_pathspec_file

Function parse_pathspec_file

pathspec.c:687–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685}
686
687void parse_pathspec_file(struct pathspec *pathspec, unsigned magic_mask,
688 unsigned flags, const char *prefix,
689 const char *file, int nul_term_line)
690{
691 struct strvec parsed_file = STRVEC_INIT;
692 strbuf_getline_fn getline_fn = nul_term_line ? strbuf_getline_nul :
693 strbuf_getline;
694 struct strbuf buf = STRBUF_INIT;
695 struct strbuf unquoted = STRBUF_INIT;
696 FILE *in;
697
698 if (!strcmp(file, "-"))
699 in = stdin;
700 else
701 in = xfopen(file, "r");
702
703 while (getline_fn(&buf, in) != EOF) {
704 if (!nul_term_line && buf.buf[0] == '"') {
705 strbuf_reset(&unquoted);
706 if (unquote_c_style(&unquoted, buf.buf, NULL))
707 die(_("line is badly quoted: %s"), buf.buf);
708 strbuf_swap(&buf, &unquoted);
709 }
710 strvec_push(&parsed_file, buf.buf);
711 strbuf_reset(&buf);
712 }
713
714 strbuf_release(&unquoted);
715 strbuf_release(&buf);
716 if (in != stdin)
717 fclose(in);
718
719 parse_pathspec(pathspec, magic_mask, flags, prefix, parsed_file.v);
720 strvec_clear(&parsed_file);
721}
722
723void copy_pathspec(struct pathspec *dst, const struct pathspec *src)
724{

Callers 7

cmd__parse_pathspec_fileFunction · 0.85
push_stashFunction · 0.85
cmd_resetFunction · 0.85
cmd_addFunction · 0.85
checkout_mainFunction · 0.85
prepare_indexFunction · 0.85
cmd_rmFunction · 0.85

Calls 8

xfopenFunction · 0.85
unquote_c_styleFunction · 0.85
strbuf_swapFunction · 0.85
strvec_pushFunction · 0.85
strbuf_releaseFunction · 0.85
parse_pathspecFunction · 0.85
strvec_clearFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected