History

Show number of changed lines in log view

Use the new file-diff interface to calculate number of changed lines per commit.

Lars Hjemli committed 19 years ago

Commit 80e577c1 parent 38a0f9c1 file · +11 −1Browse files

Unified · Split

ui-log.c+11−1
@@ -10,9 +10,16 @@ · 9 unmodified lines
1010
1111 int files, lines;
1212
13+void count_lines(char *line, int size)
14+{
15+ if (size>0 && (line[0] == '+' || line[0] == '-'))
16+ lines++;
17+}
18+
1319 void inspect_files(struct diff_filepair *pair)
1420 {
1521 files++;
22+ cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines);
1623 }
1724
1825 void print_commit(struct commit *commit)
@@ -32,11 +39,13 @@ void print_commit(struct commit *commit) · 13 unmodified lines
3239 html_link_open(url, NULL, NULL);
3340 html_ntxt(cgit_max_msg_len, info->subject);
3441 html_link_close();
35− html("</td><td class='right'>");
3642 files = 0;
3743 lines = 0;
3844 cgit_diff_commit(commit, inspect_files);
45+ html("</td><td class='right'>");
3946 htmlf("%d", files);
47+ html("</td><td class='right'>");
48+ htmlf("%d", lines);
4049 html("</td><td>");
4150 html_txt(info->author);
4251 html("</td></tr>\n");
@@ -70,6 +79,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep) · 27 unmodified lines
7079 html("<tr class='nohover'><th class='left'>Date</th>"
7180 "<th class='left'>Message</th>"
7281 "<th class='left'>Files</th>"
82+ "<th class='left'>Lines</th>"
7383 "<th class='left'>Author</th></tr>\n");
7484
7585 if (ofs<0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t