summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2007-06-17 12:58:45 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-06-17 12:58:45 (UTC)
commitcd79c16844b4006d4fd6f4b82d2f6e7e19b20c8e (patch) (side-by-side diff)
treec303d75883492c89ed3243eadb31bdf2f3b9e660
parent42a7eb9c73457319a3fd5441ff26046fc9b31dad (diff)
downloadcgit-cd79c16844b4006d4fd6f4b82d2f6e7e19b20c8e.zip
cgit-cd79c16844b4006d4fd6f4b82d2f6e7e19b20c8e.tar.gz
cgit-cd79c16844b4006d4fd6f4b82d2f6e7e19b20c8e.tar.bz2
ui-log: honor id=sha1 on querystring
This teaches ui-log to prefer id=sha1 and fallback to h=rev if no id- parameter is specified. With this change, summary, log, commit and tree views now passes current branch using h parameter and current revision using id parameter. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--ui-log.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index f5135d9..b936a70 100644
--- a/cgit.c
+++ b/cgit.c
@@ -79,33 +79,33 @@ static void cgit_print_repo_page(struct cacheitem *item)
return;
}
show_search = (cgit_cmd == CMD_LOG);
cgit_print_docstart(title, item);
if (!cgit_cmd) {
cgit_print_pageheader("summary", show_search);
cgit_print_summary();
cgit_print_docend();
return;
}
cgit_print_pageheader(cgit_query_page, show_search);
switch(cgit_cmd) {
case CMD_LOG:
- cgit_print_log(cgit_query_head, cgit_query_ofs,
+ cgit_print_log(cgit_query_sha1, cgit_query_ofs,
cgit_max_commit_count, cgit_query_search,
cgit_query_path, 1);
break;
case CMD_TREE:
cgit_print_tree(cgit_query_sha1, cgit_query_path);
break;
case CMD_COMMIT:
cgit_print_commit(cgit_query_sha1);
break;
case CMD_DIFF:
cgit_print_diff(cgit_query_head, cgit_query_sha1, cgit_query_sha2,
cgit_query_path);
break;
default:
cgit_print_error("Invalid request");
}
diff --git a/ui-log.c b/ui-log.c
index 8d774b0..95cb453 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -46,32 +46,35 @@ void print_commit(struct commit *commit)
}
html("</td><td>");
html_txt(info->author);
html("</td></tr>\n");
cgit_free_commitinfo(info);
}
void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager)
{
struct rev_info rev;
struct commit *commit;
const char *argv[] = {NULL, tip, NULL, NULL, NULL};
int argc = 2;
int i;
+ if (!tip)
+ argv[1] = cgit_query_head;
+
if (grep)
argv[argc++] = fmt("--grep=%s", grep);
if (path) {
argv[argc++] = "--";
argv[argc++] = path;
}
init_revisions(&rev, NULL);
rev.abbrev = DEFAULT_ABBREV;
rev.commit_format = CMIT_FMT_DEFAULT;
rev.verbose_header = 1;
rev.show_root_diff = 0;
setup_revisions(argc, argv, &rev, NULL);
if (rev.grep_filter) {
rev.grep_filter->regflags |= REG_ICASE;
compile_grep_patterns(rev.grep_filter);
}