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

Function get_untracked_files

add-interactive.c:789–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

787}
788
789static int get_untracked_files(struct repository *r,
790 struct prefix_item_list *files,
791 const struct pathspec *ps)
792{
793 struct dir_struct dir = { 0 };
794 size_t i;
795 struct strbuf buf = STRBUF_INIT;
796
797 if (repo_read_index(r) < 0)
798 return error(_("could not read index"));
799
800 prefix_item_list_clear(files);
801 setup_standard_excludes(&dir);
802 add_pattern_list(&dir, EXC_CMDL, "--exclude option");
803 fill_directory(&dir, r->index, ps);
804
805 for (i = 0; i < dir.nr; i++) {
806 struct dir_entry *ent = dir.entries[i];
807
808 if (index_name_is_other(r->index, ent->name, ent->len)) {
809 strbuf_reset(&buf);
810 strbuf_add(&buf, ent->name, ent->len);
811 add_file_item(&files->items, buf.buf);
812 }
813 }
814
815 strbuf_release(&buf);
816 dir_clear(&dir);
817 return 0;
818}
819
820static int run_add_untracked(struct add_i_state *s, const struct pathspec *ps,
821 struct prefix_item_list *files,

Callers 1

run_add_untrackedFunction · 0.70

Calls 11

repo_read_indexFunction · 0.85
errorFunction · 0.85
prefix_item_list_clearFunction · 0.85
setup_standard_excludesFunction · 0.85
add_pattern_listFunction · 0.85
fill_directoryFunction · 0.85
index_name_is_otherFunction · 0.85
strbuf_addFunction · 0.85
add_file_itemFunction · 0.85
strbuf_releaseFunction · 0.85
dir_clearFunction · 0.85

Tested by

no test coverage detected