author | Lars Hjemli <hjemli@gmail.com> | 2007-05-16 00:06:28 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-16 00:06:28 (UTC) |
commit | 723469962b42de9f73960a883403cfdc422f176f (patch) (unidiff) | |
tree | 6f0090acb7ba5f79524197ec2e8419c8556d8fac /ui-shared.c | |
parent | 97de8f0554649544c78aeb35a4c3431f17667ec5 (diff) | |
download | cgit-723469962b42de9f73960a883403cfdc422f176f.zip cgit-723469962b42de9f73960a883403cfdc422f176f.tar.gz cgit-723469962b42de9f73960a883403cfdc422f176f.tar.bz2 |
Make git_pageurl handle NULL querystrings
This is suddenly useful after the repo.defbranch-related changes.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-shared.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index b0cff7d..6211056 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -52,26 +52,30 @@ char *cgit_repourl(const char *reponame) | |||
52 | { | 52 | { |
53 | if (cgit_virtual_root) { | 53 | if (cgit_virtual_root) { |
54 | return fmt("%s/%s/", cgit_virtual_root, reponame); | 54 | return fmt("%s/%s/", cgit_virtual_root, reponame); |
55 | } else { | 55 | } else { |
56 | return fmt("?r=%s", reponame); | 56 | return fmt("?r=%s", reponame); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | char *cgit_pageurl(const char *reponame, const char *pagename, | 60 | char *cgit_pageurl(const char *reponame, const char *pagename, |
61 | const char *query) | 61 | const char *query) |
62 | { | 62 | { |
63 | if (cgit_virtual_root) { | 63 | if (cgit_virtual_root) { |
64 | if (query) | ||
64 | return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame, | 65 | return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame, |
65 | pagename, query); | 66 | pagename, query); |
67 | else | ||
68 | return fmt("%s/%s/%s/", cgit_virtual_root, reponame, | ||
69 | pagename); | ||
66 | } else { | 70 | } else { |
67 | return fmt("?r=%s&p=%s&%s", reponame, pagename, query); | 71 | return fmt("?r=%s&p=%s&%s", reponame, pagename, query); |
68 | } | 72 | } |
69 | } | 73 | } |
70 | 74 | ||
71 | char *cgit_currurl() | 75 | char *cgit_currurl() |
72 | { | 76 | { |
73 | if (!cgit_virtual_root) | 77 | if (!cgit_virtual_root) |
74 | return cgit_script_name; | 78 | return cgit_script_name; |
75 | else if (cgit_query_page) | 79 | else if (cgit_query_page) |
76 | return fmt("%s/%s/%s/", cgit_virtual_root, cgit_query_repo, cgit_query_page); | 80 | return fmt("%s/%s/%s/", cgit_virtual_root, cgit_query_repo, cgit_query_page); |
77 | else if (cgit_query_repo) | 81 | else if (cgit_query_repo) |