From d8a045c91469b1d121b8fd14dffaa367b194831d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 6 Sep 2026 21:46:52 -1000 Subject: Clean up the whole tree --- source/scan-tree.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'source/scan-tree.c') diff --git a/source/scan-tree.c b/source/scan-tree.c index f72a5be..c46b47d 100644 --- a/source/scan-tree.c +++ b/source/scan-tree.c @@ -16,8 +16,7 @@ // Git writes this line into the description file of every repository it // creates, so a repository still carrying it gets cgit's own default instead. static const char *default_git_desc = - "Unnamed repository; edit this file 'description' to name the " - "repository."; + "Unnamed repository; edit this file 'description' to name the repository."; // The config callbacks are handed only a name and a value, so the repository // being filled in waits here for the length of one add_repo call. @@ -33,8 +32,7 @@ static int stat_entry(const char *dir, const char *name, struct stat *st) // A missing entry is the ordinary answer for a directory that is not a // repository, so only some other failure is worth reporting. if (err && errno != ENOENT) - fprintf(stderr, "[cgit] Error checking path %s: %s (%d)\n", - dir, strerror(errno), errno); + fprintf(stderr, "[cgit] Error checking path %s: %s (%d)\n", dir, strerror(errno), errno); strbuf_release(&path); return err; } @@ -51,8 +49,7 @@ static int is_git_dir(const char *path) } static int apply_gitconfig(const char *key, const char *value, - const __attribute__((unused)) struct config_context *cfg_ctx, - void *cb) + const __attribute__((unused)) struct config_context *cfg_ctx, void *cb) { const char *name; @@ -94,8 +91,7 @@ static char *section_slash(struct strbuf *relpath, int depth) depth--; } else { slash = relpath->buf + relpath->len; - while (slash && depth && - (slash = find_char_back(relpath->buf, slash - 1, '/'))) + while (slash && depth && (slash = find_char_back(relpath->buf, slash - 1, '/'))) depth++; } return slash && !depth ? slash : NULL; @@ -127,8 +123,7 @@ static void add_repo(const char *base, struct strbuf *path) size_t desc_size; if (stat(path->buf, &st)) { - fprintf(stderr, "[cgit] Error accessing %s: %s (%d)\n", - path->buf, strerror(errno), errno); + fprintf(stderr, "[cgit] Error accessing %s: %s (%d)\n", path->buf, strerror(errno), errno); return; } @@ -184,18 +179,15 @@ static void add_repo(const char *base, struct strbuf *path) if (pwd->pw_gecos) if ((comma = strchr(pwd->pw_gecos, ','))) *comma = '\0'; - current_repo->owner = cgit_strdup_first_line( - pwd->pw_gecos ? pwd->pw_gecos : pwd->pw_name); + current_repo->owner = cgit_strdup_first_line(pwd->pw_gecos ? pwd->pw_gecos : pwd->pw_name); } if (current_repo->desc == cgit_default_repo_desc || !current_repo->desc) { strbuf_addstr(path, "description"); if (!stat(path->buf, &st)) - cgit_read_first_line(path->buf, ¤t_repo->desc, - &desc_size); + cgit_read_first_line(path->buf, ¤t_repo->desc, &desc_size); strbuf_setlen(path, pathlen); - if (current_repo->desc && - !strcmp(current_repo->desc, default_git_desc)) { + if (current_repo->desc && !strcmp(current_repo->desc, default_git_desc)) { free(current_repo->desc); current_repo->desc = cgit_default_repo_desc; } @@ -231,8 +223,7 @@ static void scan_path(const char *base, const char *path) struct stat st; if (!dir) { - fprintf(stderr, "[cgit] Error opening directory %s: %s (%d)\n", - path, strerror(errno), errno); + fprintf(stderr, "[cgit] Error opening directory %s: %s (%d)\n", path, strerror(errno), errno); return; } @@ -255,8 +246,7 @@ static void scan_path(const char *base, const char *path) strbuf_setlen(&pathbuf, pathlen); strbuf_addstr(&pathbuf, ent->d_name); if (stat(pathbuf.buf, &st)) { - fprintf(stderr, "[cgit] Error checking path %s: %s (%d)\n", - pathbuf.buf, strerror(errno), errno); + fprintf(stderr, "[cgit] Error checking path %s: %s (%d)\n", pathbuf.buf, strerror(errno), errno); continue; } if (S_ISDIR(st.st_mode)) -- cgit v2.8.0