author | Stefan Naewe <stefan.naewe@atlas-elektronik.com> | 2008-08-01 12:54:38 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-08-01 20:09:13 (UTC) |
commit | 0f0ab148c6d444316af10e6b4c7a60630fed45d3 (patch) (unidiff) | |
tree | a52c08e648c5d656866cecf78e757f2f85211b19 | |
parent | a1266edfe6ec1fd678c8f6b60ffbd21d88ff5a93 (diff) | |
download | cgit-0f0ab148c6d444316af10e6b4c7a60630fed45d3.zip cgit-0f0ab148c6d444316af10e6b4c7a60630fed45d3.tar.gz cgit-0f0ab148c6d444316af10e6b4c7a60630fed45d3.tar.bz2 |
Added `local-time` option to cgitrc
When `local-time` is set, commit, tag and patch timestamps will be printed
in the servers timezone. Also, regardless of the value of `local-time`,
these timestamps will now always show the timezone.
Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.c | 3 | ||||
-rw-r--r-- | cgit.h | 3 | ||||
-rw-r--r-- | ui-commit.c | 4 | ||||
-rw-r--r-- | ui-patch.c | 2 | ||||
-rw-r--r-- | ui-shared.c | 11 | ||||
-rw-r--r-- | ui-shared.h | 2 | ||||
-rw-r--r-- | ui-tag.c | 2 |
7 files changed, 17 insertions, 10 deletions
@@ -58,64 +58,66 @@ void config_cb(const char *name, const char *value) | |||
58 | else if (!strcmp(name, "cache-root")) | 58 | else if (!strcmp(name, "cache-root")) |
59 | ctx.cfg.cache_root = xstrdup(value); | 59 | ctx.cfg.cache_root = xstrdup(value); |
60 | else if (!strcmp(name, "cache-root-ttl")) | 60 | else if (!strcmp(name, "cache-root-ttl")) |
61 | ctx.cfg.cache_root_ttl = atoi(value); | 61 | ctx.cfg.cache_root_ttl = atoi(value); |
62 | else if (!strcmp(name, "cache-repo-ttl")) | 62 | else if (!strcmp(name, "cache-repo-ttl")) |
63 | ctx.cfg.cache_repo_ttl = atoi(value); | 63 | ctx.cfg.cache_repo_ttl = atoi(value); |
64 | else if (!strcmp(name, "cache-static-ttl")) | 64 | else if (!strcmp(name, "cache-static-ttl")) |
65 | ctx.cfg.cache_static_ttl = atoi(value); | 65 | ctx.cfg.cache_static_ttl = atoi(value); |
66 | else if (!strcmp(name, "cache-dynamic-ttl")) | 66 | else if (!strcmp(name, "cache-dynamic-ttl")) |
67 | ctx.cfg.cache_dynamic_ttl = atoi(value); | 67 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
68 | else if (!strcmp(name, "max-message-length")) | 68 | else if (!strcmp(name, "max-message-length")) |
69 | ctx.cfg.max_msg_len = atoi(value); | 69 | ctx.cfg.max_msg_len = atoi(value); |
70 | else if (!strcmp(name, "max-repodesc-length")) | 70 | else if (!strcmp(name, "max-repodesc-length")) |
71 | ctx.cfg.max_repodesc_len = atoi(value); | 71 | ctx.cfg.max_repodesc_len = atoi(value); |
72 | else if (!strcmp(name, "max-repo-count")) | 72 | else if (!strcmp(name, "max-repo-count")) |
73 | ctx.cfg.max_repo_count = atoi(value); | 73 | ctx.cfg.max_repo_count = atoi(value); |
74 | else if (!strcmp(name, "max-commit-count")) | 74 | else if (!strcmp(name, "max-commit-count")) |
75 | ctx.cfg.max_commit_count = atoi(value); | 75 | ctx.cfg.max_commit_count = atoi(value); |
76 | else if (!strcmp(name, "summary-log")) | 76 | else if (!strcmp(name, "summary-log")) |
77 | ctx.cfg.summary_log = atoi(value); | 77 | ctx.cfg.summary_log = atoi(value); |
78 | else if (!strcmp(name, "summary-branches")) | 78 | else if (!strcmp(name, "summary-branches")) |
79 | ctx.cfg.summary_branches = atoi(value); | 79 | ctx.cfg.summary_branches = atoi(value); |
80 | else if (!strcmp(name, "summary-tags")) | 80 | else if (!strcmp(name, "summary-tags")) |
81 | ctx.cfg.summary_tags = atoi(value); | 81 | ctx.cfg.summary_tags = atoi(value); |
82 | else if (!strcmp(name, "agefile")) | 82 | else if (!strcmp(name, "agefile")) |
83 | ctx.cfg.agefile = xstrdup(value); | 83 | ctx.cfg.agefile = xstrdup(value); |
84 | else if (!strcmp(name, "renamelimit")) | 84 | else if (!strcmp(name, "renamelimit")) |
85 | ctx.cfg.renamelimit = atoi(value); | 85 | ctx.cfg.renamelimit = atoi(value); |
86 | else if (!strcmp(name, "robots")) | 86 | else if (!strcmp(name, "robots")) |
87 | ctx.cfg.robots = xstrdup(value); | 87 | ctx.cfg.robots = xstrdup(value); |
88 | else if (!strcmp(name, "clone-prefix")) | 88 | else if (!strcmp(name, "clone-prefix")) |
89 | ctx.cfg.clone_prefix = xstrdup(value); | 89 | ctx.cfg.clone_prefix = xstrdup(value); |
90 | else if (!strcmp(name, "local-time")) | ||
91 | ctx.cfg.local_time = atoi(value); | ||
90 | else if (!strcmp(name, "repo.group")) | 92 | else if (!strcmp(name, "repo.group")) |
91 | ctx.cfg.repo_group = xstrdup(value); | 93 | ctx.cfg.repo_group = xstrdup(value); |
92 | else if (!strcmp(name, "repo.url")) | 94 | else if (!strcmp(name, "repo.url")) |
93 | ctx.repo = cgit_add_repo(value); | 95 | ctx.repo = cgit_add_repo(value); |
94 | else if (!strcmp(name, "repo.name")) | 96 | else if (!strcmp(name, "repo.name")) |
95 | ctx.repo->name = xstrdup(value); | 97 | ctx.repo->name = xstrdup(value); |
96 | else if (ctx.repo && !strcmp(name, "repo.path")) | 98 | else if (ctx.repo && !strcmp(name, "repo.path")) |
97 | ctx.repo->path = trim_end(value, '/'); | 99 | ctx.repo->path = trim_end(value, '/'); |
98 | else if (ctx.repo && !strcmp(name, "repo.clone-url")) | 100 | else if (ctx.repo && !strcmp(name, "repo.clone-url")) |
99 | ctx.repo->clone_url = xstrdup(value); | 101 | ctx.repo->clone_url = xstrdup(value); |
100 | else if (ctx.repo && !strcmp(name, "repo.desc")) | 102 | else if (ctx.repo && !strcmp(name, "repo.desc")) |
101 | ctx.repo->desc = xstrdup(value); | 103 | ctx.repo->desc = xstrdup(value); |
102 | else if (ctx.repo && !strcmp(name, "repo.owner")) | 104 | else if (ctx.repo && !strcmp(name, "repo.owner")) |
103 | ctx.repo->owner = xstrdup(value); | 105 | ctx.repo->owner = xstrdup(value); |
104 | else if (ctx.repo && !strcmp(name, "repo.defbranch")) | 106 | else if (ctx.repo && !strcmp(name, "repo.defbranch")) |
105 | ctx.repo->defbranch = xstrdup(value); | 107 | ctx.repo->defbranch = xstrdup(value); |
106 | else if (ctx.repo && !strcmp(name, "repo.snapshots")) | 108 | else if (ctx.repo && !strcmp(name, "repo.snapshots")) |
107 | ctx.repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); /* XXX: &? */ | 109 | ctx.repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); /* XXX: &? */ |
108 | else if (ctx.repo && !strcmp(name, "repo.enable-log-filecount")) | 110 | else if (ctx.repo && !strcmp(name, "repo.enable-log-filecount")) |
109 | ctx.repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); | 111 | ctx.repo->enable_log_filecount = ctx.cfg.enable_log_filecount * atoi(value); |
110 | else if (ctx.repo && !strcmp(name, "repo.enable-log-linecount")) | 112 | else if (ctx.repo && !strcmp(name, "repo.enable-log-linecount")) |
111 | ctx.repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); | 113 | ctx.repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); |
112 | else if (ctx.repo && !strcmp(name, "repo.module-link")) | 114 | else if (ctx.repo && !strcmp(name, "repo.module-link")) |
113 | ctx.repo->module_link= xstrdup(value); | 115 | ctx.repo->module_link= xstrdup(value); |
114 | else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { | 116 | else if (ctx.repo && !strcmp(name, "repo.readme") && value != NULL) { |
115 | if (*value == '/') | 117 | if (*value == '/') |
116 | ctx.repo->readme = xstrdup(value); | 118 | ctx.repo->readme = xstrdup(value); |
117 | else | 119 | else |
118 | ctx.repo->readme = xstrdup(fmt("%s/%s", ctx.repo->path, value)); | 120 | ctx.repo->readme = xstrdup(fmt("%s/%s", ctx.repo->path, value)); |
119 | } else if (!strcmp(name, "include")) | 121 | } else if (!strcmp(name, "include")) |
120 | parse_configfile(value, config_cb); | 122 | parse_configfile(value, config_cb); |
121 | } | 123 | } |
@@ -138,64 +140,65 @@ static void querystring_cb(const char *name, const char *value) | |||
138 | ctx.qry.has_symref = 1; | 140 | ctx.qry.has_symref = 1; |
139 | } else if (!strcmp(name, "id")) { | 141 | } else if (!strcmp(name, "id")) { |
140 | ctx.qry.sha1 = xstrdup(value); | 142 | ctx.qry.sha1 = xstrdup(value); |
141 | ctx.qry.has_sha1 = 1; | 143 | ctx.qry.has_sha1 = 1; |
142 | } else if (!strcmp(name, "id2")) { | 144 | } else if (!strcmp(name, "id2")) { |
143 | ctx.qry.sha2 = xstrdup(value); | 145 | ctx.qry.sha2 = xstrdup(value); |
144 | ctx.qry.has_sha1 = 1; | 146 | ctx.qry.has_sha1 = 1; |
145 | } else if (!strcmp(name, "ofs")) { | 147 | } else if (!strcmp(name, "ofs")) { |
146 | ctx.qry.ofs = atoi(value); | 148 | ctx.qry.ofs = atoi(value); |
147 | } else if (!strcmp(name, "path")) { | 149 | } else if (!strcmp(name, "path")) { |
148 | ctx.qry.path = trim_end(value, '/'); | 150 | ctx.qry.path = trim_end(value, '/'); |
149 | } else if (!strcmp(name, "name")) { | 151 | } else if (!strcmp(name, "name")) { |
150 | ctx.qry.name = xstrdup(value); | 152 | ctx.qry.name = xstrdup(value); |
151 | } else if (!strcmp(name, "mimetype")) { | 153 | } else if (!strcmp(name, "mimetype")) { |
152 | ctx.qry.mimetype = xstrdup(value); | 154 | ctx.qry.mimetype = xstrdup(value); |
153 | } | 155 | } |
154 | } | 156 | } |
155 | 157 | ||
156 | static void prepare_context(struct cgit_context *ctx) | 158 | static void prepare_context(struct cgit_context *ctx) |
157 | { | 159 | { |
158 | memset(ctx, 0, sizeof(ctx)); | 160 | memset(ctx, 0, sizeof(ctx)); |
159 | ctx->cfg.agefile = "info/web/last-modified"; | 161 | ctx->cfg.agefile = "info/web/last-modified"; |
160 | ctx->cfg.nocache = 0; | 162 | ctx->cfg.nocache = 0; |
161 | ctx->cfg.cache_size = 0; | 163 | ctx->cfg.cache_size = 0; |
162 | ctx->cfg.cache_dynamic_ttl = 5; | 164 | ctx->cfg.cache_dynamic_ttl = 5; |
163 | ctx->cfg.cache_max_create_time = 5; | 165 | ctx->cfg.cache_max_create_time = 5; |
164 | ctx->cfg.cache_repo_ttl = 5; | 166 | ctx->cfg.cache_repo_ttl = 5; |
165 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; | 167 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; |
166 | ctx->cfg.cache_root_ttl = 5; | 168 | ctx->cfg.cache_root_ttl = 5; |
167 | ctx->cfg.cache_static_ttl = -1; | 169 | ctx->cfg.cache_static_ttl = -1; |
168 | ctx->cfg.css = "/cgit.css"; | 170 | ctx->cfg.css = "/cgit.css"; |
169 | ctx->cfg.logo = "/git-logo.png"; | 171 | ctx->cfg.logo = "/git-logo.png"; |
172 | ctx->cfg.local_time = 0; | ||
170 | ctx->cfg.max_repo_count = 50; | 173 | ctx->cfg.max_repo_count = 50; |
171 | ctx->cfg.max_commit_count = 50; | 174 | ctx->cfg.max_commit_count = 50; |
172 | ctx->cfg.max_lock_attempts = 5; | 175 | ctx->cfg.max_lock_attempts = 5; |
173 | ctx->cfg.max_msg_len = 80; | 176 | ctx->cfg.max_msg_len = 80; |
174 | ctx->cfg.max_repodesc_len = 80; | 177 | ctx->cfg.max_repodesc_len = 80; |
175 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | 178 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
176 | ctx->cfg.renamelimit = -1; | 179 | ctx->cfg.renamelimit = -1; |
177 | ctx->cfg.robots = "index, nofollow"; | 180 | ctx->cfg.robots = "index, nofollow"; |
178 | ctx->cfg.root_title = "Git repository browser"; | 181 | ctx->cfg.root_title = "Git repository browser"; |
179 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; | 182 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
180 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; | 183 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
181 | ctx->cfg.summary_branches = 10; | 184 | ctx->cfg.summary_branches = 10; |
182 | ctx->cfg.summary_log = 10; | 185 | ctx->cfg.summary_log = 10; |
183 | ctx->cfg.summary_tags = 10; | 186 | ctx->cfg.summary_tags = 10; |
184 | ctx->page.mimetype = "text/html"; | 187 | ctx->page.mimetype = "text/html"; |
185 | ctx->page.charset = PAGE_ENCODING; | 188 | ctx->page.charset = PAGE_ENCODING; |
186 | ctx->page.filename = NULL; | 189 | ctx->page.filename = NULL; |
187 | ctx->page.modified = time(NULL); | 190 | ctx->page.modified = time(NULL); |
188 | ctx->page.expires = ctx->page.modified; | 191 | ctx->page.expires = ctx->page.modified; |
189 | } | 192 | } |
190 | 193 | ||
191 | struct refmatch { | 194 | struct refmatch { |
192 | char *req_ref; | 195 | char *req_ref; |
193 | char *first_ref; | 196 | char *first_ref; |
194 | int match; | 197 | int match; |
195 | }; | 198 | }; |
196 | 199 | ||
197 | int find_current_ref(const char *refname, const unsigned char *sha1, | 200 | int find_current_ref(const char *refname, const unsigned char *sha1, |
198 | int flags, void *cb_data) | 201 | int flags, void *cb_data) |
199 | { | 202 | { |
200 | struct refmatch *info; | 203 | struct refmatch *info; |
201 | 204 | ||
@@ -1,57 +1,57 @@ | |||
1 | #ifndef CGIT_H | 1 | #ifndef CGIT_H |
2 | #define CGIT_H | 2 | #define CGIT_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <git-compat-util.h> | 5 | #include <git-compat-util.h> |
6 | #include <cache.h> | 6 | #include <cache.h> |
7 | #include <grep.h> | 7 | #include <grep.h> |
8 | #include <object.h> | 8 | #include <object.h> |
9 | #include <tree.h> | 9 | #include <tree.h> |
10 | #include <commit.h> | 10 | #include <commit.h> |
11 | #include <tag.h> | 11 | #include <tag.h> |
12 | #include <diff.h> | 12 | #include <diff.h> |
13 | #include <diffcore.h> | 13 | #include <diffcore.h> |
14 | #include <refs.h> | 14 | #include <refs.h> |
15 | #include <revision.h> | 15 | #include <revision.h> |
16 | #include <log-tree.h> | 16 | #include <log-tree.h> |
17 | #include <archive.h> | 17 | #include <archive.h> |
18 | #include <xdiff/xdiff.h> | 18 | #include <xdiff/xdiff.h> |
19 | #include <utf8.h> | 19 | #include <utf8.h> |
20 | 20 | ||
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Dateformats used on misc. pages | 23 | * Dateformats used on misc. pages |
24 | */ | 24 | */ |
25 | #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S" | 25 | #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" |
26 | #define FMT_SHORTDATE "%Y-%m-%d" | 26 | #define FMT_SHORTDATE "%Y-%m-%d" |
27 | 27 | ||
28 | 28 | ||
29 | /* | 29 | /* |
30 | * Limits used for relative dates | 30 | * Limits used for relative dates |
31 | */ | 31 | */ |
32 | #define TM_MIN 60 | 32 | #define TM_MIN 60 |
33 | #define TM_HOUR (TM_MIN * 60) | 33 | #define TM_HOUR (TM_MIN * 60) |
34 | #define TM_DAY (TM_HOUR * 24) | 34 | #define TM_DAY (TM_HOUR * 24) |
35 | #define TM_WEEK (TM_DAY * 7) | 35 | #define TM_WEEK (TM_DAY * 7) |
36 | #define TM_YEAR (TM_DAY * 365) | 36 | #define TM_YEAR (TM_DAY * 365) |
37 | #define TM_MONTH (TM_YEAR / 12.0) | 37 | #define TM_MONTH (TM_YEAR / 12.0) |
38 | 38 | ||
39 | 39 | ||
40 | /* | 40 | /* |
41 | * Default encoding | 41 | * Default encoding |
42 | */ | 42 | */ |
43 | #define PAGE_ENCODING "UTF-8" | 43 | #define PAGE_ENCODING "UTF-8" |
44 | 44 | ||
45 | typedef void (*configfn)(const char *name, const char *value); | 45 | typedef void (*configfn)(const char *name, const char *value); |
46 | typedef void (*filepair_fn)(struct diff_filepair *pair); | 46 | typedef void (*filepair_fn)(struct diff_filepair *pair); |
47 | typedef void (*linediff_fn)(char *line, int len); | 47 | typedef void (*linediff_fn)(char *line, int len); |
48 | 48 | ||
49 | struct cgit_repo { | 49 | struct cgit_repo { |
50 | char *url; | 50 | char *url; |
51 | char *name; | 51 | char *name; |
52 | char *path; | 52 | char *path; |
53 | char *desc; | 53 | char *desc; |
54 | char *owner; | 54 | char *owner; |
55 | char *defbranch; | 55 | char *defbranch; |
56 | char *group; | 56 | char *group; |
57 | char *module_link; | 57 | char *module_link; |
@@ -119,64 +119,65 @@ struct cgit_query { | |||
119 | char *mimetype; | 119 | char *mimetype; |
120 | int ofs; | 120 | int ofs; |
121 | }; | 121 | }; |
122 | 122 | ||
123 | struct cgit_config { | 123 | struct cgit_config { |
124 | char *agefile; | 124 | char *agefile; |
125 | char *cache_root; | 125 | char *cache_root; |
126 | char *clone_prefix; | 126 | char *clone_prefix; |
127 | char *css; | 127 | char *css; |
128 | char *favicon; | 128 | char *favicon; |
129 | char *footer; | 129 | char *footer; |
130 | char *index_header; | 130 | char *index_header; |
131 | char *index_info; | 131 | char *index_info; |
132 | char *logo; | 132 | char *logo; |
133 | char *logo_link; | 133 | char *logo_link; |
134 | char *module_link; | 134 | char *module_link; |
135 | char *repo_group; | 135 | char *repo_group; |
136 | char *robots; | 136 | char *robots; |
137 | char *root_title; | 137 | char *root_title; |
138 | char *root_desc; | 138 | char *root_desc; |
139 | char *root_readme; | 139 | char *root_readme; |
140 | char *script_name; | 140 | char *script_name; |
141 | char *virtual_root; | 141 | char *virtual_root; |
142 | int cache_size; | 142 | int cache_size; |
143 | int cache_dynamic_ttl; | 143 | int cache_dynamic_ttl; |
144 | int cache_max_create_time; | 144 | int cache_max_create_time; |
145 | int cache_repo_ttl; | 145 | int cache_repo_ttl; |
146 | int cache_root_ttl; | 146 | int cache_root_ttl; |
147 | int cache_static_ttl; | 147 | int cache_static_ttl; |
148 | int enable_index_links; | 148 | int enable_index_links; |
149 | int enable_log_filecount; | 149 | int enable_log_filecount; |
150 | int enable_log_linecount; | 150 | int enable_log_linecount; |
151 | int local_time; | ||
151 | int max_repo_count; | 152 | int max_repo_count; |
152 | int max_commit_count; | 153 | int max_commit_count; |
153 | int max_lock_attempts; | 154 | int max_lock_attempts; |
154 | int max_msg_len; | 155 | int max_msg_len; |
155 | int max_repodesc_len; | 156 | int max_repodesc_len; |
156 | int nocache; | 157 | int nocache; |
157 | int renamelimit; | 158 | int renamelimit; |
158 | int snapshots; | 159 | int snapshots; |
159 | int summary_branches; | 160 | int summary_branches; |
160 | int summary_log; | 161 | int summary_log; |
161 | int summary_tags; | 162 | int summary_tags; |
162 | }; | 163 | }; |
163 | 164 | ||
164 | struct cgit_page { | 165 | struct cgit_page { |
165 | time_t modified; | 166 | time_t modified; |
166 | time_t expires; | 167 | time_t expires; |
167 | char *mimetype; | 168 | char *mimetype; |
168 | char *charset; | 169 | char *charset; |
169 | char *filename; | 170 | char *filename; |
170 | char *title; | 171 | char *title; |
171 | }; | 172 | }; |
172 | 173 | ||
173 | struct cgit_context { | 174 | struct cgit_context { |
174 | struct cgit_query qry; | 175 | struct cgit_query qry; |
175 | struct cgit_config cfg; | 176 | struct cgit_config cfg; |
176 | struct cgit_repo *repo; | 177 | struct cgit_repo *repo; |
177 | struct cgit_page page; | 178 | struct cgit_page page; |
178 | }; | 179 | }; |
179 | 180 | ||
180 | struct cgit_snapshot_format { | 181 | struct cgit_snapshot_format { |
181 | const char *suffix; | 182 | const char *suffix; |
182 | const char *mimetype; | 183 | const char *mimetype; |
diff --git a/ui-commit.c b/ui-commit.c index 4bbb391..a6a85a4 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -11,72 +11,72 @@ | |||
11 | #include "ui-shared.h" | 11 | #include "ui-shared.h" |
12 | #include "ui-diff.h" | 12 | #include "ui-diff.h" |
13 | 13 | ||
14 | void cgit_print_commit(char *hex) | 14 | void cgit_print_commit(char *hex) |
15 | { | 15 | { |
16 | struct commit *commit, *parent; | 16 | struct commit *commit, *parent; |
17 | struct commitinfo *info; | 17 | struct commitinfo *info; |
18 | struct commit_list *p; | 18 | struct commit_list *p; |
19 | unsigned char sha1[20]; | 19 | unsigned char sha1[20]; |
20 | char *tmp; | 20 | char *tmp; |
21 | int parents = 0; | 21 | int parents = 0; |
22 | 22 | ||
23 | if (!hex) | 23 | if (!hex) |
24 | hex = ctx.qry.head; | 24 | hex = ctx.qry.head; |
25 | 25 | ||
26 | if (get_sha1(hex, sha1)) { | 26 | if (get_sha1(hex, sha1)) { |
27 | cgit_print_error(fmt("Bad object id: %s", hex)); | 27 | cgit_print_error(fmt("Bad object id: %s", hex)); |
28 | return; | 28 | return; |
29 | } | 29 | } |
30 | commit = lookup_commit_reference(sha1); | 30 | commit = lookup_commit_reference(sha1); |
31 | if (!commit) { | 31 | if (!commit) { |
32 | cgit_print_error(fmt("Bad commit reference: %s", hex)); | 32 | cgit_print_error(fmt("Bad commit reference: %s", hex)); |
33 | return; | 33 | return; |
34 | } | 34 | } |
35 | info = cgit_parse_commit(commit); | 35 | info = cgit_parse_commit(commit); |
36 | 36 | ||
37 | html("<table summary='commit info' class='commit-info'>\n"); | 37 | html("<table summary='commit info' class='commit-info'>\n"); |
38 | html("<tr><th>author</th><td>"); | 38 | html("<tr><th>author</th><td>"); |
39 | html_txt(info->author); | 39 | html_txt(info->author); |
40 | html(" "); | 40 | html(" "); |
41 | html_txt(info->author_email); | 41 | html_txt(info->author_email); |
42 | html("</td><td class='right'>"); | 42 | html("</td><td class='right'>"); |
43 | cgit_print_date(info->author_date, FMT_LONGDATE); | 43 | cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time); |
44 | html("</td></tr>\n"); | 44 | html("</td></tr>\n"); |
45 | html("<tr><th>committer</th><td>"); | 45 | html("<tr><th>committer</th><td>"); |
46 | html_txt(info->committer); | 46 | html_txt(info->committer); |
47 | html(" "); | 47 | html(" "); |
48 | html_txt(info->committer_email); | 48 | html_txt(info->committer_email); |
49 | html("</td><td class='right'>"); | 49 | html("</td><td class='right'>"); |
50 | cgit_print_date(info->committer_date, FMT_LONGDATE); | 50 | cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time); |
51 | html("</td></tr>\n"); | 51 | html("</td></tr>\n"); |
52 | html("<tr><th>commit</th><td colspan='2' class='sha1'>"); | 52 | html("<tr><th>commit</th><td colspan='2' class='sha1'>"); |
53 | tmp = sha1_to_hex(commit->object.sha1); | 53 | tmp = sha1_to_hex(commit->object.sha1); |
54 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp); | 54 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp); |
55 | html(" ("); | 55 | html(" ("); |
56 | cgit_patch_link("patch", NULL, NULL, NULL, tmp); | 56 | cgit_patch_link("patch", NULL, NULL, NULL, tmp); |
57 | html(")</td></tr>\n"); | 57 | html(")</td></tr>\n"); |
58 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); | 58 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); |
59 | tmp = xstrdup(hex); | 59 | tmp = xstrdup(hex); |
60 | cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, | 60 | cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, |
61 | ctx.qry.head, tmp, NULL); | 61 | ctx.qry.head, tmp, NULL); |
62 | html("</td></tr>\n"); | 62 | html("</td></tr>\n"); |
63 | for (p = commit->parents; p ; p = p->next) { | 63 | for (p = commit->parents; p ; p = p->next) { |
64 | parent = lookup_commit_reference(p->item->object.sha1); | 64 | parent = lookup_commit_reference(p->item->object.sha1); |
65 | if (!parent) { | 65 | if (!parent) { |
66 | html("<tr><td colspan='3'>"); | 66 | html("<tr><td colspan='3'>"); |
67 | cgit_print_error("Error reading parent commit"); | 67 | cgit_print_error("Error reading parent commit"); |
68 | html("</td></tr>"); | 68 | html("</td></tr>"); |
69 | continue; | 69 | continue; |
70 | } | 70 | } |
71 | html("<tr><th>parent</th>" | 71 | html("<tr><th>parent</th>" |
72 | "<td colspan='2' class='sha1'>"); | 72 | "<td colspan='2' class='sha1'>"); |
73 | cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, | 73 | cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, |
74 | ctx.qry.head, sha1_to_hex(p->item->object.sha1)); | 74 | ctx.qry.head, sha1_to_hex(p->item->object.sha1)); |
75 | html(" ("); | 75 | html(" ("); |
76 | cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, | 76 | cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, |
77 | sha1_to_hex(p->item->object.sha1), NULL); | 77 | sha1_to_hex(p->item->object.sha1), NULL); |
78 | html(")</td></tr>"); | 78 | html(")</td></tr>"); |
79 | parents++; | 79 | parents++; |
80 | } | 80 | } |
81 | if (ctx.repo->snapshots) { | 81 | if (ctx.repo->snapshots) { |
82 | html("<tr><th>download</th><td colspan='2' class='sha1'>"); | 82 | html("<tr><th>download</th><td colspan='2' class='sha1'>"); |
@@ -74,45 +74,45 @@ void cgit_print_patch(char *hex) | |||
74 | { | 74 | { |
75 | struct commit *commit; | 75 | struct commit *commit; |
76 | struct commitinfo *info; | 76 | struct commitinfo *info; |
77 | unsigned char sha1[20], old_sha1[20]; | 77 | unsigned char sha1[20], old_sha1[20]; |
78 | char *patchname; | 78 | char *patchname; |
79 | 79 | ||
80 | if (!hex) | 80 | if (!hex) |
81 | hex = ctx.qry.head; | 81 | hex = ctx.qry.head; |
82 | 82 | ||
83 | if (get_sha1(hex, sha1)) { | 83 | if (get_sha1(hex, sha1)) { |
84 | cgit_print_error(fmt("Bad object id: %s", hex)); | 84 | cgit_print_error(fmt("Bad object id: %s", hex)); |
85 | return; | 85 | return; |
86 | } | 86 | } |
87 | commit = lookup_commit_reference(sha1); | 87 | commit = lookup_commit_reference(sha1); |
88 | if (!commit) { | 88 | if (!commit) { |
89 | cgit_print_error(fmt("Bad commit reference: %s", hex)); | 89 | cgit_print_error(fmt("Bad commit reference: %s", hex)); |
90 | return; | 90 | return; |
91 | } | 91 | } |
92 | info = cgit_parse_commit(commit); | 92 | info = cgit_parse_commit(commit); |
93 | 93 | ||
94 | if (commit->parents && commit->parents->item) | 94 | if (commit->parents && commit->parents->item) |
95 | hashcpy(old_sha1, commit->parents->item->object.sha1); | 95 | hashcpy(old_sha1, commit->parents->item->object.sha1); |
96 | else | 96 | else |
97 | hashclr(old_sha1); | 97 | hashclr(old_sha1); |
98 | 98 | ||
99 | patchname = fmt("%s.patch", sha1_to_hex(sha1)); | 99 | patchname = fmt("%s.patch", sha1_to_hex(sha1)); |
100 | ctx.page.mimetype = "text/plain"; | 100 | ctx.page.mimetype = "text/plain"; |
101 | ctx.page.filename = patchname; | 101 | ctx.page.filename = patchname; |
102 | cgit_print_http_headers(&ctx); | 102 | cgit_print_http_headers(&ctx); |
103 | htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); | 103 | htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); |
104 | htmlf("From: %s%s\n", info->author, info->author_email); | 104 | htmlf("From: %s%s\n", info->author, info->author_email); |
105 | html("Date: "); | 105 | html("Date: "); |
106 | cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n"); | 106 | cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); |
107 | htmlf("Subject: %s\n\n", info->subject); | 107 | htmlf("Subject: %s\n\n", info->subject); |
108 | if (info->msg && *info->msg) { | 108 | if (info->msg && *info->msg) { |
109 | htmlf("%s", info->msg); | 109 | htmlf("%s", info->msg); |
110 | if (info->msg[strlen(info->msg) - 1] != '\n') | 110 | if (info->msg[strlen(info->msg) - 1] != '\n') |
111 | html("\n"); | 111 | html("\n"); |
112 | } | 112 | } |
113 | html("---\n"); | 113 | html("---\n"); |
114 | cgit_diff_tree(old_sha1, sha1, filepair_cb, NULL); | 114 | cgit_diff_tree(old_sha1, sha1, filepair_cb, NULL); |
115 | html("--\n"); | 115 | html("--\n"); |
116 | htmlf("cgit %s\n", CGIT_VERSION); | 116 | htmlf("cgit %s\n", CGIT_VERSION); |
117 | cgit_free_commitinfo(info); | 117 | cgit_free_commitinfo(info); |
118 | } | 118 | } |
diff --git a/ui-shared.c b/ui-shared.c index 4280a70..197ee37 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -324,87 +324,90 @@ void cgit_patch_link(char *name, char *title, char *class, char *head, | |||
324 | char *rev) | 324 | char *rev) |
325 | { | 325 | { |
326 | reporevlink("patch", name, title, class, head, rev, NULL); | 326 | reporevlink("patch", name, title, class, head, rev, NULL); |
327 | } | 327 | } |
328 | 328 | ||
329 | void cgit_object_link(struct object *obj) | 329 | void cgit_object_link(struct object *obj) |
330 | { | 330 | { |
331 | char *page, *arg, *url; | 331 | char *page, *arg, *url; |
332 | 332 | ||
333 | if (obj->type == OBJ_COMMIT) { | 333 | if (obj->type == OBJ_COMMIT) { |
334 | cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL, | 334 | cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL, |
335 | ctx.qry.head, sha1_to_hex(obj->sha1)); | 335 | ctx.qry.head, sha1_to_hex(obj->sha1)); |
336 | return; | 336 | return; |
337 | } else if (obj->type == OBJ_TREE) { | 337 | } else if (obj->type == OBJ_TREE) { |
338 | page = "tree"; | 338 | page = "tree"; |
339 | arg = "id"; | 339 | arg = "id"; |
340 | } else if (obj->type == OBJ_TAG) { | 340 | } else if (obj->type == OBJ_TAG) { |
341 | page = "tag"; | 341 | page = "tag"; |
342 | arg = "id"; | 342 | arg = "id"; |
343 | } else { | 343 | } else { |
344 | page = "blob"; | 344 | page = "blob"; |
345 | arg = "id"; | 345 | arg = "id"; |
346 | } | 346 | } |
347 | 347 | ||
348 | url = cgit_pageurl(ctx.qry.repo, page, | 348 | url = cgit_pageurl(ctx.qry.repo, page, |
349 | fmt("%s=%s", arg, sha1_to_hex(obj->sha1))); | 349 | fmt("%s=%s", arg, sha1_to_hex(obj->sha1))); |
350 | html_link_open(url, NULL, NULL); | 350 | html_link_open(url, NULL, NULL); |
351 | htmlf("%s %s", typename(obj->type), | 351 | htmlf("%s %s", typename(obj->type), |
352 | sha1_to_hex(obj->sha1)); | 352 | sha1_to_hex(obj->sha1)); |
353 | html_link_close(); | 353 | html_link_close(); |
354 | } | 354 | } |
355 | 355 | ||
356 | void cgit_print_date(time_t secs, char *format) | 356 | void cgit_print_date(time_t secs, char *format, int local_time) |
357 | { | 357 | { |
358 | char buf[64]; | 358 | char buf[64]; |
359 | struct tm *time; | 359 | struct tm *time; |
360 | 360 | ||
361 | if (!secs) | 361 | if (!secs) |
362 | return; | 362 | return; |
363 | time = gmtime(&secs); | 363 | if(local_time) |
364 | time = localtime(&secs); | ||
365 | else | ||
366 | time = gmtime(&secs); | ||
364 | strftime(buf, sizeof(buf)-1, format, time); | 367 | strftime(buf, sizeof(buf)-1, format, time); |
365 | html_txt(buf); | 368 | html_txt(buf); |
366 | } | 369 | } |
367 | 370 | ||
368 | void cgit_print_age(time_t t, time_t max_relative, char *format) | 371 | void cgit_print_age(time_t t, time_t max_relative, char *format) |
369 | { | 372 | { |
370 | time_t now, secs; | 373 | time_t now, secs; |
371 | 374 | ||
372 | if (!t) | 375 | if (!t) |
373 | return; | 376 | return; |
374 | time(&now); | 377 | time(&now); |
375 | secs = now - t; | 378 | secs = now - t; |
376 | 379 | ||
377 | if (secs > max_relative && max_relative >= 0) { | 380 | if (secs > max_relative && max_relative >= 0) { |
378 | cgit_print_date(t, format); | 381 | cgit_print_date(t, format, ctx.cfg.local_time); |
379 | return; | 382 | return; |
380 | } | 383 | } |
381 | 384 | ||
382 | if (secs < TM_HOUR * 2) { | 385 | if (secs < TM_HOUR * 2) { |
383 | htmlf("<span class='age-mins'>%.0f min.</span>", | 386 | htmlf("<span class='age-mins'>%.0f min.</span>", |
384 | secs * 1.0 / TM_MIN); | 387 | secs * 1.0 / TM_MIN); |
385 | return; | 388 | return; |
386 | } | 389 | } |
387 | if (secs < TM_DAY * 2) { | 390 | if (secs < TM_DAY * 2) { |
388 | htmlf("<span class='age-hours'>%.0f hours</span>", | 391 | htmlf("<span class='age-hours'>%.0f hours</span>", |
389 | secs * 1.0 / TM_HOUR); | 392 | secs * 1.0 / TM_HOUR); |
390 | return; | 393 | return; |
391 | } | 394 | } |
392 | if (secs < TM_WEEK * 2) { | 395 | if (secs < TM_WEEK * 2) { |
393 | htmlf("<span class='age-days'>%.0f days</span>", | 396 | htmlf("<span class='age-days'>%.0f days</span>", |
394 | secs * 1.0 / TM_DAY); | 397 | secs * 1.0 / TM_DAY); |
395 | return; | 398 | return; |
396 | } | 399 | } |
397 | if (secs < TM_MONTH * 2) { | 400 | if (secs < TM_MONTH * 2) { |
398 | htmlf("<span class='age-weeks'>%.0f weeks</span>", | 401 | htmlf("<span class='age-weeks'>%.0f weeks</span>", |
399 | secs * 1.0 / TM_WEEK); | 402 | secs * 1.0 / TM_WEEK); |
400 | return; | 403 | return; |
401 | } | 404 | } |
402 | if (secs < TM_YEAR * 2) { | 405 | if (secs < TM_YEAR * 2) { |
403 | htmlf("<span class='age-months'>%.0f months</span>", | 406 | htmlf("<span class='age-months'>%.0f months</span>", |
404 | secs * 1.0 / TM_MONTH); | 407 | secs * 1.0 / TM_MONTH); |
405 | return; | 408 | return; |
406 | } | 409 | } |
407 | htmlf("<span class='age-years'>%.0f years</span>", | 410 | htmlf("<span class='age-years'>%.0f years</span>", |
408 | secs * 1.0 / TM_YEAR); | 411 | secs * 1.0 / TM_YEAR); |
409 | } | 412 | } |
410 | 413 | ||
@@ -424,65 +427,65 @@ void cgit_print_http_headers(struct cgit_context *ctx) | |||
424 | } | 427 | } |
425 | 428 | ||
426 | void cgit_print_docstart(struct cgit_context *ctx) | 429 | void cgit_print_docstart(struct cgit_context *ctx) |
427 | { | 430 | { |
428 | html(cgit_doctype); | 431 | html(cgit_doctype); |
429 | html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n"); | 432 | html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n"); |
430 | html("<head>\n"); | 433 | html("<head>\n"); |
431 | html("<title>"); | 434 | html("<title>"); |
432 | html_txt(ctx->page.title); | 435 | html_txt(ctx->page.title); |
433 | html("</title>\n"); | 436 | html("</title>\n"); |
434 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); | 437 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); |
435 | if (ctx->cfg.robots && *ctx->cfg.robots) | 438 | if (ctx->cfg.robots && *ctx->cfg.robots) |
436 | htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots); | 439 | htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots); |
437 | html("<link rel='stylesheet' type='text/css' href='"); | 440 | html("<link rel='stylesheet' type='text/css' href='"); |
438 | html_attr(ctx->cfg.css); | 441 | html_attr(ctx->cfg.css); |
439 | html("'/>\n"); | 442 | html("'/>\n"); |
440 | if (ctx->cfg.favicon) { | 443 | if (ctx->cfg.favicon) { |
441 | html("<link rel='shortcut icon' href='"); | 444 | html("<link rel='shortcut icon' href='"); |
442 | html_attr(ctx->cfg.favicon); | 445 | html_attr(ctx->cfg.favicon); |
443 | html("'/>\n"); | 446 | html("'/>\n"); |
444 | } | 447 | } |
445 | html("</head>\n"); | 448 | html("</head>\n"); |
446 | html("<body>\n"); | 449 | html("<body>\n"); |
447 | } | 450 | } |
448 | 451 | ||
449 | void cgit_print_docend() | 452 | void cgit_print_docend() |
450 | { | 453 | { |
451 | html("</div>"); | 454 | html("</div>"); |
452 | if (ctx.cfg.footer) | 455 | if (ctx.cfg.footer) |
453 | html_include(ctx.cfg.footer); | 456 | html_include(ctx.cfg.footer); |
454 | else { | 457 | else { |
455 | html("<div class='footer'>generated "); | 458 | html("<div class='footer'>generated "); |
456 | cgit_print_date(time(NULL), FMT_LONGDATE); | 459 | cgit_print_date(time(NULL), FMT_LONGDATE, ctx.cfg.local_time); |
457 | htmlf(" by cgit %s", cgit_version); | 460 | htmlf(" by cgit %s", cgit_version); |
458 | html("</div>\n"); | 461 | html("</div>\n"); |
459 | } | 462 | } |
460 | html("</body>\n</html>\n"); | 463 | html("</body>\n</html>\n"); |
461 | } | 464 | } |
462 | 465 | ||
463 | int print_branch_option(const char *refname, const unsigned char *sha1, | 466 | int print_branch_option(const char *refname, const unsigned char *sha1, |
464 | int flags, void *cb_data) | 467 | int flags, void *cb_data) |
465 | { | 468 | { |
466 | char *name = (char *)refname; | 469 | char *name = (char *)refname; |
467 | html_option(name, name, ctx.qry.head); | 470 | html_option(name, name, ctx.qry.head); |
468 | return 0; | 471 | return 0; |
469 | } | 472 | } |
470 | 473 | ||
471 | int print_archive_ref(const char *refname, const unsigned char *sha1, | 474 | int print_archive_ref(const char *refname, const unsigned char *sha1, |
472 | int flags, void *cb_data) | 475 | int flags, void *cb_data) |
473 | { | 476 | { |
474 | struct tag *tag; | 477 | struct tag *tag; |
475 | struct taginfo *info; | 478 | struct taginfo *info; |
476 | struct object *obj; | 479 | struct object *obj; |
477 | char buf[256], *url; | 480 | char buf[256], *url; |
478 | unsigned char fileid[20]; | 481 | unsigned char fileid[20]; |
479 | int *header = (int *)cb_data; | 482 | int *header = (int *)cb_data; |
480 | 483 | ||
481 | if (prefixcmp(refname, "refs/archives")) | 484 | if (prefixcmp(refname, "refs/archives")) |
482 | return 0; | 485 | return 0; |
483 | strncpy(buf, refname+14, sizeof(buf)); | 486 | strncpy(buf, refname+14, sizeof(buf)); |
484 | obj = parse_object(sha1); | 487 | obj = parse_object(sha1); |
485 | if (!obj) | 488 | if (!obj) |
486 | return 1; | 489 | return 1; |
487 | if (obj->type == OBJ_TAG) { | 490 | if (obj->type == OBJ_TAG) { |
488 | tag = lookup_tag(sha1); | 491 | tag = lookup_tag(sha1); |
diff --git a/ui-shared.h b/ui-shared.h index 3005d30..07da4b4 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
@@ -1,40 +1,40 @@ | |||
1 | #ifndef UI_SHARED_H | 1 | #ifndef UI_SHARED_H |
2 | #define UI_SHARED_H | 2 | #define UI_SHARED_H |
3 | 3 | ||
4 | extern char *cgit_repourl(const char *reponame); | 4 | extern char *cgit_repourl(const char *reponame); |
5 | extern char *cgit_fileurl(const char *reponame, const char *pagename, | 5 | extern char *cgit_fileurl(const char *reponame, const char *pagename, |
6 | const char *filename, const char *query); | 6 | const char *filename, const char *query); |
7 | extern char *cgit_pageurl(const char *reponame, const char *pagename, | 7 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
8 | const char *query); | 8 | const char *query); |
9 | 9 | ||
10 | extern void cgit_index_link(char *name, char *title, char *class, | 10 | extern void cgit_index_link(char *name, char *title, char *class, |
11 | char *pattern, int ofs); | 11 | char *pattern, int ofs); |
12 | extern void cgit_tree_link(char *name, char *title, char *class, char *head, | 12 | extern void cgit_tree_link(char *name, char *title, char *class, char *head, |
13 | char *rev, char *path); | 13 | char *rev, char *path); |
14 | extern void cgit_log_link(char *name, char *title, char *class, char *head, | 14 | extern void cgit_log_link(char *name, char *title, char *class, char *head, |
15 | char *rev, char *path, int ofs, char *grep, | 15 | char *rev, char *path, int ofs, char *grep, |
16 | char *pattern); | 16 | char *pattern); |
17 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, | 17 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, |
18 | char *rev); | 18 | char *rev); |
19 | extern void cgit_patch_link(char *name, char *title, char *class, char *head, | 19 | extern void cgit_patch_link(char *name, char *title, char *class, char *head, |
20 | char *rev); | 20 | char *rev); |
21 | extern void cgit_refs_link(char *name, char *title, char *class, char *head, | 21 | extern void cgit_refs_link(char *name, char *title, char *class, char *head, |
22 | char *rev, char *path); | 22 | char *rev, char *path); |
23 | extern void cgit_snapshot_link(char *name, char *title, char *class, | 23 | extern void cgit_snapshot_link(char *name, char *title, char *class, |
24 | char *head, char *rev, char *archivename); | 24 | char *head, char *rev, char *archivename); |
25 | extern void cgit_diff_link(char *name, char *title, char *class, char *head, | 25 | extern void cgit_diff_link(char *name, char *title, char *class, char *head, |
26 | char *new_rev, char *old_rev, char *path); | 26 | char *new_rev, char *old_rev, char *path); |
27 | extern void cgit_object_link(struct object *obj); | 27 | extern void cgit_object_link(struct object *obj); |
28 | 28 | ||
29 | extern void cgit_print_error(char *msg); | 29 | extern void cgit_print_error(char *msg); |
30 | extern void cgit_print_date(time_t secs, char *format); | 30 | extern void cgit_print_date(time_t secs, char *format, int local_time); |
31 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); | 31 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); |
32 | extern void cgit_print_http_headers(struct cgit_context *ctx); | 32 | extern void cgit_print_http_headers(struct cgit_context *ctx); |
33 | extern void cgit_print_docstart(struct cgit_context *ctx); | 33 | extern void cgit_print_docstart(struct cgit_context *ctx); |
34 | extern void cgit_print_docend(); | 34 | extern void cgit_print_docend(); |
35 | extern void cgit_print_pageheader(struct cgit_context *ctx); | 35 | extern void cgit_print_pageheader(struct cgit_context *ctx); |
36 | extern void cgit_print_filemode(unsigned short mode); | 36 | extern void cgit_print_filemode(unsigned short mode); |
37 | extern void cgit_print_snapshot_links(const char *repo, const char *head, | 37 | extern void cgit_print_snapshot_links(const char *repo, const char *head, |
38 | const char *hex, int snapshots); | 38 | const char *hex, int snapshots); |
39 | 39 | ||
40 | #endif /* UI_SHARED_H */ | 40 | #endif /* UI_SHARED_H */ |
@@ -28,48 +28,48 @@ static void print_tag_content(char *buf) | |||
28 | html_txt(++p); | 28 | html_txt(++p); |
29 | html("</div>"); | 29 | html("</div>"); |
30 | } | 30 | } |
31 | } | 31 | } |
32 | 32 | ||
33 | void cgit_print_tag(char *revname) | 33 | void cgit_print_tag(char *revname) |
34 | { | 34 | { |
35 | unsigned char sha1[20]; | 35 | unsigned char sha1[20]; |
36 | struct object *obj; | 36 | struct object *obj; |
37 | struct tag *tag; | 37 | struct tag *tag; |
38 | struct taginfo *info; | 38 | struct taginfo *info; |
39 | 39 | ||
40 | if (get_sha1(revname, sha1)) { | 40 | if (get_sha1(revname, sha1)) { |
41 | cgit_print_error(fmt("Bad tag reference: %s", revname)); | 41 | cgit_print_error(fmt("Bad tag reference: %s", revname)); |
42 | return; | 42 | return; |
43 | } | 43 | } |
44 | obj = parse_object(sha1); | 44 | obj = parse_object(sha1); |
45 | if (!obj) { | 45 | if (!obj) { |
46 | cgit_print_error(fmt("Bad object id: %s", sha1_to_hex(sha1))); | 46 | cgit_print_error(fmt("Bad object id: %s", sha1_to_hex(sha1))); |
47 | return; | 47 | return; |
48 | } | 48 | } |
49 | if (obj->type == OBJ_TAG) { | 49 | if (obj->type == OBJ_TAG) { |
50 | tag = lookup_tag(sha1); | 50 | tag = lookup_tag(sha1); |
51 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { | 51 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { |
52 | cgit_print_error(fmt("Bad tag object: %s", revname)); | 52 | cgit_print_error(fmt("Bad tag object: %s", revname)); |
53 | return; | 53 | return; |
54 | } | 54 | } |
55 | html("<table class='commit-info'>\n"); | 55 | html("<table class='commit-info'>\n"); |
56 | htmlf("<tr><td>Tag name</td><td>%s (%s)</td></tr>\n", | 56 | htmlf("<tr><td>Tag name</td><td>%s (%s)</td></tr>\n", |
57 | revname, sha1_to_hex(sha1)); | 57 | revname, sha1_to_hex(sha1)); |
58 | if (info->tagger_date > 0) { | 58 | if (info->tagger_date > 0) { |
59 | html("<tr><td>Tag date</td><td>"); | 59 | html("<tr><td>Tag date</td><td>"); |
60 | cgit_print_date(info->tagger_date, FMT_LONGDATE); | 60 | cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time); |
61 | html("</td></tr>\n"); | 61 | html("</td></tr>\n"); |
62 | } | 62 | } |
63 | if (info->tagger) { | 63 | if (info->tagger) { |
64 | html("<tr><td>Tagged by</td><td>"); | 64 | html("<tr><td>Tagged by</td><td>"); |
65 | html_txt(info->tagger); | 65 | html_txt(info->tagger); |
66 | html("</td></tr>\n"); | 66 | html("</td></tr>\n"); |
67 | } | 67 | } |
68 | html("<tr><td>Tagged object</td><td>"); | 68 | html("<tr><td>Tagged object</td><td>"); |
69 | cgit_object_link(tag->tagged); | 69 | cgit_object_link(tag->tagged); |
70 | html("</td></tr>\n"); | 70 | html("</td></tr>\n"); |
71 | html("</table>\n"); | 71 | html("</table>\n"); |
72 | print_tag_content(info->msg); | 72 | print_tag_content(info->msg); |
73 | } | 73 | } |
74 | return; | 74 | return; |
75 | } | 75 | } |