* how to acess a commit diffstat from the summary page? @ 2011-09-13 14:23 ` florent.vial 2011-09-14 6:02 ` hjemli 0 siblings, 1 reply; 2+ messages in thread From: florent.vial @ 2011-09-13 14:23 UTC (permalink / raw) Hi all, I have a question for a problem I am not able to resolve on my own. My intention is following: I want to add a column for each commit in the summary tab that displays only the diffstat summary of that commit (i.e the "X files changed, Y insertions, Z deletions" part). For that I refactored in my previous patches all the cgit_print_commit functions to be able to use them in a flexible way in some other parts of cgit, in my case ui-summary.c. Unfortunately, the variables storing the diff information per commit are all static variables in ui-diff.c (static int total_adds, total_rems, max_changes). The consequence is that when I call: cgit_print_diffstat(old_rev_sha1, new_rev_sha1, prefix, show_diffstat_summary_only); the variables are not reset properly and the diff counting keeps increasing. I tried to reset the variables before hand but that did not work either. My feeling is that I have to somehow fake a query for each commit in the summary tab, which is ugly. Does someone know the inner functioning of ui-diff and could help me use it properly and/or rewrite it to avoid use of static variables? Thank you in advance, Florent ^ permalink raw reply [flat|nested] 2+ messages in thread
* how to acess a commit diffstat from the summary page? 2011-09-13 14:23 ` how to acess a commit diffstat from the summary page? florent.vial @ 2011-09-14 6:02 ` hjemli 0 siblings, 0 replies; 2+ messages in thread From: hjemli @ 2011-09-14 6:02 UTC (permalink / raw) On Tue, Sep 13, 2011 at 16:23, Vial, Florent <florent.vial at intel.com> wrote: > I want to add a column for each commit in the summary tab that displays only the diffstat summary of that commit (i.e the "X files changed, Y insertions, Z deletions" part). > For that I refactored in my previous patches all the cgit_print_commit functions to be able to use them in a flexible way in some other parts of cgit, in my case ui-summary.c. > Unfortunately, the variables storing the diff information per commit are all static variables ?in ui-diff.c (static int total_adds, total_rems, max_changes). > The consequence is that when I call: > > cgit_print_diffstat(old_rev_sha1, new_rev_sha1, prefix, show_diffstat_summary_only); > > the variables are not reset properly and the diff counting keeps increasing. I tried to reset the variables before hand but that did not work either. You probably want to look at ui-log.c, which implements this per commit for the log view. From http://hjemli.net/git/cgit/tree/ui-log.c#n172: if (ctx.repo->enable_log_filecount || ctx.repo->enable_log_linecount) { files = 0; add_lines = 0; rem_lines = 0; cgit_diff_commit(commit, inspect_files, ctx.qry.vpath); } -- larsh ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-14 6:02 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <AcxyH4HH4ScgzGFpRLaw4sSQ9qCcuA==> 2011-09-13 14:23 ` how to acess a commit diffstat from the summary page? florent.vial 2011-09-14 6:02 ` hjemli
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).