about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ui-snapshot.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ui-snapshot.c b/ui-snapshot.c index b2d95f7..237a75f 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c
@@ -139,7 +139,8 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
139 * pending a 'v' or a 'V' to the remaining snapshot name ("0.7.2" -> 139 * pending a 'v' or a 'V' to the remaining snapshot name ("0.7.2" ->
140 * "v0.7.2") gives us something valid. 140 * "v0.7.2") gives us something valid.
141 */ 141 */
142static const char *get_ref_from_filename(const char *url, const char *filename, 142static const char *get_ref_from_filename(const struct cgit_repo *repo,
143 const char *filename,
143 const struct cgit_snapshot_format *format) 144 const struct cgit_snapshot_format *format)
144{ 145{
145 const char *reponame; 146 const char *reponame;
@@ -153,7 +154,7 @@ static const char *get_ref_from_filename(const char *url, const char *filename,
153 if (get_oid(snapshot.buf, &oid) == 0) 154 if (get_oid(snapshot.buf, &oid) == 0)
154 goto out; 155 goto out;
155 156
156 reponame = cgit_repobasename(url); 157 reponame = cgit_repobasename(repo->url);
157 if (starts_with(snapshot.buf, reponame)) { 158 if (starts_with(snapshot.buf, reponame)) {
158 const char *new_start = snapshot.buf; 159 const char *new_start = snapshot.buf;
159 new_start += strlen(reponame); 160 new_start += strlen(reponame);
@@ -200,7 +201,7 @@ void cgit_print_snapshot(const char *head, const char *hex,
200 } 201 }
201 202
202 if (!hex && dwim) { 203 if (!hex && dwim) {
203 hex = get_ref_from_filename(ctx.repo->url, filename, f); 204 hex = get_ref_from_filename(ctx.repo, filename, f);
204 if (hex == NULL) { 205 if (hex == NULL) {
205 cgit_print_error_page(404, "Not found", "Not found"); 206 cgit_print_error_page(404, "Not found", "Not found");
206 return; 207 return;