mirror of
https://github.com/git/git.git
synced 2024-10-30 05:47:53 +01:00
4b33e60201
Convert the declaration of struct sha1_stat. Adjust all usages of this struct and replace hash{clr,cmp,cpy} with oid{clr,cmp,cpy} wherever possible. Rename it to struct oid_stat. Rename static function load_sha1_stat to load_oid_stat. Remove macro EMPTY_BLOB_SHA1_BIN, as it's no longer used. Signed-off-by: Patryk Obara <patryk.obara@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
64 lines
1.7 KiB
C
64 lines
1.7 KiB
C
#include "cache.h"
|
|
#include "dir.h"
|
|
|
|
static int compare_untracked(const void *a_, const void *b_)
|
|
{
|
|
const char *const *a = a_;
|
|
const char *const *b = b_;
|
|
return strcmp(*a, *b);
|
|
}
|
|
|
|
static int compare_dir(const void *a_, const void *b_)
|
|
{
|
|
const struct untracked_cache_dir *const *a = a_;
|
|
const struct untracked_cache_dir *const *b = b_;
|
|
return strcmp((*a)->name, (*b)->name);
|
|
}
|
|
|
|
static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
|
|
{
|
|
int i, len;
|
|
QSORT(ucd->untracked, ucd->untracked_nr, compare_untracked);
|
|
QSORT(ucd->dirs, ucd->dirs_nr, compare_dir);
|
|
len = base->len;
|
|
strbuf_addf(base, "%s/", ucd->name);
|
|
printf("%s %s", base->buf,
|
|
sha1_to_hex(ucd->exclude_sha1));
|
|
if (ucd->recurse)
|
|
fputs(" recurse", stdout);
|
|
if (ucd->check_only)
|
|
fputs(" check_only", stdout);
|
|
if (ucd->valid)
|
|
fputs(" valid", stdout);
|
|
printf("\n");
|
|
for (i = 0; i < ucd->untracked_nr; i++)
|
|
printf("%s\n", ucd->untracked[i]);
|
|
for (i = 0; i < ucd->dirs_nr; i++)
|
|
dump(ucd->dirs[i], base);
|
|
strbuf_setlen(base, len);
|
|
}
|
|
|
|
int cmd_main(int ac, const char **av)
|
|
{
|
|
struct untracked_cache *uc;
|
|
struct strbuf base = STRBUF_INIT;
|
|
|
|
/* Hack to avoid modifying the untracked cache when we read it */
|
|
ignore_untracked_cache_config = 1;
|
|
|
|
setup_git_directory();
|
|
if (read_cache() < 0)
|
|
die("unable to read index file");
|
|
uc = the_index.untracked;
|
|
if (!uc) {
|
|
printf("no untracked cache\n");
|
|
return 0;
|
|
}
|
|
printf("info/exclude %s\n", oid_to_hex(&uc->ss_info_exclude.oid));
|
|
printf("core.excludesfile %s\n", oid_to_hex(&uc->ss_excludes_file.oid));
|
|
printf("exclude_per_dir %s\n", uc->exclude_per_dir);
|
|
printf("flags %08x\n", uc->dir_flags);
|
|
if (uc->root)
|
|
dump(uc->root, &base);
|
|
return 0;
|
|
}
|