summaryrefslogtreecommitdiffabout
authorJeff Smith <whydoubt@yahoo.com>2010-07-29 14:32:31 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2010-08-04 01:10:07 (UTC)
commit39c2e224d3c55dfa1a7668399897be295be07dc7 (patch) (unidiff)
tree361f85c61886eecf153243fae1ada8a7618d8728
parent059b39344fdcde324dff1099fc4b70c7aab12a96 (diff)
downloadcgit-39c2e224d3c55dfa1a7668399897be295be07dc7.zip
cgit-39c2e224d3c55dfa1a7668399897be295be07dc7.tar.gz
cgit-39c2e224d3c55dfa1a7668399897be295be07dc7.tar.bz2
ui-log: Display git notes when present
Signed-off-by: Jeff Smith <whydoubt@yahoo.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.css11
-rw-r--r--ui-log.c12
2 files changed, 23 insertions, 0 deletions
diff --git a/cgit.css b/cgit.css
index 3675697..0c88b65 100644
--- a/cgit.css
+++ b/cgit.css
@@ -1,550 +1,561 @@
1body, table, form { 1body, table, form {
2 padding: 0em; 2 padding: 0em;
3 margin: 0em; 3 margin: 0em;
4} 4}
5 5
6body { 6body {
7 font-family: sans-serif; 7 font-family: sans-serif;
8 font-size: 10pt; 8 font-size: 10pt;
9 color: #333; 9 color: #333;
10 background: white; 10 background: white;
11 padding: 4px; 11 padding: 4px;
12} 12}
13 13
14a { 14a {
15 color: blue; 15 color: blue;
16 text-decoration: none; 16 text-decoration: none;
17} 17}
18 18
19a:hover { 19a:hover {
20 text-decoration: underline; 20 text-decoration: underline;
21} 21}
22 22
23table { 23table {
24 border-collapse: collapse; 24 border-collapse: collapse;
25} 25}
26 26
27table#header { 27table#header {
28 width: 100%; 28 width: 100%;
29 margin-bottom: 1em; 29 margin-bottom: 1em;
30} 30}
31 31
32table#header td.logo { 32table#header td.logo {
33 width: 96px; 33 width: 96px;
34} 34}
35 35
36table#header td.main { 36table#header td.main {
37 font-size: 250%; 37 font-size: 250%;
38 padding-left: 10px; 38 padding-left: 10px;
39 white-space: nowrap; 39 white-space: nowrap;
40} 40}
41 41
42table#header td.main a { 42table#header td.main a {
43 color: #000; 43 color: #000;
44} 44}
45 45
46table#header td.form { 46table#header td.form {
47 text-align: right; 47 text-align: right;
48 vertical-align: bottom; 48 vertical-align: bottom;
49 padding-right: 1em; 49 padding-right: 1em;
50 padding-bottom: 2px; 50 padding-bottom: 2px;
51 white-space: nowrap; 51 white-space: nowrap;
52} 52}
53 53
54table#header td.form form, 54table#header td.form form,
55table#header td.form input, 55table#header td.form input,
56table#header td.form select { 56table#header td.form select {
57 font-size: 90%; 57 font-size: 90%;
58} 58}
59 59
60table#header td.sub { 60table#header td.sub {
61 color: #777; 61 color: #777;
62 border-top: solid 1px #ccc; 62 border-top: solid 1px #ccc;
63 padding-left: 10px; 63 padding-left: 10px;
64} 64}
65 65
66table.tabs { 66table.tabs {
67 border-bottom: solid 3px #ccc; 67 border-bottom: solid 3px #ccc;
68 border-collapse: collapse; 68 border-collapse: collapse;
69 margin-top: 2em; 69 margin-top: 2em;
70 margin-bottom: 0px; 70 margin-bottom: 0px;
71 width: 100%; 71 width: 100%;
72} 72}
73 73
74table.tabs td { 74table.tabs td {
75 padding: 0px 1em; 75 padding: 0px 1em;
76 vertical-align: bottom; 76 vertical-align: bottom;
77} 77}
78 78
79table.tabs td a { 79table.tabs td a {
80 padding: 2px 0.75em; 80 padding: 2px 0.75em;
81 color: #777; 81 color: #777;
82 font-size: 110%; 82 font-size: 110%;
83} 83}
84 84
85table.tabs td a.active { 85table.tabs td a.active {
86 color: #000; 86 color: #000;
87 background-color: #ccc; 87 background-color: #ccc;
88} 88}
89 89
90table.tabs td.form { 90table.tabs td.form {
91 text-align: right; 91 text-align: right;
92} 92}
93 93
94table.tabs td.form form { 94table.tabs td.form form {
95 padding-bottom: 2px; 95 padding-bottom: 2px;
96 font-size: 90%; 96 font-size: 90%;
97 white-space: nowrap; 97 white-space: nowrap;
98} 98}
99 99
100table.tabs td.form input, 100table.tabs td.form input,
101table.tabs td.form select { 101table.tabs td.form select {
102 font-size: 90%; 102 font-size: 90%;
103} 103}
104 104
105div.path { 105div.path {
106 margin: 0px; 106 margin: 0px;
107 padding: 5px 2em 2px 2em; 107 padding: 5px 2em 2px 2em;
108 color: #000; 108 color: #000;
109 background-color: #eee; 109 background-color: #eee;
110} 110}
111 111
112div.content { 112div.content {
113 margin: 0px; 113 margin: 0px;
114 padding: 2em; 114 padding: 2em;
115 border-bottom: solid 3px #ccc; 115 border-bottom: solid 3px #ccc;
116} 116}
117 117
118 118
119table.list { 119table.list {
120 width: 100%; 120 width: 100%;
121 border: none; 121 border: none;
122 border-collapse: collapse; 122 border-collapse: collapse;
123} 123}
124 124
125table.list tr { 125table.list tr {
126 background: white; 126 background: white;
127} 127}
128 128
129table.list tr.logheader { 129table.list tr.logheader {
130 background: #eee; 130 background: #eee;
131} 131}
132 132
133table.list tr:hover { 133table.list tr:hover {
134 background: #eee; 134 background: #eee;
135} 135}
136 136
137table.list tr.nohover:hover { 137table.list tr.nohover:hover {
138 background: white; 138 background: white;
139} 139}
140 140
141table.list th { 141table.list th {
142 font-weight: bold; 142 font-weight: bold;
143 /* color: #888; 143 /* color: #888;
144 border-top: dashed 1px #888; 144 border-top: dashed 1px #888;
145 border-bottom: dashed 1px #888; 145 border-bottom: dashed 1px #888;
146 */ 146 */
147 padding: 0.1em 0.5em 0.05em 0.5em; 147 padding: 0.1em 0.5em 0.05em 0.5em;
148 vertical-align: baseline; 148 vertical-align: baseline;
149} 149}
150 150
151table.list td { 151table.list td {
152 border: none; 152 border: none;
153 padding: 0.1em 0.5em 0.1em 0.5em; 153 padding: 0.1em 0.5em 0.1em 0.5em;
154} 154}
155 155
156table.list td.logsubject { 156table.list td.logsubject {
157 font-family: monospace; 157 font-family: monospace;
158 font-weight: bold; 158 font-weight: bold;
159} 159}
160 160
161table.list td.logmsg { 161table.list td.logmsg {
162 font-family: monospace; 162 font-family: monospace;
163 white-space: pre; 163 white-space: pre;
164 padding: 1em 0.5em 2em 0.5em; 164 padding: 1em 0.5em 2em 0.5em;
165} 165}
166 166
167table.list td.lognotes-label {
168 text-align:right;
169 vertical-align:top;
170}
171
172table.list td.lognotes {
173 font-family: monospace;
174 white-space: pre;
175 padding: 0em 0.5em 2em 0.5em;
176}
177
167table.list td a { 178table.list td a {
168 color: black; 179 color: black;
169} 180}
170 181
171table.list td a.ls-dir { 182table.list td a.ls-dir {
172 font-weight: bold; 183 font-weight: bold;
173 color: #00f; 184 color: #00f;
174} 185}
175 186
176table.list td a:hover { 187table.list td a:hover {
177 color: #00f; 188 color: #00f;
178} 189}
179 190
180img { 191img {
181 border: none; 192 border: none;
182} 193}
183 194
184input#switch-btn { 195input#switch-btn {
185 margin: 2px 0px 0px 0px; 196 margin: 2px 0px 0px 0px;
186} 197}
187 198
188td#sidebar input.txt { 199td#sidebar input.txt {
189 width: 100%; 200 width: 100%;
190 margin: 2px 0px 0px 0px; 201 margin: 2px 0px 0px 0px;
191} 202}
192 203
193table#grid { 204table#grid {
194 margin: 0px; 205 margin: 0px;
195} 206}
196 207
197td#content { 208td#content {
198 vertical-align: top; 209 vertical-align: top;
199 padding: 1em 2em 1em 1em; 210 padding: 1em 2em 1em 1em;
200 border: none; 211 border: none;
201} 212}
202 213
203div#summary { 214div#summary {
204 vertical-align: top; 215 vertical-align: top;
205 margin-bottom: 1em; 216 margin-bottom: 1em;
206} 217}
207 218
208table#downloads { 219table#downloads {
209 float: right; 220 float: right;
210 border-collapse: collapse; 221 border-collapse: collapse;
211 border: solid 1px #777; 222 border: solid 1px #777;
212 margin-left: 0.5em; 223 margin-left: 0.5em;
213 margin-bottom: 0.5em; 224 margin-bottom: 0.5em;
214} 225}
215 226
216table#downloads th { 227table#downloads th {
217 background-color: #ccc; 228 background-color: #ccc;
218} 229}
219 230
220div#blob { 231div#blob {
221 border: solid 1px black; 232 border: solid 1px black;
222} 233}
223 234
224div.error { 235div.error {
225 color: red; 236 color: red;
226 font-weight: bold; 237 font-weight: bold;
227 margin: 1em 2em; 238 margin: 1em 2em;
228} 239}
229 240
230a.ls-blob, a.ls-dir, a.ls-mod { 241a.ls-blob, a.ls-dir, a.ls-mod {
231 font-family: monospace; 242 font-family: monospace;
232} 243}
233 244
234td.ls-size { 245td.ls-size {
235 text-align: right; 246 text-align: right;
236 font-family: monospace; 247 font-family: monospace;
237 width: 10em; 248 width: 10em;
238} 249}
239 250
240td.ls-mode { 251td.ls-mode {
241 font-family: monospace; 252 font-family: monospace;
242 width: 10em; 253 width: 10em;
243} 254}
244 255
245table.blob { 256table.blob {
246 margin-top: 0.5em; 257 margin-top: 0.5em;
247 border-top: solid 1px black; 258 border-top: solid 1px black;
248} 259}
249 260
250table.blob td.lines { 261table.blob td.lines {
251 margin: 0; padding: 0 0 0 0.5em; 262 margin: 0; padding: 0 0 0 0.5em;
252 vertical-align: top; 263 vertical-align: top;
253 color: black; 264 color: black;
254} 265}
255 266
256table.blob td.linenumbers { 267table.blob td.linenumbers {
257 margin: 0; padding: 0 0.5em 0 0.5em; 268 margin: 0; padding: 0 0.5em 0 0.5em;
258 vertical-align: top; 269 vertical-align: top;
259 text-align: right; 270 text-align: right;
260 border-right: 1px solid gray; 271 border-right: 1px solid gray;
261} 272}
262 273
263table.blob pre { 274table.blob pre {
264 padding: 0; margin: 0; 275 padding: 0; margin: 0;
265} 276}
266 277
267table.blob a.no { 278table.blob a.no {
268 color: gray; 279 color: gray;
269 text-align: right; 280 text-align: right;
270 text-decoration: none; 281 text-decoration: none;
271} 282}
272 283
273table.blob a.no a:hover { 284table.blob a.no a:hover {
274 color: black; 285 color: black;
275} 286}
276 287
277table.bin-blob { 288table.bin-blob {
278 margin-top: 0.5em; 289 margin-top: 0.5em;
279 border: solid 1px black; 290 border: solid 1px black;
280} 291}
281 292
282table.bin-blob th { 293table.bin-blob th {
283 font-family: monospace; 294 font-family: monospace;
284 white-space: pre; 295 white-space: pre;
285 border: solid 1px #777; 296 border: solid 1px #777;
286 padding: 0.5em 1em; 297 padding: 0.5em 1em;
287} 298}
288 299
289table.bin-blob td { 300table.bin-blob td {
290 font-family: monospace; 301 font-family: monospace;
291 white-space: pre; 302 white-space: pre;
292 border-left: solid 1px #777; 303 border-left: solid 1px #777;
293 padding: 0em 1em; 304 padding: 0em 1em;
294} 305}
295 306
296table.nowrap td { 307table.nowrap td {
297 white-space: nowrap; 308 white-space: nowrap;
298} 309}
299 310
300table.commit-info { 311table.commit-info {
301 border-collapse: collapse; 312 border-collapse: collapse;
302 margin-top: 1.5em; 313 margin-top: 1.5em;
303} 314}
304 315
305table.commit-info th { 316table.commit-info th {
306 text-align: left; 317 text-align: left;
307 font-weight: normal; 318 font-weight: normal;
308 padding: 0.1em 1em 0.1em 0.1em; 319 padding: 0.1em 1em 0.1em 0.1em;
309 vertical-align: top; 320 vertical-align: top;
310} 321}
311 322
312table.commit-info td { 323table.commit-info td {
313 font-weight: normal; 324 font-weight: normal;
314 padding: 0.1em 1em 0.1em 0.1em; 325 padding: 0.1em 1em 0.1em 0.1em;
315} 326}
316 327
317div.commit-subject { 328div.commit-subject {
318 font-weight: bold; 329 font-weight: bold;
319 font-size: 125%; 330 font-size: 125%;
320 margin: 1.5em 0em 0.5em 0em; 331 margin: 1.5em 0em 0.5em 0em;
321 padding: 0em; 332 padding: 0em;
322} 333}
323 334
324div.commit-msg { 335div.commit-msg {
325 white-space: pre; 336 white-space: pre;
326 font-family: monospace; 337 font-family: monospace;
327} 338}
328 339
329div.notes-header { 340div.notes-header {
330 font-weight: bold; 341 font-weight: bold;
331 padding-top: 1.5em; 342 padding-top: 1.5em;
332} 343}
333 344
334div.notes { 345div.notes {
335 white-space: pre; 346 white-space: pre;
336 font-family: monospace; 347 font-family: monospace;
337 border: solid 1px #ee9; 348 border: solid 1px #ee9;
338 background-color: #ffd; 349 background-color: #ffd;
339 padding: 0.3em 2em 0.3em 1em; 350 padding: 0.3em 2em 0.3em 1em;
340 float: left; 351 float: left;
341} 352}
342 353
343div.notes-footer { 354div.notes-footer {
344 clear: left; 355 clear: left;
345} 356}
346 357
347div.diffstat-header { 358div.diffstat-header {
348 font-weight: bold; 359 font-weight: bold;
349 padding-top: 1.5em; 360 padding-top: 1.5em;
350} 361}
351 362
352table.diffstat { 363table.diffstat {
353 border-collapse: collapse; 364 border-collapse: collapse;
354 border: solid 1px #aaa; 365 border: solid 1px #aaa;
355 background-color: #eee; 366 background-color: #eee;
356} 367}
357 368
358table.diffstat th { 369table.diffstat th {
359 font-weight: normal; 370 font-weight: normal;
360 text-align: left; 371 text-align: left;
361 text-decoration: underline; 372 text-decoration: underline;
362 padding: 0.1em 1em 0.1em 0.1em; 373 padding: 0.1em 1em 0.1em 0.1em;
363 font-size: 100%; 374 font-size: 100%;
364} 375}
365 376
366table.diffstat td { 377table.diffstat td {
367 padding: 0.2em 0.2em 0.1em 0.1em; 378 padding: 0.2em 0.2em 0.1em 0.1em;
368 font-size: 100%; 379 font-size: 100%;
369 border: none; 380 border: none;
370} 381}
371 382
372table.diffstat td.mode { 383table.diffstat td.mode {
373 white-space: nowrap; 384 white-space: nowrap;
374} 385}
375 386
376table.diffstat td span.modechange { 387table.diffstat td span.modechange {
377 padding-left: 1em; 388 padding-left: 1em;
378 color: red; 389 color: red;
379} 390}
380 391
381table.diffstat td.add a { 392table.diffstat td.add a {
382 color: green; 393 color: green;
383} 394}
384 395
385table.diffstat td.del a { 396table.diffstat td.del a {
386 color: red; 397 color: red;
387} 398}
388 399
389table.diffstat td.upd a { 400table.diffstat td.upd a {
390 color: blue; 401 color: blue;
391} 402}
392 403
393table.diffstat td.graph { 404table.diffstat td.graph {
394 width: 500px; 405 width: 500px;
395 vertical-align: middle; 406 vertical-align: middle;
396} 407}
397 408
398table.diffstat td.graph table { 409table.diffstat td.graph table {
399 border: none; 410 border: none;
400} 411}
401 412
402table.diffstat td.graph td { 413table.diffstat td.graph td {
403 padding: 0px; 414 padding: 0px;
404 border: 0px; 415 border: 0px;
405 height: 7pt; 416 height: 7pt;
406} 417}
407 418
408table.diffstat td.graph td.add { 419table.diffstat td.graph td.add {
409 background-color: #5c5; 420 background-color: #5c5;
410} 421}
411 422
412table.diffstat td.graph td.rem { 423table.diffstat td.graph td.rem {
413 background-color: #c55; 424 background-color: #c55;
414} 425}
415 426
416div.diffstat-summary { 427div.diffstat-summary {
417 color: #888; 428 color: #888;
418 padding-top: 0.5em; 429 padding-top: 0.5em;
419} 430}
420 431
421table.diff { 432table.diff {
422 width: 100%; 433 width: 100%;
423} 434}
424 435
425table.diff td { 436table.diff td {
426 font-family: monospace; 437 font-family: monospace;
427 white-space: pre; 438 white-space: pre;
428} 439}
429 440
430table.diff td div.head { 441table.diff td div.head {
431 font-weight: bold; 442 font-weight: bold;
432 margin-top: 1em; 443 margin-top: 1em;
433 color: black; 444 color: black;
434} 445}
435 446
436table.diff td div.hunk { 447table.diff td div.hunk {
437 color: #009; 448 color: #009;
438} 449}
439 450
440table.diff td div.add { 451table.diff td div.add {
441 color: green; 452 color: green;
442} 453}
443 454
444table.diff td div.del { 455table.diff td div.del {
445 color: red; 456 color: red;
446} 457}
447 458
448.sha1 { 459.sha1 {
449 font-family: monospace; 460 font-family: monospace;
450 font-size: 90%; 461 font-size: 90%;
451} 462}
452 463
453.left { 464.left {
454 text-align: left; 465 text-align: left;
455} 466}
456 467
457.right { 468.right {
458 text-align: right; 469 text-align: right;
459} 470}
460 471
461table.list td.reposection { 472table.list td.reposection {
462 font-style: italic; 473 font-style: italic;
463 color: #888; 474 color: #888;
464} 475}
465 476
466a.button { 477a.button {
467 font-size: 80%; 478 font-size: 80%;
468 padding: 0em 0.5em; 479 padding: 0em 0.5em;
469} 480}
470 481
471a.primary { 482a.primary {
472 font-size: 100%; 483 font-size: 100%;
473} 484}
474 485
475a.secondary { 486a.secondary {
476 font-size: 90%; 487 font-size: 90%;
477} 488}
478 489
479td.toplevel-repo { 490td.toplevel-repo {
480 491
481} 492}
482 493
483table.list td.sublevel-repo { 494table.list td.sublevel-repo {
484 padding-left: 1.5em; 495 padding-left: 1.5em;
485} 496}
486 497
487div.pager { 498div.pager {
488 text-align: center; 499 text-align: center;
489 margin: 1em 0em 0em 0em; 500 margin: 1em 0em 0em 0em;
490} 501}
491 502
492div.pager a { 503div.pager a {
493 color: #777; 504 color: #777;
494 margin: 0em 0.5em; 505 margin: 0em 0.5em;
495} 506}
496 507
497span.age-mins { 508span.age-mins {
498 font-weight: bold; 509 font-weight: bold;
499 color: #080; 510 color: #080;
500} 511}
501 512
502span.age-hours { 513span.age-hours {
503 color: #080; 514 color: #080;
504} 515}
505 516
506span.age-days { 517span.age-days {
507 color: #040; 518 color: #040;
508} 519}
509 520
510span.age-weeks { 521span.age-weeks {
511 color: #444; 522 color: #444;
512} 523}
513 524
514span.age-months { 525span.age-months {
515 color: #888; 526 color: #888;
516} 527}
517 528
518span.age-years { 529span.age-years {
519 color: #bbb; 530 color: #bbb;
520} 531}
521div.footer { 532div.footer {
522 margin-top: 0.5em; 533 margin-top: 0.5em;
523 text-align: center; 534 text-align: center;
524 font-size: 80%; 535 font-size: 80%;
525 color: #ccc; 536 color: #ccc;
526} 537}
527a.branch-deco { 538a.branch-deco {
528 margin: 0px 0.5em; 539 margin: 0px 0.5em;
529 padding: 0px 0.25em; 540 padding: 0px 0.25em;
530 background-color: #88ff88; 541 background-color: #88ff88;
531 border: solid 1px #007700; 542 border: solid 1px #007700;
532} 543}
533a.tag-deco { 544a.tag-deco {
534 margin: 0px 0.5em; 545 margin: 0px 0.5em;
535 padding: 0px 0.25em; 546 padding: 0px 0.25em;
536 background-color: #ffff88; 547 background-color: #ffff88;
537 border: solid 1px #777700; 548 border: solid 1px #777700;
538} 549}
539a.remote-deco { 550a.remote-deco {
540 margin: 0px 0.5em; 551 margin: 0px 0.5em;
541 padding: 0px 0.25em; 552 padding: 0px 0.25em;
542 background-color: #ccccff; 553 background-color: #ccccff;
543 border: solid 1px #000077; 554 border: solid 1px #000077;
544} 555}
545a.deco { 556a.deco {
546 margin: 0px 0.5em; 557 margin: 0px 0.5em;
547 padding: 0px 0.25em; 558 padding: 0px 0.25em;
548 background-color: #ff8888; 559 background-color: #ff8888;
549 border: solid 1px #770000; 560 border: solid 1px #770000;
550} 561}
diff --git a/ui-log.c b/ui-log.c
index ee93653..7f38d2a 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -1,241 +1,253 @@
1/* ui-log.c: functions for log output 1/* ui-log.c: functions for log output
2 * 2 *
3 * Copyright (C) 2006 Lars Hjemli 3 * Copyright (C) 2006 Lars Hjemli
4 * 4 *
5 * Licensed under GNU General Public License v2 5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text) 6 * (see COPYING for full license text)
7 */ 7 */
8 8
9#include "cgit.h" 9#include "cgit.h"
10#include "html.h" 10#include "html.h"
11#include "ui-shared.h" 11#include "ui-shared.h"
12 12
13int files, add_lines, rem_lines; 13int files, add_lines, rem_lines;
14 14
15void count_lines(char *line, int size) 15void count_lines(char *line, int size)
16{ 16{
17 if (size <= 0) 17 if (size <= 0)
18 return; 18 return;
19 19
20 if (line[0] == '+') 20 if (line[0] == '+')
21 add_lines++; 21 add_lines++;
22 22
23 else if (line[0] == '-') 23 else if (line[0] == '-')
24 rem_lines++; 24 rem_lines++;
25} 25}
26 26
27void inspect_files(struct diff_filepair *pair) 27void inspect_files(struct diff_filepair *pair)
28{ 28{
29 unsigned long old_size = 0; 29 unsigned long old_size = 0;
30 unsigned long new_size = 0; 30 unsigned long new_size = 0;
31 int binary = 0; 31 int binary = 0;
32 32
33 files++; 33 files++;
34 if (ctx.repo->enable_log_linecount) 34 if (ctx.repo->enable_log_linecount)
35 cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, 35 cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size,
36 &new_size, &binary, 0, ctx.qry.ignorews, 36 &new_size, &binary, 0, ctx.qry.ignorews,
37 count_lines); 37 count_lines);
38} 38}
39 39
40void show_commit_decorations(struct commit *commit) 40void show_commit_decorations(struct commit *commit)
41{ 41{
42 struct name_decoration *deco; 42 struct name_decoration *deco;
43 static char buf[1024]; 43 static char buf[1024];
44 44
45 buf[sizeof(buf) - 1] = 0; 45 buf[sizeof(buf) - 1] = 0;
46 deco = lookup_decoration(&name_decoration, &commit->object); 46 deco = lookup_decoration(&name_decoration, &commit->object);
47 while (deco) { 47 while (deco) {
48 if (!prefixcmp(deco->name, "refs/heads/")) { 48 if (!prefixcmp(deco->name, "refs/heads/")) {
49 strncpy(buf, deco->name + 11, sizeof(buf) - 1); 49 strncpy(buf, deco->name + 11, sizeof(buf) - 1);
50 cgit_log_link(buf, NULL, "branch-deco", buf, NULL, 50 cgit_log_link(buf, NULL, "branch-deco", buf, NULL,
51 ctx.qry.vpath, 0, NULL, NULL, 51 ctx.qry.vpath, 0, NULL, NULL,
52 ctx.qry.showmsg); 52 ctx.qry.showmsg);
53 } 53 }
54 else if (!prefixcmp(deco->name, "tag: refs/tags/")) { 54 else if (!prefixcmp(deco->name, "tag: refs/tags/")) {
55 strncpy(buf, deco->name + 15, sizeof(buf) - 1); 55 strncpy(buf, deco->name + 15, sizeof(buf) - 1);
56 cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); 56 cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf);
57 } 57 }
58 else if (!prefixcmp(deco->name, "refs/tags/")) { 58 else if (!prefixcmp(deco->name, "refs/tags/")) {
59 strncpy(buf, deco->name + 10, sizeof(buf) - 1); 59 strncpy(buf, deco->name + 10, sizeof(buf) - 1);
60 cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); 60 cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf);
61 } 61 }
62 else if (!prefixcmp(deco->name, "refs/remotes/")) { 62 else if (!prefixcmp(deco->name, "refs/remotes/")) {
63 strncpy(buf, deco->name + 13, sizeof(buf) - 1); 63 strncpy(buf, deco->name + 13, sizeof(buf) - 1);
64 cgit_log_link(buf, NULL, "remote-deco", NULL, 64 cgit_log_link(buf, NULL, "remote-deco", NULL,
65 sha1_to_hex(commit->object.sha1), 65 sha1_to_hex(commit->object.sha1),
66 ctx.qry.vpath, 0, NULL, NULL, 66 ctx.qry.vpath, 0, NULL, NULL,
67 ctx.qry.showmsg); 67 ctx.qry.showmsg);
68 } 68 }
69 else { 69 else {
70 strncpy(buf, deco->name, sizeof(buf) - 1); 70 strncpy(buf, deco->name, sizeof(buf) - 1);
71 cgit_commit_link(buf, NULL, "deco", ctx.qry.head, 71 cgit_commit_link(buf, NULL, "deco", ctx.qry.head,
72 sha1_to_hex(commit->object.sha1), 72 sha1_to_hex(commit->object.sha1),
73 ctx.qry.vpath, 0); 73 ctx.qry.vpath, 0);
74 } 74 }
75 deco = deco->next; 75 deco = deco->next;
76 } 76 }
77} 77}
78 78
79void print_commit(struct commit *commit) 79void print_commit(struct commit *commit)
80{ 80{
81 struct commitinfo *info; 81 struct commitinfo *info;
82 char *tmp; 82 char *tmp;
83 int cols = 2; 83 int cols = 2;
84 84
85 info = cgit_parse_commit(commit); 85 info = cgit_parse_commit(commit);
86 htmlf("<tr%s><td>", 86 htmlf("<tr%s><td>",
87 ctx.qry.showmsg ? " class='logheader'" : ""); 87 ctx.qry.showmsg ? " class='logheader'" : "");
88 tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); 88 tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1));
89 tmp = cgit_fileurl(ctx.repo->url, "commit", ctx.qry.vpath, tmp); 89 tmp = cgit_fileurl(ctx.repo->url, "commit", ctx.qry.vpath, tmp);
90 html_link_open(tmp, NULL, NULL); 90 html_link_open(tmp, NULL, NULL);
91 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); 91 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
92 html_link_close(); 92 html_link_close();
93 htmlf("</td><td%s>", 93 htmlf("</td><td%s>",
94 ctx.qry.showmsg ? " class='logsubject'" : ""); 94 ctx.qry.showmsg ? " class='logsubject'" : "");
95 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, 95 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
96 sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0); 96 sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0);
97 show_commit_decorations(commit); 97 show_commit_decorations(commit);
98 html("</td><td>"); 98 html("</td><td>");
99 html_txt(info->author); 99 html_txt(info->author);
100 if (ctx.repo->enable_log_filecount) { 100 if (ctx.repo->enable_log_filecount) {
101 files = 0; 101 files = 0;
102 add_lines = 0; 102 add_lines = 0;
103 rem_lines = 0; 103 rem_lines = 0;
104 cgit_diff_commit(commit, inspect_files); 104 cgit_diff_commit(commit, inspect_files);
105 html("</td><td>"); 105 html("</td><td>");
106 htmlf("%d", files); 106 htmlf("%d", files);
107 if (ctx.repo->enable_log_linecount) { 107 if (ctx.repo->enable_log_linecount) {
108 html("</td><td>"); 108 html("</td><td>");
109 htmlf("-%d/+%d", rem_lines, add_lines); 109 htmlf("-%d/+%d", rem_lines, add_lines);
110 } 110 }
111 } 111 }
112 html("</td></tr>\n"); 112 html("</td></tr>\n");
113 if (ctx.qry.showmsg) { 113 if (ctx.qry.showmsg) {
114 struct strbuf notes = STRBUF_INIT;
115 get_commit_notes(commit, &notes, PAGE_ENCODING, 0);
116
114 if (ctx.repo->enable_log_filecount) { 117 if (ctx.repo->enable_log_filecount) {
115 cols++; 118 cols++;
116 if (ctx.repo->enable_log_linecount) 119 if (ctx.repo->enable_log_linecount)
117 cols++; 120 cols++;
118 } 121 }
119 htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", 122 htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>",
120 cols); 123 cols);
121 html_txt(info->msg); 124 html_txt(info->msg);
122 html("</td></tr>\n"); 125 html("</td></tr>\n");
126 if (notes.len != 0) {
127 html("<tr class='nohover'>");
128 html("<td class='lognotes-label'>Notes:</td>");
129 htmlf("<td colspan='%d' class='lognotes'>",
130 cols);
131 html_txt(notes.buf);
132 html("</td></tr>\n");
133 }
134 strbuf_release(&notes);
123 } 135 }
124 cgit_free_commitinfo(info); 136 cgit_free_commitinfo(info);
125} 137}
126 138
127static const char *disambiguate_ref(const char *ref) 139static const char *disambiguate_ref(const char *ref)
128{ 140{
129 unsigned char sha1[20]; 141 unsigned char sha1[20];
130 const char *longref; 142 const char *longref;
131 143
132 longref = fmt("refs/heads/%s", ref); 144 longref = fmt("refs/heads/%s", ref);
133 if (get_sha1(longref, sha1) == 0) 145 if (get_sha1(longref, sha1) == 0)
134 return longref; 146 return longref;
135 147
136 return ref; 148 return ref;
137} 149}
138 150
139void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, 151void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
140 char *path, int pager) 152 char *path, int pager)
141{ 153{
142 struct rev_info rev; 154 struct rev_info rev;
143 struct commit *commit; 155 struct commit *commit;
144 const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; 156 const char *argv[] = {NULL, NULL, NULL, NULL, NULL};
145 int argc = 2; 157 int argc = 2;
146 int i, columns = 3; 158 int i, columns = 3;
147 159
148 if (!tip) 160 if (!tip)
149 tip = ctx.qry.head; 161 tip = ctx.qry.head;
150 162
151 argv[1] = disambiguate_ref(tip); 163 argv[1] = disambiguate_ref(tip);
152 164
153 if (grep && pattern) { 165 if (grep && pattern) {
154 if (!strcmp(grep, "grep") || !strcmp(grep, "author") || 166 if (!strcmp(grep, "grep") || !strcmp(grep, "author") ||
155 !strcmp(grep, "committer")) 167 !strcmp(grep, "committer"))
156 argv[argc++] = fmt("--%s=%s", grep, pattern); 168 argv[argc++] = fmt("--%s=%s", grep, pattern);
157 if (!strcmp(grep, "range")) 169 if (!strcmp(grep, "range"))
158 argv[1] = pattern; 170 argv[1] = pattern;
159 } 171 }
160 172
161 if (path) { 173 if (path) {
162 argv[argc++] = "--"; 174 argv[argc++] = "--";
163 argv[argc++] = path; 175 argv[argc++] = path;
164 } 176 }
165 init_revisions(&rev, NULL); 177 init_revisions(&rev, NULL);
166 rev.abbrev = DEFAULT_ABBREV; 178 rev.abbrev = DEFAULT_ABBREV;
167 rev.commit_format = CMIT_FMT_DEFAULT; 179 rev.commit_format = CMIT_FMT_DEFAULT;
168 rev.verbose_header = 1; 180 rev.verbose_header = 1;
169 rev.show_root_diff = 0; 181 rev.show_root_diff = 0;
170 setup_revisions(argc, argv, &rev, NULL); 182 setup_revisions(argc, argv, &rev, NULL);
171 load_ref_decorations(DECORATE_FULL_REFS); 183 load_ref_decorations(DECORATE_FULL_REFS);
172 rev.show_decorations = 1; 184 rev.show_decorations = 1;
173 rev.grep_filter.regflags |= REG_ICASE; 185 rev.grep_filter.regflags |= REG_ICASE;
174 compile_grep_patterns(&rev.grep_filter); 186 compile_grep_patterns(&rev.grep_filter);
175 prepare_revision_walk(&rev); 187 prepare_revision_walk(&rev);
176 188
177 if (pager) 189 if (pager)
178 html("<table class='list nowrap'>"); 190 html("<table class='list nowrap'>");
179 191
180 html("<tr class='nohover'><th class='left'>Age</th>" 192 html("<tr class='nohover'><th class='left'>Age</th>"
181 "<th class='left'>Commit message"); 193 "<th class='left'>Commit message");
182 if (pager) { 194 if (pager) {
183 html(" ("); 195 html(" (");
184 cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL, 196 cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL,
185 NULL, ctx.qry.head, ctx.qry.sha1, 197 NULL, ctx.qry.head, ctx.qry.sha1,
186 ctx.qry.vpath, ctx.qry.ofs, ctx.qry.grep, 198 ctx.qry.vpath, ctx.qry.ofs, ctx.qry.grep,
187 ctx.qry.search, ctx.qry.showmsg ? 0 : 1); 199 ctx.qry.search, ctx.qry.showmsg ? 0 : 1);
188 html(")"); 200 html(")");
189 } 201 }
190 html("</th><th class='left'>Author</th>"); 202 html("</th><th class='left'>Author</th>");
191 if (ctx.repo->enable_log_filecount) { 203 if (ctx.repo->enable_log_filecount) {
192 html("<th class='left'>Files</th>"); 204 html("<th class='left'>Files</th>");
193 columns++; 205 columns++;
194 if (ctx.repo->enable_log_linecount) { 206 if (ctx.repo->enable_log_linecount) {
195 html("<th class='left'>Lines</th>"); 207 html("<th class='left'>Lines</th>");
196 columns++; 208 columns++;
197 } 209 }
198 } 210 }
199 html("</tr>\n"); 211 html("</tr>\n");
200 212
201 if (ofs<0) 213 if (ofs<0)
202 ofs = 0; 214 ofs = 0;
203 215
204 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { 216 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) {
205 free(commit->buffer); 217 free(commit->buffer);
206 commit->buffer = NULL; 218 commit->buffer = NULL;
207 free_commit_list(commit->parents); 219 free_commit_list(commit->parents);
208 commit->parents = NULL; 220 commit->parents = NULL;
209 } 221 }
210 222
211 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { 223 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) {
212 print_commit(commit); 224 print_commit(commit);
213 free(commit->buffer); 225 free(commit->buffer);
214 commit->buffer = NULL; 226 commit->buffer = NULL;
215 free_commit_list(commit->parents); 227 free_commit_list(commit->parents);
216 commit->parents = NULL; 228 commit->parents = NULL;
217 } 229 }
218 if (pager) { 230 if (pager) {
219 htmlf("</table><div class='pager'>", 231 htmlf("</table><div class='pager'>",
220 columns); 232 columns);
221 if (ofs > 0) { 233 if (ofs > 0) {
222 cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, 234 cgit_log_link("[prev]", NULL, NULL, ctx.qry.head,
223 ctx.qry.sha1, ctx.qry.vpath, 235 ctx.qry.sha1, ctx.qry.vpath,
224 ofs - cnt, ctx.qry.grep, 236 ofs - cnt, ctx.qry.grep,
225 ctx.qry.search, ctx.qry.showmsg); 237 ctx.qry.search, ctx.qry.showmsg);
226 html("&nbsp;"); 238 html("&nbsp;");
227 } 239 }
228 if ((commit = get_revision(&rev)) != NULL) { 240 if ((commit = get_revision(&rev)) != NULL) {
229 cgit_log_link("[next]", NULL, NULL, ctx.qry.head, 241 cgit_log_link("[next]", NULL, NULL, ctx.qry.head,
230 ctx.qry.sha1, ctx.qry.vpath, 242 ctx.qry.sha1, ctx.qry.vpath,
231 ofs + cnt, ctx.qry.grep, 243 ofs + cnt, ctx.qry.grep,
232 ctx.qry.search, ctx.qry.showmsg); 244 ctx.qry.search, ctx.qry.showmsg);
233 } 245 }
234 html("</div>"); 246 html("</div>");
235 } else if ((commit = get_revision(&rev)) != NULL) { 247 } else if ((commit = get_revision(&rev)) != NULL) {
236 html("<tr class='nohover'><td colspan='3'>"); 248 html("<tr class='nohover'><td colspan='3'>");
237 cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, 249 cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL,
238 ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg); 250 ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg);
239 html("</td></tr>\n"); 251 html("</td></tr>\n");
240 } 252 }
241} 253}