author | Lars Hjemli <hjemli@gmail.com> | 2007-05-13 15:03:27 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-13 15:03:27 (UTC) |
commit | 80e577c3ef2a73becabff7e9c9c242f317a87de9 (patch) (unidiff) | |
tree | 56f1bdddd84ae373749a9f611b972f8b6e010e26 | |
parent | 38a0f9cd89c4c5a97bd5b38e7b56da809a00fccb (diff) | |
download | cgit-80e577c3ef2a73becabff7e9c9c242f317a87de9.zip cgit-80e577c3ef2a73becabff7e9c9c242f317a87de9.tar.gz cgit-80e577c3ef2a73becabff7e9c9c242f317a87de9.tar.bz2 |
Show number of changed lines in log view
Use the new file-diff interface to calculate number of changed lines
per commit.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-log.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -12,2 +12,8 @@ int files, lines; | |||
12 | 12 | ||
13 | void count_lines(char *line, int size) | ||
14 | { | ||
15 | if (size>0 && (line[0] == '+' || line[0] == '-')) | ||
16 | lines++; | ||
17 | } | ||
18 | |||
13 | void inspect_files(struct diff_filepair *pair) | 19 | void inspect_files(struct diff_filepair *pair) |
@@ -15,2 +21,3 @@ void inspect_files(struct diff_filepair *pair) | |||
15 | files++; | 21 | files++; |
22 | cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); | ||
16 | } | 23 | } |
@@ -34,3 +41,2 @@ void print_commit(struct commit *commit) | |||
34 | html_link_close(); | 41 | html_link_close(); |
35 | html("</td><td class='right'>"); | ||
36 | files = 0; | 42 | files = 0; |
@@ -38,3 +44,6 @@ void print_commit(struct commit *commit) | |||
38 | cgit_diff_commit(commit, inspect_files); | 44 | cgit_diff_commit(commit, inspect_files); |
45 | html("</td><td class='right'>"); | ||
39 | htmlf("%d", files); | 46 | htmlf("%d", files); |
47 | html("</td><td class='right'>"); | ||
48 | htmlf("%d", lines); | ||
40 | html("</td><td>"); | 49 | html("</td><td>"); |
@@ -72,2 +81,3 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep) | |||
72 | "<th class='left'>Files</th>" | 81 | "<th class='left'>Files</th>" |
82 | "<th class='left'>Lines</th>" | ||
73 | "<th class='left'>Author</th></tr>\n"); | 83 | "<th class='left'>Author</th></tr>\n"); |