]> gitweb.ps.run Git - ps-cgit/blobdiff - parsing.c
git: update to 1.9.2
[ps-cgit] / parsing.c
index 0062550d215dea7d585077e7aa040a69aa33cea8..5b4b1f4e58d034878831b19076a95e25683c748d 100644 (file)
--- a/parsing.c
+++ b/parsing.c
@@ -17,7 +17,8 @@
  */
 void cgit_parse_url(const char *url)
 {
-       char *cmd, *p;
+       char *c, *cmd, *p;
+       struct cgit_repo *repo;
 
        ctx.repo = NULL;
        if (!url || url[0] == '\0')
@@ -29,16 +30,20 @@ void cgit_parse_url(const char *url)
                return;
        }
 
-       cmd = strchr(url, '/');
-       while (!ctx.repo && cmd) {
-               cmd[0] = '\0';
-               ctx.repo = cgit_get_repoinfo(url);
-               if (ctx.repo == NULL) {
-                       cmd[0] = '/';
-                       cmd = strchr(cmd + 1, '/');
-                       continue;
+       cmd = NULL;
+       c = strchr(url, '/');
+       while (c) {
+               c[0] = '\0';
+               repo = cgit_get_repoinfo(url);
+               if (repo) {
+                       ctx.repo = repo;
+                       cmd = c;
                }
+               c[0] = '/';
+               c = strchr(c + 1, '/');
+       }
 
+       if (ctx.repo) {
                ctx.qry.repo = ctx.repo->url;
                p = strchr(cmd + 1, '/');
                if (p) {
@@ -156,7 +161,7 @@ struct commitinfo *cgit_parse_commit(struct commit *commit)
        }
 
        if (p && !prefixcmp(p, "committer ")) {
-               p = parse_user(p + 9, &ret->committer, &ret->committer_email,
+               p = parse_user(p + 10, &ret->committer, &ret->committer_email,
                        &ret->committer_date);
        }