Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Log the path of a repository that will not open
The 404 page names only the repository and nothing reached the log, so
a mistyped repo.path left no trace of the path cgit had tried.
Diffstat (limited to 'source')
| -rw-r--r-- | source/cgit.c | 9 |
1 file changed, 9 insertions, 0 deletions
diff --git a/source/cgit.c b/source/cgit.c index 0017d75..39e8ab8 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -1132,6 +1132,8 @@ static void prepare_repo_env(struct cgit_repo *repo) static void open_repo(int *nongit, int *err) { + static int reported; + // A repository configured without a path has nothing to open. if (!ctx.repo->path) { *nongit = 1; @@ -1143,6 +1145,13 @@ static void open_repo(int *nongit, int *err) errno = 0; setup_git_directory_gently(the_repository, nongit); *err = errno; + // The error page names the repository alone, so the path goes to the + // log, and only once, since a failed cache fill renders a page again. + if (*nongit && !reported) { + reported = 1; + fprintf(stderr, "[cgit] Unable to open repository %s at %s: %s\n", ctx.repo->url, + ctx.repo->path, *err ? strerror(*err) : "Not a valid git repository"); + } // Notes come out of the object store, which a repository that failed // to open has none of. The commit and log pages always ask for them, // so they are set up either way, but a default ref that names no tree |
