author | Lars Hjemli <hjemli@gmail.com> | 2007-06-17 16:12:03 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-06-17 16:12:03 (UTC) |
commit | 4a0be586662843382ecfa53af34a13b291312bc0 (patch) (unidiff) | |
tree | 01e0cd725fe249df3449bb089aad9f8d58081f89 /ui-shared.c | |
parent | faaca447b071592c9a1e1f14b4d0d2a39b4c795a (diff) | |
download | cgit-4a0be586662843382ecfa53af34a13b291312bc0.zip cgit-4a0be586662843382ecfa53af34a13b291312bc0.tar.gz cgit-4a0be586662843382ecfa53af34a13b291312bc0.tar.bz2 |
Add cgit_diff_link()
This adds a new function used to generate links to the diff page and uses
it everywhere such links appear (expect for single files in the diffstat
displayed on the commit page: this is now a link to the tree page).
The updated diff-page now expects zero, one or two revision specifiers, in
parameters head, id and id2. Id defaults to head unless otherwise specified,
while head (as usual) defaults to repo.defbranch. If id2 isn't specified, it
defaults to the first parent of id1.
The most important change is of course that now all repo pages (summary, log,
tree, commit and diff) has support for passing on the current branch and
revision, i.e. the road is now open for a 'static' menu with links to all
of these pages.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-shared.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index 71c899a..15d8254 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -177,4 +177,26 @@ void cgit_commit_link(char *name, char *title, char *class, char *head, | |||
177 | } | 177 | } |
178 | 178 | ||
179 | void cgit_diff_link(char *name, char *title, char *class, char *head, | ||
180 | char *new_rev, char *old_rev, char *path) | ||
181 | { | ||
182 | char *delim; | ||
183 | |||
184 | delim = repolink(title, class, "diff", head, path); | ||
185 | if (new_rev && strcmp(new_rev, cgit_query_head)) { | ||
186 | html(delim); | ||
187 | html("id="); | ||
188 | html_attr(new_rev); | ||
189 | delim = "&"; | ||
190 | } | ||
191 | if (old_rev) { | ||
192 | html(delim); | ||
193 | html("id2="); | ||
194 | html_attr(old_rev); | ||
195 | } | ||
196 | html("'>"); | ||
197 | html_txt(name); | ||
198 | html("</a>"); | ||
199 | } | ||
200 | |||
179 | void cgit_print_date(time_t secs, char *format) | 201 | void cgit_print_date(time_t secs, char *format) |
180 | { | 202 | { |