about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--cgit.c2
-rw-r--r--cgit.h8
m---------git0
-rw-r--r--shared.c28
-rw-r--r--ui-diff.c74
-rw-r--r--ui-diff.h4
-rw-r--r--ui-log.c2
-rw-r--r--ui-ssdiff.c4
9 files changed, 62 insertions, 62 deletions
diff --git a/Makefile b/Makefile index 9d067d4..821cfb3 100644 --- a/Makefile +++ b/Makefile
@@ -14,7 +14,7 @@ htmldir = $(docdir)
14pdfdir = $(docdir) 14pdfdir = $(docdir)
15mandir = $(prefix)/share/man 15mandir = $(prefix)/share/man
16SHA1_HEADER = <openssl/sha.h> 16SHA1_HEADER = <openssl/sha.h>
17GIT_VER = 2.9.1 17GIT_VER = 2.10.0
18GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz 18GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz
19INSTALL = install 19INSTALL = install
20COPYTREE = cp -r 20COPYTREE = cp -r
diff --git a/cgit.c b/cgit.c index 9427c4a..2f29aa6 100644 --- a/cgit.c +++ b/cgit.c
@@ -1026,7 +1026,7 @@ static int calc_ttl(void)
1026 return ctx.cfg.cache_repo_ttl; 1026 return ctx.cfg.cache_repo_ttl;
1027} 1027}
1028 1028
1029int main(int argc, const char **argv) 1029int cmd_main(int argc, const char **argv)
1030{ 1030{
1031 const char *path; 1031 const char *path;
1032 int err, ttl; 1032 int err, ttl;
diff --git a/cgit.h b/cgit.h index 325432b..f34395c 100644 --- a/cgit.h +++ b/cgit.h
@@ -348,14 +348,14 @@ extern void *cgit_free_commitinfo(struct commitinfo *info);
348void cgit_diff_tree_cb(struct diff_queue_struct *q, 348void cgit_diff_tree_cb(struct diff_queue_struct *q,
349 struct diff_options *options, void *data); 349 struct diff_options *options, void *data);
350 350
351extern int cgit_diff_files(const unsigned char *old_sha1, 351extern int cgit_diff_files(const struct object_id *old_oid,
352 const unsigned char *new_sha1, 352 const struct object_id *new_oid,
353 unsigned long *old_size, unsigned long *new_size, 353 unsigned long *old_size, unsigned long *new_size,
354 int *binary, int context, int ignorews, 354 int *binary, int context, int ignorews,
355 linediff_fn fn); 355 linediff_fn fn);
356 356
357extern void cgit_diff_tree(const unsigned char *old_sha1, 357extern void cgit_diff_tree(const struct object_id *old_oid,
358 const unsigned char *new_sha1, 358 const struct object_id *new_oid,
359 filepair_fn fn, const char *prefix, int ignorews); 359 filepair_fn fn, const char *prefix, int ignorews);
360 360
361extern void cgit_diff_commit(struct commit *commit, filepair_fn fn, 361extern void cgit_diff_commit(struct commit *commit, filepair_fn fn,
diff --git a/git b/git
Subproject 5c9159de87e41cf14ec5f2132afb5a06f35c26b Subproject 6ebdac1bab966b720d776aa43ca188fe378b1f4
diff --git a/shared.c b/shared.c index a63633b..a48eea6 100644 --- a/shared.c +++ b/shared.c
@@ -263,15 +263,15 @@ void cgit_diff_tree_cb(struct diff_queue_struct *q,
263 } 263 }
264} 264}
265 265
266static int load_mmfile(mmfile_t *file, const unsigned char *sha1) 266static int load_mmfile(mmfile_t *file, const struct object_id *oid)
267{ 267{
268 enum object_type type; 268 enum object_type type;
269 269
270 if (is_null_sha1(sha1)) { 270 if (is_null_oid(oid)) {
271 file->ptr = (char *)""; 271 file->ptr = (char *)"";
272 file->size = 0; 272 file->size = 0;
273 } else { 273 } else {
274 file->ptr = read_sha1_file(sha1, &type, 274 file->ptr = read_sha1_file(oid->hash, &type,
275 (unsigned long *)&file->size); 275 (unsigned long *)&file->size);
276 } 276 }
277 return 1; 277 return 1;
@@ -322,8 +322,8 @@ static int filediff_cb(void *priv, mmbuffer_t *mb, int nbuf)
322 return 0; 322 return 0;
323} 323}
324 324
325int cgit_diff_files(const unsigned char *old_sha1, 325int cgit_diff_files(const struct object_id *old_oid,
326 const unsigned char *new_sha1, unsigned long *old_size, 326 const struct object_id *new_oid, unsigned long *old_size,
327 unsigned long *new_size, int *binary, int context, 327 unsigned long *new_size, int *binary, int context,
328 int ignorews, linediff_fn fn) 328 int ignorews, linediff_fn fn)
329{ 329{
@@ -332,7 +332,7 @@ int cgit_diff_files(const unsigned char *old_sha1,
332 xdemitconf_t emit_params; 332 xdemitconf_t emit_params;
333 xdemitcb_t emit_cb; 333 xdemitcb_t emit_cb;
334 334
335 if (!load_mmfile(&file1, old_sha1) || !load_mmfile(&file2, new_sha1)) 335 if (!load_mmfile(&file1, old_oid) || !load_mmfile(&file2, new_oid))
336 return 1; 336 return 1;
337 337
338 *old_size = file1.size; 338 *old_size = file1.size;
@@ -366,8 +366,8 @@ int cgit_diff_files(const unsigned char *old_sha1,
366 return 0; 366 return 0;
367} 367}
368 368
369void cgit_diff_tree(const unsigned char *old_sha1, 369void cgit_diff_tree(const struct object_id *old_oid,
370 const unsigned char *new_sha1, 370 const struct object_id *new_oid,
371 filepair_fn fn, const char *prefix, int ignorews) 371 filepair_fn fn, const char *prefix, int ignorews)
372{ 372{
373 struct diff_options opt; 373 struct diff_options opt;
@@ -391,21 +391,21 @@ void cgit_diff_tree(const unsigned char *old_sha1,
391 } 391 }
392 diff_setup_done(&opt); 392 diff_setup_done(&opt);
393 393
394 if (old_sha1 && !is_null_sha1(old_sha1)) 394 if (old_oid && !is_null_oid(old_oid))
395 diff_tree_sha1(old_sha1, new_sha1, "", &opt); 395 diff_tree_sha1(old_oid->hash, new_oid->hash, "", &opt);
396 else 396 else
397 diff_root_tree_sha1(new_sha1, "", &opt); 397 diff_root_tree_sha1(new_oid->hash, "", &opt);
398 diffcore_std(&opt); 398 diffcore_std(&opt);
399 diff_flush(&opt); 399 diff_flush(&opt);
400} 400}
401 401
402void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix) 402void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix)
403{ 403{
404 unsigned char *old_sha1 = NULL; 404 const struct object_id *old_oid = NULL;
405 405
406 if (commit->parents) 406 if (commit->parents)
407 old_sha1 = commit->parents->item->object.oid.hash; 407 old_oid = &commit->parents->item->object.oid;
408 cgit_diff_tree(old_sha1, commit->object.oid.hash, fn, prefix, 408 cgit_diff_tree(old_oid, &commit->object.oid, fn, prefix,
409 ctx.qry.ignorews); 409 ctx.qry.ignorews);
410} 410}
411 411
diff --git a/ui-diff.c b/ui-diff.c index edee793..173d351 100644 --- a/ui-diff.c +++ b/ui-diff.c
@@ -12,8 +12,8 @@
12#include "ui-shared.h" 12#include "ui-shared.h"
13#include "ui-ssdiff.h" 13#include "ui-ssdiff.h"
14 14
15unsigned char old_rev_sha1[20]; 15struct object_id old_rev_oid[1];
16unsigned char new_rev_sha1[20]; 16struct object_id new_rev_oid[1];
17 17
18static int files, slots; 18static int files, slots;
19static int total_adds, total_rems, max_changes; 19static int total_adds, total_rems, max_changes;
@@ -21,8 +21,8 @@ static int lines_added, lines_removed;
21 21
22static struct fileinfo { 22static struct fileinfo {
23 char status; 23 char status;
24 unsigned char old_sha1[20]; 24 struct object_id old_oid[1];
25 unsigned char new_sha1[20]; 25 struct object_id new_oid[1];
26 unsigned short old_mode; 26 unsigned short old_mode;
27 unsigned short new_mode; 27 unsigned short new_mode;
28 char *old_path; 28 char *old_path;
@@ -83,15 +83,15 @@ static void print_fileinfo(struct fileinfo *info)
83 83
84 html("<tr>"); 84 html("<tr>");
85 htmlf("<td class='mode'>"); 85 htmlf("<td class='mode'>");
86 if (is_null_sha1(info->new_sha1)) { 86 if (is_null_oid(info->new_oid)) {
87 cgit_print_filemode(info->old_mode); 87 cgit_print_filemode(info->old_mode);
88 } else { 88 } else {
89 cgit_print_filemode(info->new_mode); 89 cgit_print_filemode(info->new_mode);
90 } 90 }
91 91
92 if (info->old_mode != info->new_mode && 92 if (info->old_mode != info->new_mode &&
93 !is_null_sha1(info->old_sha1) && 93 !is_null_oid(info->old_oid) &&
94 !is_null_sha1(info->new_sha1)) { 94 !is_null_oid(info->new_oid)) {
95 html("<span class='modechange'>["); 95 html("<span class='modechange'>[");
96 cgit_print_filemode(info->old_mode); 96 cgit_print_filemode(info->old_mode);
97 html("]</span>"); 97 html("]</span>");
@@ -160,7 +160,7 @@ static void inspect_filepair(struct diff_filepair *pair)
160 files++; 160 files++;
161 lines_added = 0; 161 lines_added = 0;
162 lines_removed = 0; 162 lines_removed = 0;
163 cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, &new_size, 163 cgit_diff_files(&pair->one->oid, &pair->two->oid, &old_size, &new_size,
164 &binary, 0, ctx.qry.ignorews, count_diff_lines); 164 &binary, 0, ctx.qry.ignorews, count_diff_lines);
165 if (files >= slots) { 165 if (files >= slots) {
166 if (slots == 0) 166 if (slots == 0)
@@ -170,8 +170,8 @@ static void inspect_filepair(struct diff_filepair *pair)
170 items = xrealloc(items, slots * sizeof(struct fileinfo)); 170 items = xrealloc(items, slots * sizeof(struct fileinfo));
171 } 171 }
172 items[files-1].status = pair->status; 172 items[files-1].status = pair->status;
173 hashcpy(items[files-1].old_sha1, pair->one->sha1); 173 oidcpy(items[files-1].old_oid, &pair->one->oid);
174 hashcpy(items[files-1].new_sha1, pair->two->sha1); 174 oidcpy(items[files-1].new_oid, &pair->two->oid);
175 items[files-1].old_mode = pair->one->mode; 175 items[files-1].old_mode = pair->one->mode;
176 items[files-1].new_mode = pair->two->mode; 176 items[files-1].new_mode = pair->two->mode;
177 items[files-1].old_path = xstrdup(pair->one->path); 177 items[files-1].old_path = xstrdup(pair->one->path);
@@ -187,8 +187,8 @@ static void inspect_filepair(struct diff_filepair *pair)
187 total_rems += lines_removed; 187 total_rems += lines_removed;
188} 188}
189 189
190static void cgit_print_diffstat(const unsigned char *old_sha1, 190static void cgit_print_diffstat(const struct object_id *old_oid,
191 const unsigned char *new_sha1, 191 const struct object_id *new_oid,
192 const char *prefix) 192 const char *prefix)
193{ 193{
194 int i; 194 int i;
@@ -204,7 +204,7 @@ static void cgit_print_diffstat(const unsigned char *old_sha1,
204 html("</div>"); 204 html("</div>");
205 html("<table summary='diffstat' class='diffstat'>"); 205 html("<table summary='diffstat' class='diffstat'>");
206 max_changes = 0; 206 max_changes = 0;
207 cgit_diff_tree(old_sha1, new_sha1, inspect_filepair, prefix, 207 cgit_diff_tree(old_oid, new_oid, inspect_filepair, prefix,
208 ctx.qry.ignorews); 208 ctx.qry.ignorews);
209 for (i = 0; i<files; i++) 209 for (i = 0; i<files; i++)
210 print_fileinfo(&items[i]); 210 print_fileinfo(&items[i]);
@@ -238,8 +238,8 @@ static void print_line(char *line, int len)
238 line[len-1] = c; 238 line[len-1] = c;
239} 239}
240 240
241static void header(unsigned char *sha1, char *path1, int mode1, 241static void header(const struct object_id *oid1, char *path1, int mode1,
242 unsigned char *sha2, char *path2, int mode2) 242 const struct object_id *oid2, char *path2, int mode2)
243{ 243{
244 char *abbrev1, *abbrev2; 244 char *abbrev1, *abbrev2;
245 int subproject; 245 int subproject;
@@ -258,8 +258,8 @@ static void header(unsigned char *sha1, char *path1, int mode1,
258 htmlf("<br/>deleted file mode %.6o", mode1); 258 htmlf("<br/>deleted file mode %.6o", mode1);
259 259
260 if (!subproject) { 260 if (!subproject) {
261 abbrev1 = xstrdup(find_unique_abbrev(sha1, DEFAULT_ABBREV)); 261 abbrev1 = xstrdup(find_unique_abbrev(oid1->hash, DEFAULT_ABBREV));
262 abbrev2 = xstrdup(find_unique_abbrev(sha2, DEFAULT_ABBREV)); 262 abbrev2 = xstrdup(find_unique_abbrev(oid2->hash, DEFAULT_ABBREV));
263 htmlf("<br/>index %s..%s", abbrev1, abbrev2); 263 htmlf("<br/>index %s..%s", abbrev1, abbrev2);
264 free(abbrev1); 264 free(abbrev1);
265 free(abbrev2); 265 free(abbrev2);
@@ -268,24 +268,24 @@ static void header(unsigned char *sha1, char *path1, int mode1,
268 if (mode2 != mode1) 268 if (mode2 != mode1)
269 htmlf("..%.6o", mode2); 269 htmlf("..%.6o", mode2);
270 } 270 }
271 if (is_null_sha1(sha1)) { 271 if (is_null_oid(oid1)) {
272 path1 = "dev/null"; 272 path1 = "dev/null";
273 html("<br/>--- /"); 273 html("<br/>--- /");
274 } else 274 } else
275 html("<br/>--- a/"); 275 html("<br/>--- a/");
276 if (mode1 != 0) 276 if (mode1 != 0)
277 cgit_tree_link(path1, NULL, NULL, ctx.qry.head, 277 cgit_tree_link(path1, NULL, NULL, ctx.qry.head,
278 sha1_to_hex(old_rev_sha1), path1); 278 oid_to_hex(old_rev_oid), path1);
279 else 279 else
280 html_txt(path1); 280 html_txt(path1);
281 if (is_null_sha1(sha2)) { 281 if (is_null_oid(oid2)) {
282 path2 = "dev/null"; 282 path2 = "dev/null";
283 html("<br/>+++ /"); 283 html("<br/>+++ /");
284 } else 284 } else
285 html("<br/>+++ b/"); 285 html("<br/>+++ b/");
286 if (mode2 != 0) 286 if (mode2 != 0)
287 cgit_tree_link(path2, NULL, NULL, ctx.qry.head, 287 cgit_tree_link(path2, NULL, NULL, ctx.qry.head,
288 sha1_to_hex(new_rev_sha1), path2); 288 oid_to_hex(new_rev_oid), path2);
289 else 289 else
290 html_txt(path2); 290 html_txt(path2);
291 } 291 }
@@ -307,20 +307,20 @@ static void filepair_cb(struct diff_filepair *pair)
307 cgit_ssdiff_header_begin(); 307 cgit_ssdiff_header_begin();
308 print_line_fn = cgit_ssdiff_line_cb; 308 print_line_fn = cgit_ssdiff_line_cb;
309 } 309 }
310 header(pair->one->sha1, pair->one->path, pair->one->mode, 310 header(&pair->one->oid, pair->one->path, pair->one->mode,
311 pair->two->sha1, pair->two->path, pair->two->mode); 311 &pair->two->oid, pair->two->path, pair->two->mode);
312 if (use_ssdiff) 312 if (use_ssdiff)
313 cgit_ssdiff_header_end(); 313 cgit_ssdiff_header_end();
314 if (S_ISGITLINK(pair->one->mode) || S_ISGITLINK(pair->two->mode)) { 314 if (S_ISGITLINK(pair->one->mode) || S_ISGITLINK(pair->two->mode)) {
315 if (S_ISGITLINK(pair->one->mode)) 315 if (S_ISGITLINK(pair->one->mode))
316 print_line_fn(fmt("-Subproject %s", sha1_to_hex(pair->one->sha1)), 52); 316 print_line_fn(fmt("-Subproject %s", oid_to_hex(&pair->one->oid)), 52);
317 if (S_ISGITLINK(pair->two->mode)) 317 if (S_ISGITLINK(pair->two->mode))
318 print_line_fn(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52); 318 print_line_fn(fmt("+Subproject %s", oid_to_hex(&pair->two->oid)), 52);
319 if (use_ssdiff) 319 if (use_ssdiff)
320 cgit_ssdiff_footer(); 320 cgit_ssdiff_footer();
321 return; 321 return;
322 } 322 }
323 if (cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, 323 if (cgit_diff_files(&pair->one->oid, &pair->two->oid, &old_size,
324 &new_size, &binary, ctx.qry.context, 324 &new_size, &binary, ctx.qry.context,
325 ctx.qry.ignorews, print_line_fn)) 325 ctx.qry.ignorews, print_line_fn))
326 cgit_print_error("Error running diff"); 326 cgit_print_error("Error running diff");
@@ -402,36 +402,36 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
402 402
403 if (!new_rev) 403 if (!new_rev)
404 new_rev = ctx.qry.head; 404 new_rev = ctx.qry.head;
405 if (get_sha1(new_rev, new_rev_sha1)) { 405 if (get_oid(new_rev, new_rev_oid)) {
406 cgit_print_error_page(404, "Not found", 406 cgit_print_error_page(404, "Not found",
407 "Bad object name: %s", new_rev); 407 "Bad object name: %s", new_rev);
408 return; 408 return;
409 } 409 }
410 commit = lookup_commit_reference(new_rev_sha1); 410 commit = lookup_commit_reference(new_rev_oid->hash);
411 if (!commit || parse_commit(commit)) { 411 if (!commit || parse_commit(commit)) {
412 cgit_print_error_page(404, "Not found", 412 cgit_print_error_page(404, "Not found",
413 "Bad commit: %s", sha1_to_hex(new_rev_sha1)); 413 "Bad commit: %s", oid_to_hex(new_rev_oid));
414 return; 414 return;
415 } 415 }
416 new_tree_sha1 = commit->tree->object.oid.hash; 416 new_tree_sha1 = commit->tree->object.oid.hash;
417 417
418 if (old_rev) { 418 if (old_rev) {
419 if (get_sha1(old_rev, old_rev_sha1)) { 419 if (get_oid(old_rev, old_rev_oid)) {
420 cgit_print_error_page(404, "Not found", 420 cgit_print_error_page(404, "Not found",
421 "Bad object name: %s", old_rev); 421 "Bad object name: %s", old_rev);
422 return; 422 return;
423 } 423 }
424 } else if (commit->parents && commit->parents->item) { 424 } else if (commit->parents && commit->parents->item) {
425 hashcpy(old_rev_sha1, commit->parents->item->object.oid.hash); 425 oidcpy(old_rev_oid, &commit->parents->item->object.oid);
426 } else { 426 } else {
427 hashclr(old_rev_sha1); 427 oidclr(old_rev_oid);
428 } 428 }
429 429
430 if (!is_null_sha1(old_rev_sha1)) { 430 if (!is_null_oid(old_rev_oid)) {
431 commit2 = lookup_commit_reference(old_rev_sha1); 431 commit2 = lookup_commit_reference(old_rev_oid->hash);
432 if (!commit2 || parse_commit(commit2)) { 432 if (!commit2 || parse_commit(commit2)) {
433 cgit_print_error_page(404, "Not found", 433 cgit_print_error_page(404, "Not found",
434 "Bad commit: %s", sha1_to_hex(old_rev_sha1)); 434 "Bad commit: %s", oid_to_hex(old_rev_oid));
435 return; 435 return;
436 } 436 }
437 old_tree_sha1 = commit2->tree->object.oid.hash; 437 old_tree_sha1 = commit2->tree->object.oid.hash;
@@ -479,7 +479,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
479 if (difftype == DIFF_STATONLY) 479 if (difftype == DIFF_STATONLY)
480 ctx.qry.difftype = ctx.cfg.difftype; 480 ctx.qry.difftype = ctx.cfg.difftype;
481 481
482 cgit_print_diffstat(old_rev_sha1, new_rev_sha1, prefix); 482 cgit_print_diffstat(old_rev_oid, new_rev_oid, prefix);
483 483
484 if (difftype == DIFF_STATONLY) 484 if (difftype == DIFF_STATONLY)
485 return; 485 return;
@@ -490,7 +490,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
490 html("<table summary='diff' class='diff'>"); 490 html("<table summary='diff' class='diff'>");
491 html("<tr><td>"); 491 html("<tr><td>");
492 } 492 }
493 cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb, prefix, 493 cgit_diff_tree(old_rev_oid, new_rev_oid, filepair_cb, prefix,
494 ctx.qry.ignorews); 494 ctx.qry.ignorews);
495 if (!use_ssdiff) 495 if (!use_ssdiff)
496 html("</td></tr>"); 496 html("</td></tr>");
diff --git a/ui-diff.h b/ui-diff.h index 382e8c5..39264a1 100644 --- a/ui-diff.h +++ b/ui-diff.h
@@ -9,7 +9,7 @@ extern void cgit_print_diff(const char *new_hex, const char *old_hex,
9extern struct diff_filespec *cgit_get_current_old_file(void); 9extern struct diff_filespec *cgit_get_current_old_file(void);
10extern struct diff_filespec *cgit_get_current_new_file(void); 10extern struct diff_filespec *cgit_get_current_new_file(void);
11 11
12extern unsigned char old_rev_sha1[20]; 12extern struct object_id old_rev_oid[1];
13extern unsigned char new_rev_sha1[20]; 13extern struct object_id new_rev_oid[1];
14 14
15#endif /* UI_DIFF_H */ 15#endif /* UI_DIFF_H */
diff --git a/ui-log.c b/ui-log.c index c97b8e0..a31ff7c 100644 --- a/ui-log.c +++ b/ui-log.c
@@ -49,7 +49,7 @@ static void inspect_files(struct diff_filepair *pair)
49 49
50 files++; 50 files++;
51 if (ctx.repo->enable_log_linecount) 51 if (ctx.repo->enable_log_linecount)
52 cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, 52 cgit_diff_files(&pair->one->oid, &pair->two->oid, &old_size,
53 &new_size, &binary, 0, ctx.qry.ignorews, 53 &new_size, &binary, 0, ctx.qry.ignorews,
54 count_lines); 54 count_lines);
55} 55}
diff --git a/ui-ssdiff.c b/ui-ssdiff.c index d183d40..16c812f 100644 --- a/ui-ssdiff.c +++ b/ui-ssdiff.c
@@ -229,7 +229,7 @@ static void print_ssdiff_line(char *class,
229 if (old_line_no > 0) { 229 if (old_line_no > 0) {
230 struct diff_filespec *old_file = cgit_get_current_old_file(); 230 struct diff_filespec *old_file = cgit_get_current_old_file();
231 char *lineno_str = fmt("n%d", old_line_no); 231 char *lineno_str = fmt("n%d", old_line_no);
232 char *id_str = fmt("id=%s#%s", is_null_sha1(old_file->sha1)?"HEAD":sha1_to_hex(old_rev_sha1), lineno_str); 232 char *id_str = fmt("id=%s#%s", is_null_oid(&old_file->oid)?"HEAD":oid_to_hex(old_rev_oid), lineno_str);
233 char *fileurl = cgit_fileurl(ctx.repo->url, "tree", old_file->path, id_str); 233 char *fileurl = cgit_fileurl(ctx.repo->url, "tree", old_file->path, id_str);
234 html("<td class='lineno'><a href='"); 234 html("<td class='lineno'><a href='");
235 html(fileurl); 235 html(fileurl);
@@ -252,7 +252,7 @@ static void print_ssdiff_line(char *class,
252 if (new_line_no > 0) { 252 if (new_line_no > 0) {
253 struct diff_filespec *new_file = cgit_get_current_new_file(); 253 struct diff_filespec *new_file = cgit_get_current_new_file();
254 char *lineno_str = fmt("n%d", new_line_no); 254 char *lineno_str = fmt("n%d", new_line_no);
255 char *id_str = fmt("id=%s#%s", is_null_sha1(new_file->sha1)?"HEAD":sha1_to_hex(new_rev_sha1), lineno_str); 255 char *id_str = fmt("id=%s#%s", is_null_oid(&new_file->oid)?"HEAD":oid_to_hex(new_rev_oid), lineno_str);
256 char *fileurl = cgit_fileurl(ctx.repo->url, "tree", new_file->path, id_str); 256 char *fileurl = cgit_fileurl(ctx.repo->url, "tree", new_file->path, id_str);
257 html("<td class='lineno'><a href='"); 257 html("<td class='lineno'><a href='");
258 html(fileurl); 258 html(fileurl);