Commit Graph

15 Commits (682adbc0cad2baa1a6119013b166f52de3ee3352)

Author SHA1 Message Date
Johan Herland 682adbc0ca scan_path(): Improve handling of inaccessible directories
When scanning a tree containing inaccessible directories (e.g. '.ssh'
directories in users' homedirs, or repos with explicitly restricted access),
scan_path() currently causes three lines of "Permissions denied" errors to be
printed to the CGI error log per inaccessible directory:

  Error checking path /home/foo/.ssh: Permission denied (13)
  Error checking path /home/foo/.ssh/.git: Permission denied (13)
  Error opening directory /home/foo/.ssh: Permission denied (13)

This is a side-effect of calling is_git_dir(path) and
is_git_dir(fmt("%s/.git", path) _before_ we try to opendir(path).

By placing the opendir(path) before the two is_git_dir() calls, we reduce the
noise to a single line per inaccessible directory:

  Error opening directory /home/foo/.ssh: Permission denied (13)

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <larsh@prediktor.no>
14 years ago
Felix Hanley e0c6f23789 Add `strict-export` option
This option is used to specify a filename which needs to be present in
the repositories found during `scan-path` processing. By setting this
option to 'git-daemon-export-ok', only repositories explicitly marked
for git daemon export will be included in the cgit configuration.

Signed-off-by: Felix Hanley <felix@seconddrawer.com.au>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Lars Hjemli 536c7a1eb2 Merge branch 'lh/section-from-path'
Conflicts:
	scan-tree.c
14 years ago
Lars Hjemli 797110e39d Add support for 'section-from-path' option
This option can be used to autogenerate section names during scan-path
processing.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Lars Hjemli 515edb0da3 Add support for "readme" option
The value of this option is used as the default value for repo.readme.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Jason A. Donenfeld 119397b175 Add support for 'enable-gitweb-owner' option
When this option is enabled (which it is by default), cgit will lookup
the 'gitweb.owner' setting in each git config file found when processing
the 'scan-path' option.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Jason A. Donenfeld 2e4a941626 Add support for 'remove-suffix' option
When this option is enabled, the '.git' suffix of repository directories
found while processing the 'scan-path' option will be removed.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Jason A. Donenfeld 3516502aa0 Add support for 'project-list' option
This option specifies the location of a projectlist file as used by
gitweb - when 'scan-tree' is later specified, only the projects listed in
the projectlist file will be added.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Lars Hjemli 31ba37c0a4 scan-tree: add test for noweb-file in repo dir
If such a file exists, the repo is not added to the repolist.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
14 years ago
Lars Hjemli 74061ed5f0 Add support for repo-local cgitrc file
When recursively scanning a directory tree looking for git repositories,
cgit will now parse cgitrc files found within such repositories.

The repo-specific config files can include any repo-specific options
except 'repo.url' and 'repo.path'. Also, in such config files the 'repo.'
prefix can not be used, i.e. the valid options then becomes:
* name
* clone-url
* desc
* ower
* defbranch
* snapshots
* enable-log-filecount
* enable-log-linecount
* max-stats
* module-link
* section
* about-filter
* commit-filter
* source-filter
* readme

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli fb9bf55cde scan-tree: detect non-bare repository and stop scanning early
We don't want to descend into every subdirectory of a git repository
with a workdir.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Stefan Naewe 6445a3ad09 scan-tree: split the pw_gecos field at the ',' to get the real name
Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
15 years ago
Lars Hjemli e16f178334 Add and use a common readfile() function
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>
15 years ago
Simon Arlott 011f2e9bdd truncate buffer before reading empty files
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>
15 years ago
Lars Hjemli 93397a765b Add support for --scan-tree=<path> option to cgit
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>
16 years ago