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

Function reftable_stack_clean_locked

reftable/stack.c:1780–1805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1778}
1779
1780static int reftable_stack_clean_locked(struct reftable_stack *st)
1781{
1782 uint64_t max = reftable_merged_table_max_update_index(
1783 reftable_stack_merged_table(st));
1784 DIR *dir = opendir(st->reftable_dir);
1785 struct dirent *d = NULL;
1786 if (!dir) {
1787 return REFTABLE_IO_ERROR;
1788 }
1789
1790 while ((d = readdir(dir))) {
1791 int found = 0;
1792 if (!is_table_name(d->d_name))
1793 continue;
1794
1795 for (size_t i = 0; !found && i < st->tables_len; i++)
1796 found = !strcmp(reftable_table_name(st->tables[i]), d->d_name);
1797 if (found)
1798 continue;
1799
1800 remove_maybe_stale_table(st, max, d->d_name);
1801 }
1802
1803 closedir(dir);
1804 return 0;
1805}
1806
1807int reftable_stack_clean(struct reftable_stack *st)
1808{

Callers 1

reftable_stack_cleanFunction · 0.85

Calls 8

opendirFunction · 0.85
readdirFunction · 0.85
is_table_nameFunction · 0.85
reftable_table_nameFunction · 0.85
remove_maybe_stale_tableFunction · 0.85
closedirFunction · 0.85

Tested by

no test coverage detected