| 22785 | } autoindex_limit_probe_t; |
| 22786 | |
| 22787 | static bool autoindex_limit_write_fixture(const char *repodir, |
| 22788 | const autoindex_limit_probe_t *probe) { |
| 22789 | if (th_mkdir_p(repodir) != 0) { |
| 22790 | return false; |
| 22791 | } |
| 22792 | for (int i = 0; i < probe->files; i++) { |
| 22793 | char path[640]; |
| 22794 | char body[96]; |
| 22795 | snprintf(path, sizeof(path), "%s/f%d.py", repodir, i); |
| 22796 | snprintf(body, sizeof(body), "def f%d():\n return %d\n", i, i); |
| 22797 | if (th_write_file(path, body) != 0) { |
| 22798 | return false; |
| 22799 | } |
| 22800 | } |
| 22801 | if (probe->git_root) { |
| 22802 | char gitdir[640]; |
| 22803 | char head[700]; |
| 22804 | snprintf(gitdir, sizeof(gitdir), "%s/.git", repodir); |
| 22805 | snprintf(head, sizeof(head), "%s/HEAD", gitdir); |
| 22806 | if (th_mkdir_p(gitdir) != 0 || th_write_file(head, "ref: refs/heads/main\n") != 0) { |
| 22807 | return false; |
| 22808 | } |
| 22809 | } |
| 22810 | return true; |
| 22811 | } |
| 22812 | |
| 22813 | /* Drive initialize → maybe_auto_index over a fresh root holding probe->files |
| 22814 | * indexable files under auto_index_limit=probe->limit. skip_out receives the |
no test coverage detected