4 static int compare_untracked(const void *a_, const void *b_)
6 const char *const *a = a_;
7 const char *const *b = b_;
11 static int compare_dir(const void *a_, const void *b_)
13 const struct untracked_cache_dir *const *a = a_;
14 const struct untracked_cache_dir *const *b = b_;
15 return strcmp((*a)->name, (*b)->name);
18 static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
21 QSORT(ucd->untracked, ucd->untracked_nr, compare_untracked);
22 QSORT(ucd->dirs, ucd->dirs_nr, compare_dir);
24 strbuf_addf(base, "%s/", ucd->name);
25 printf("%s %s", base->buf,
26 sha1_to_hex(ucd->exclude_sha1));
28 fputs(" recurse", stdout);
30 fputs(" check_only", stdout);
32 fputs(" valid", stdout);
34 for (i = 0; i < ucd->untracked_nr; i++)
35 printf("%s\n", ucd->untracked[i]);
36 for (i = 0; i < ucd->dirs_nr; i++)
37 dump(ucd->dirs[i], base);
38 strbuf_setlen(base, len);
41 int cmd_main(int ac, const char **av)
43 struct untracked_cache *uc;
44 struct strbuf base = STRBUF_INIT;
46 /* Hack to avoid modifying the untracked cache when we read it */
47 ignore_untracked_cache_config = 1;
49 setup_git_directory();
51 die("unable to read index file");
52 uc = the_index.untracked;
54 printf("no untracked cache\n");
57 printf("info/exclude %s\n", oid_to_hex(&uc->ss_info_exclude.oid));
58 printf("core.excludesfile %s\n", oid_to_hex(&uc->ss_excludes_file.oid));
59 printf("exclude_per_dir %s\n", uc->exclude_per_dir);
60 printf("flags %08x\n", uc->dir_flags);
62 dump(uc->root, &base);