-rw-r--r-- | scan-tree.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/scan-tree.c b/scan-tree.c index 9bf9b38..a83a78c 100644 --- a/scan-tree.c +++ b/scan-tree.c | |||
@@ -72,24 +72,27 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) | |||
72 | path, strerror(errno), errno); | 72 | path, strerror(errno), errno); |
73 | return; | 73 | return; |
74 | } | 74 | } |
75 | if (base == path) | 75 | if (base == path) |
76 | p = fmt("%s", path); | 76 | p = fmt("%s", path); |
77 | else | 77 | else |
78 | p = fmt("%s", path + strlen(base) + 1); | 78 | p = fmt("%s", path + strlen(base) + 1); |
79 | 79 | ||
80 | if (!strcmp(p + strlen(p) - 5, "/.git")) | 80 | if (!strcmp(p + strlen(p) - 5, "/.git")) |
81 | p[strlen(p) - 5] = '\0'; | 81 | p[strlen(p) - 5] = '\0'; |
82 | 82 | ||
83 | repo = cgit_add_repo(xstrdup(p)); | 83 | repo = cgit_add_repo(xstrdup(p)); |
84 | if (ctx.cfg.remove_suffix) | ||
85 | if ((p = strrchr(repo->url, '.')) && !strcmp(p, ".git")) | ||
86 | *p = '\0'; | ||
84 | repo->name = repo->url; | 87 | repo->name = repo->url; |
85 | repo->path = xstrdup(path); | 88 | repo->path = xstrdup(path); |
86 | p = (pwd && pwd->pw_gecos) ? strchr(pwd->pw_gecos, ',') : NULL; | 89 | p = (pwd && pwd->pw_gecos) ? strchr(pwd->pw_gecos, ',') : NULL; |
87 | if (p) | 90 | if (p) |
88 | *p = '\0'; | 91 | *p = '\0'; |
89 | repo->owner = (pwd ? xstrdup(pwd->pw_gecos ? pwd->pw_gecos : pwd->pw_name) : ""); | 92 | repo->owner = (pwd ? xstrdup(pwd->pw_gecos ? pwd->pw_gecos : pwd->pw_name) : ""); |
90 | 93 | ||
91 | p = fmt("%s/description", path); | 94 | p = fmt("%s/description", path); |
92 | if (!stat(p, &st)) | 95 | if (!stat(p, &st)) |
93 | readfile(p, &repo->desc, &size); | 96 | readfile(p, &repo->desc, &size); |
94 | 97 | ||
95 | p = fmt("%s/README.html", path); | 98 | p = fmt("%s/README.html", path); |