This function is used to read the full content of a textfile into a
newly allocated buffer (with zerotermination).
It replaces the earlier readfile() in scan-tree.c (which was rather
error-prone[1]), and is reused by read_agefile() in ui-repolist.c.
1: No checks for EINTR and EAGAIN, fixed-size buffer
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
If readfile() reads an empty file, fgets() won't truncate the buffer
and it'll still contain the contents of the previously read file.
[lh: fixed similar issue in ui-repolist.c]
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This option makes cgit scan a directory tree looking for git repositories,
generating suitable definitions for a cgitrc file on stdout.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>