From d85e8a9810cbfbe5cfe80509a7b47cb39483e6ac Mon Sep 17 00:00:00 2001 From: John Keeping Date: Sat, 31 Mar 2018 15:18:57 +0100 Subject: ui-snapshot: pass repo into get_ref_from_filename() Prepare to allow a custom snapshot prefix. Signed-off-by: John Keeping Reviewed-by: Christian Hesse --- ui-snapshot.c | 7 ++++--- 1 file 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, * pending a 'v' or a 'V' to the remaining snapshot name ("0.7.2" -> * "v0.7.2") gives us something valid. */ -static const char *get_ref_from_filename(const char *url, const char *filename, +static const char *get_ref_from_filename(const struct cgit_repo *repo, + const char *filename, const struct cgit_snapshot_format *format) { const char *reponame; @@ -153,7 +154,7 @@ static const char *get_ref_from_filename(const char *url, const char *filename, if (get_oid(snapshot.buf, &oid) == 0) goto out; - reponame = cgit_repobasename(url); + reponame = cgit_repobasename(repo->url); if (starts_with(snapshot.buf, reponame)) { const char *new_start = snapshot.buf; new_start += strlen(reponame); @@ -200,7 +201,7 @@ void cgit_print_snapshot(const char *head, const char *hex, } if (!hex && dwim) { - hex = get_ref_from_filename(ctx.repo->url, filename, f); + hex = get_ref_from_filename(ctx.repo, filename, f); if (hex == NULL) { cgit_print_error_page(404, "Not found", "Not found"); return; -- cgit v1.2.3 y-blob-view'>lh/pretty-blob-view cgit itself, for testing
summaryrefslogtreecommitdiff
blob: e0391091e147891ca2639142a7b29180030db125 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90