diff options
author | Kent Overstreet <kmo@daterainc.com> | 2014-03-22 18:05:42 -0700 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-03-22 18:05:42 -0700 |
commit | 03de8b68f17396d7710d2584c6a6fc786c26279f (patch) | |
tree | 4c2b9125786e3ca99f7d208d62eeca1fdf4abb97 | |
parent | 88b93113235452d47e7ce474689327c43e64b843 (diff) |
This lets you do the equivalent of
git log ^ref1 ref2
by adding an id2 parameter to a log url
-rw-r--r-- | cmd.c | 6 | ||||
-rw-r--r-- | ui-log.c | 14 | ||||
-rw-r--r-- | ui-log.h | 4 | ||||
-rw-r--r-- | ui-summary.c | 2 |
4 files changed, 17 insertions, 9 deletions
@@ -71,9 +71,9 @@ static void info_fn(void) static void log_fn(void) { - cgit_print_log(ctx.qry.sha1, ctx.qry.ofs, ctx.cfg.max_commit_count, - ctx.qry.grep, ctx.qry.search, ctx.qry.path, 1, - ctx.repo->enable_commit_graph, + cgit_print_log(ctx.qry.sha1, ctx.qry.sha2, ctx.qry.ofs, + ctx.cfg.max_commit_count, ctx.qry.grep, ctx.qry.search, + ctx.qry.path, 1, ctx.repo->enable_commit_graph, ctx.repo->commit_sort); } @@ -285,18 +285,24 @@ static char *next_token(char **src) return result; } -void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, - char *path, int pager, int commit_graph, int commit_sort) +void cgit_print_log(const char *tip, const char *from, int ofs, int cnt, + char *grep, char *pattern, char *path, int pager, + int commit_graph, int commit_sort) { struct rev_info rev; struct commit *commit; struct argv_array rev_argv = ARGV_ARRAY_INIT; int i, columns = commit_graph ? 4 : 3; - int must_free_tip = 0; + int must_free_tip = 0, must_free_from = 0; /* rev_argv.argv[0] will be ignored by setup_revisions */ argv_array_push(&rev_argv, "log_rev_setup"); + if (from) { + from = disambiguate_ref(from, &must_free_from); + argv_array_pushf(&rev_argv, "^%s", from); + } + if (!tip) tip = ctx.qry.head; tip = disambiguate_ref(tip, &must_free_tip); @@ -430,4 +436,6 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern /* If we allocated tip then it is safe to cast away const. */ if (must_free_tip) free((char*) tip); + if (must_free_from) + free((char*) from); } @@ -1,8 +1,8 @@ #ifndef UI_LOG_H #define UI_LOG_H -extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, - char *pattern, char *path, int pager, +extern void cgit_print_log(const char *tip, const char *from, int ofs, int cnt, + char *grep, char *pattern, char *path, int pager, int commit_graph, int commit_sort); extern void show_commit_decorations(struct commit *commit); diff --git a/ui-summary.c b/ui-summary.c index ddd8f1b..2c41cff 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -85,7 +85,7 @@ void cgit_print_summary() cgit_print_tags(ctx.cfg.summary_tags); if (ctx.cfg.summary_log > 0) { htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); - cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, + cgit_print_log(ctx.qry.head, NULL, 0, ctx.cfg.summary_log, NULL, NULL, NULL, 0, 0, 0); } if (ctx.repo->clone_url) |